Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_text.py
| Show All 24 Lines | |||||
| class TEXT_HT_header(Header): | class TEXT_HT_header(Header): | ||||
| bl_space_type = 'TEXT_EDITOR' | bl_space_type = 'TEXT_EDITOR' | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| st = context.space_data | st = context.space_data | ||||
| text = st.text | text = st.text | ||||
| is_syntax_highlight_supported = st.is_syntax_highlight_supported() | |||||
| layout.template_header() | layout.template_header() | ||||
| TEXT_MT_editor_menus.draw_collapsible(context, layout) | TEXT_MT_editor_menus.draw_collapsible(context, layout) | ||||
| if text and text.is_modified: | if text and text.is_modified: | ||||
| row = layout.row(align=True) | row = layout.row(align=True) | ||||
| row.alert = True | row.alert = True | ||||
| row.operator("text.resolve_conflict", text="", icon='HELP') | row.operator("text.resolve_conflict", text="", icon='HELP') | ||||
| layout.separator_spacer() | layout.separator_spacer() | ||||
| row = layout.row(align=True) | row = layout.row(align=True) | ||||
| row.template_ID(st, "text", new="text.new", unlink="text.unlink", open="text.open") | row.template_ID(st, "text", new="text.new", | ||||
| unlink="text.unlink", open="text.open") | |||||
| if text: | |||||
| is_osl = text.name.endswith((".osl", ".osl")) | |||||
| if is_osl: | |||||
| row.operator("node.shader_script_update", | |||||
| text="", icon='FILE_REFRESH') | |||||
| else: | |||||
| row = layout.row() | |||||
| row.active = is_syntax_highlight_supported | |||||
| row.operator("text.run_script", text="", icon='PLAY') | |||||
| layout.separator_spacer() | layout.separator_spacer() | ||||
| row = layout.row(align=True) | row = layout.row(align=True) | ||||
| row.prop(st, "show_line_numbers", text="") | row.prop(st, "show_line_numbers", text="") | ||||
| row.prop(st, "show_word_wrap", text="") | row.prop(st, "show_word_wrap", text="") | ||||
| is_syntax_highlight_supported = st.is_syntax_highlight_supported() | |||||
| syntax = row.row(align=True) | syntax = row.row(align=True) | ||||
| syntax.active = is_syntax_highlight_supported | syntax.active = is_syntax_highlight_supported | ||||
| syntax.prop(st, "show_syntax_highlight", text="") | syntax.prop(st, "show_syntax_highlight", text="") | ||||
| if text: | |||||
| text_name = text.name | |||||
| is_osl = text_name.endswith((".osl", ".oso")) | |||||
| row = layout.row() | |||||
| if is_osl: | |||||
| row = layout.row() | |||||
| row.operator("node.shader_script_update") | |||||
| else: | |||||
| row = layout.row() | |||||
| row.active = text_name.endswith(".py") | |||||
| row.prop(text, "use_module") | |||||
| row = layout.row() | |||||
| row.active = is_syntax_highlight_supported | |||||
| row.operator("text.run_script") | |||||
| class TEXT_HT_footer(Header): | class TEXT_HT_footer(Header): | ||||
| bl_space_type = 'TEXT_EDITOR' | bl_space_type = 'TEXT_EDITOR' | ||||
| bl_region_type = 'FOOTER' | bl_region_type = 'FOOTER' | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| ▲ Show 20 Lines • Show All 390 Lines • Show Last 20 Lines | |||||