[Bf-blender-cvs] [8482ba6d2e1] master: UI: Text Editor header cleanup

William Reynish noreply at git.blender.org
Thu Jan 23 14:53:21 CET 2020


Commit: 8482ba6d2e1a97e038175a7fb693ed40c03ca5d9
Author: William Reynish
Date:   Thu Jan 23 14:53:19 2020 +0100
Branches: master
https://developer.blender.org/rB8482ba6d2e1a97e038175a7fb693ed40c03ca5d9

UI: Text Editor header cleanup

  - Register toggle is in the Text menu
  - Run Script and Refresh OSL become an icon buttons next to ID block

Differential Revision: https://developer.blender.org/D5686

Reviewed by Campbell Barton

===================================================================

M	release/scripts/startup/bl_ui/space_text.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py
index 81ccc9216a1..b7c5dcd5437 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -30,7 +30,7 @@ class TEXT_HT_header(Header):
 
         st = context.space_data
         text = st.text
-
+        is_syntax_highlight_supported = st.is_syntax_highlight_supported()
         layout.template_header()
 
         TEXT_MT_editor_menus.draw_collapsible(context, layout)
@@ -43,7 +43,18 @@ class TEXT_HT_header(Header):
         layout.separator_spacer()
 
         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()
 
@@ -51,28 +62,10 @@ class TEXT_HT_header(Header):
         row.prop(st, "show_line_numbers", text="")
         row.prop(st, "show_word_wrap", text="")
 
-        is_syntax_highlight_supported = st.is_syntax_highlight_supported()
         syntax = row.row(align=True)
         syntax.active = is_syntax_highlight_supported
         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):
     bl_space_type = 'TEXT_EDITOR'



More information about the Bf-blender-cvs mailing list