remove use of gettext: _("...") style translation now its handled by rna.
[blender.git] / release / scripts / startup / bl_ui / space_text.py
index 582c9442a4a2ce56273ab9fd169d0c17780eaf82..d0a3a53aa85fd9e69f42f7ecb8f97560de5e3bba 100644 (file)
 
 # <pep8-80 compliant>
 import bpy
+from bpy.types import Header, Menu, Panel
 
 
-class TEXT_HT_header(bpy.types.Header):
+class TEXT_HT_header(Header):
     bl_space_type = 'TEXT_EDITOR'
 
     def draw(self, context):
@@ -33,22 +34,21 @@ class TEXT_HT_header(bpy.types.Header):
         row.template_header()
 
         if context.area.show_menus:
-            sub = row.row(align=True)
-            sub.menu("TEXT_MT_view")
-            sub.menu("TEXT_MT_text")
+            row.menu("TEXT_MT_view")
+            row.menu("TEXT_MT_text")
 
             if text:
-                sub.menu("TEXT_MT_edit")
-                sub.menu("TEXT_MT_format")
+                row.menu("TEXT_MT_edit")
+                row.menu("TEXT_MT_format")
 
-            sub.menu("TEXT_MT_templates")
+            row.menu("TEXT_MT_templates")
 
         if text and text.is_modified:
-            row = layout.row()
-            row.alert = True
-            row.operator("text.resolve_conflict", text="", icon='HELP')
+            sub = row.row()
+            sub.alert = True
+            sub.operator("text.resolve_conflict", text="", icon='HELP')
 
-        layout.template_ID(st, "text", new="text.new", unlink="text.unlink")
+        row.template_ID(st, "text", new="text.new", unlink="text.unlink")
 
         row = layout.row(align=True)
         row.prop(st, "show_line_numbers", text="")
@@ -66,16 +66,16 @@ class TEXT_HT_header(bpy.types.Header):
             row = layout.row()
             if text.filepath:
                 if text.is_dirty:
-                    row.label(text="File: *%r (unsaved)" % text.filepath)
+                    row.label(text="File" + ": *%r " % text.filepath + "(unsaved)")
                 else:
-                    row.label(text="File: %r" % text.filepath)
+                    row.label(text="File" + ": %r" % text.filepath)
             else:
                 row.label(text="Text: External"
                           if text.library
                           else "Text: Internal")
 
 
-class TEXT_PT_properties(bpy.types.Panel):
+class TEXT_PT_properties(Panel):
     bl_space_type = 'TEXT_EDITOR'
     bl_region_type = 'UI'
     bl_label = "Properties"
@@ -106,7 +106,7 @@ class TEXT_PT_properties(bpy.types.Panel):
         col.prop(st, "margin_column")
 
 
-class TEXT_PT_find(bpy.types.Panel):
+class TEXT_PT_find(Panel):
     bl_space_type = 'TEXT_EDITOR'
     bl_region_type = 'UI'
     bl_label = "Find"
@@ -140,7 +140,7 @@ class TEXT_PT_find(bpy.types.Panel):
         row.prop(st, "use_find_all", text="All")
 
 
-class TEXT_MT_view(bpy.types.Menu):
+class TEXT_MT_view(Menu):
     bl_label = "View"
 
     def draw(self, context):
@@ -163,7 +163,7 @@ class TEXT_MT_view(bpy.types.Menu):
                         ).type = 'FILE_BOTTOM'
 
 
-class TEXT_MT_text(bpy.types.Menu):
+class TEXT_MT_text(Menu):
     bl_label = "Text"
 
     def draw(self, context):
@@ -172,8 +172,9 @@ class TEXT_MT_text(bpy.types.Menu):
         st = context.space_data
         text = st.text
 
-        layout.column()
+        layout.operator_context = 'EXEC_AREA'
         layout.operator("text.new")
+        layout.operator_context = 'INVOKE_AREA'
         layout.operator("text.open")
 
         if text:
@@ -189,13 +190,8 @@ class TEXT_MT_text(bpy.types.Menu):
             layout.column()
             layout.operator("text.run_script")
 
-            #ifdef WITH_PYTHON
-            # XXX if(BPY_is_pyconstraint(text))
-            # XXX   uiMenuItemO(head, 0, "text.refresh_pyconstraints");
-            #endif
-
 
-class TEXT_MT_templates(bpy.types.Menu):
+class TEXT_MT_templates(Menu):
     bl_label = "Templates"
 
     def draw(self, context):
@@ -205,7 +201,7 @@ class TEXT_MT_templates(bpy.types.Menu):
                        )
 
 
-class TEXT_MT_edit_select(bpy.types.Menu):
+class TEXT_MT_edit_select(Menu):
     bl_label = "Select"
 
     def draw(self, context):
@@ -215,7 +211,7 @@ class TEXT_MT_edit_select(bpy.types.Menu):
         layout.operator("text.select_line")
 
 
-class TEXT_MT_edit_markers(bpy.types.Menu):
+class TEXT_MT_edit_markers(Menu):
     bl_label = "Markers"
 
     def draw(self, context):
@@ -226,7 +222,7 @@ class TEXT_MT_edit_markers(bpy.types.Menu):
         layout.operator("text.previous_marker")
 
 
-class TEXT_MT_format(bpy.types.Menu):
+class TEXT_MT_format(Menu):
     bl_label = "Format"
 
     def draw(self, context):
@@ -245,7 +241,7 @@ class TEXT_MT_format(bpy.types.Menu):
         layout.operator_menu_enum("text.convert_whitespace", "type")
 
 
-class TEXT_MT_edit_to3d(bpy.types.Menu):
+class TEXT_MT_edit_to3d(Menu):
     bl_label = "Text To 3D Object"
 
     def draw(self, context):
@@ -259,7 +255,7 @@ class TEXT_MT_edit_to3d(bpy.types.Menu):
                         ).split_lines = True
 
 
-class TEXT_MT_edit(bpy.types.Menu):
+class TEXT_MT_edit(Menu):
     bl_label = "Edit"
 
     @classmethod
@@ -293,7 +289,7 @@ class TEXT_MT_edit(bpy.types.Menu):
         layout.menu("TEXT_MT_edit_to3d")
 
 
-class TEXT_MT_toolbox(bpy.types.Menu):
+class TEXT_MT_toolbox(Menu):
     bl_label = ""
 
     def draw(self, context):