Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / release / ui / space_text.py
index 117033c..61e8d34 100644 (file)
@@ -2,13 +2,12 @@
 import bpy
 
 class TEXT_HT_header(bpy.types.Header):
-       __space_type__ = 'TEXT_EDITOR'
+       __space_type__ = "TEXT_EDITOR"
 
        def draw(self, context):
-               layout = self.layout
-               
                st = context.space_data
                text = st.text
+               layout = self.layout
 
                row = layout.row(align=True)
                row.template_header()
@@ -46,14 +45,13 @@ class TEXT_HT_header(bpy.types.Header):
                                        row.itemL(text="Text: Internal")
 
 class TEXT_PT_properties(bpy.types.Panel):
-       __space_type__ = 'TEXT_EDITOR'
-       __region_type__ = 'UI'
+       __space_type__ = "TEXT_EDITOR"
+       __region_type__ = "UI"
        __label__ = "Properties"
 
        def draw(self, context):
-               layout = self.layout
-               
                st = context.space_data
+               layout = self.layout
 
                flow = layout.column_flow()
                flow.itemR(st, "line_numbers")
@@ -66,14 +64,13 @@ class TEXT_PT_properties(bpy.types.Panel):
                flow.itemR(st, "tab_width")
 
 class TEXT_PT_find(bpy.types.Panel):
-       __space_type__ = 'TEXT_EDITOR'
-       __region_type__ = 'UI'
+       __space_type__ = "TEXT_EDITOR"
+       __region_type__ = "UI"
        __label__ = "Find"
 
        def draw(self, context):
-               layout = self.layout
-               
                st = context.space_data
+               layout = self.layout
 
                # find
                col = layout.column(align=True)
@@ -98,12 +95,11 @@ class TEXT_PT_find(bpy.types.Panel):
                row.itemR(st, "find_all", text="All")
 
 class TEXT_MT_text(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
+       __space_type__ = "TEXT_EDITOR"
        __label__ = "Text"
 
        def draw(self, context):
                layout = self.layout
-               
                st = context.space_data
                text = st.text
 
@@ -131,7 +127,7 @@ class TEXT_MT_text(bpy.types.Menu):
 
                layout.itemS()
 
-               layout.itemO("text.properties", icon='ICON_MENU_PANEL')
+               layout.itemO("text.properties", icon="ICON_MENU_PANEL")
                
                #ifndef DISABLE_PYTHON
                # XXX layout.column()
@@ -140,7 +136,7 @@ class TEXT_MT_text(bpy.types.Menu):
                #endif
 
 class TEXT_MT_edit_view(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
+       __space_type__ = "TEXT_EDITOR"
        __label__ = "View"
 
        def draw(self, context):
@@ -150,7 +146,7 @@ class TEXT_MT_edit_view(bpy.types.Menu):
                layout.item_enumO("text.move", "type", 'FILE_BOTTOM', text="Bottom of File")
 
 class TEXT_MT_edit_select(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
+       __space_type__ = "TEXT_EDITOR"
        __label__ = "Select"
 
        def draw(self, context):
@@ -160,7 +156,7 @@ class TEXT_MT_edit_select(bpy.types.Menu):
                layout.itemO("text.select_line")
 
 class TEXT_MT_edit_markers(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
+       __space_type__ = "TEXT_EDITOR"
        __label__ = "Markers"
 
        def draw(self, context):
@@ -171,7 +167,7 @@ class TEXT_MT_edit_markers(bpy.types.Menu):
                layout.itemO("text.previous_marker")
 
 class TEXT_MT_format(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
+       __space_type__ = "TEXT_EDITOR"
        __label__ = "Format"
 
        def draw(self, context):
@@ -190,7 +186,7 @@ class TEXT_MT_format(bpy.types.Menu):
                layout.item_menu_enumO("text.convert_whitespace", "type")
 
 class TEXT_MT_edit_to3d(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
+       __space_type__ = "TEXT_EDITOR"
        __label__ = "Text To 3D Object"
 
        def draw(self, context):
@@ -200,11 +196,12 @@ class TEXT_MT_edit_to3d(bpy.types.Menu):
                layout.item_booleanO("text.to_3d_object", "split_lines", True, text="One Object Per Line");
 
 class TEXT_MT_edit(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
+       __space_type__ = "TEXT_EDITOR"
        __label__ = "Edit"
 
        def poll(self, context):
-               return (context.space_data.text)
+               st = context.space_data
+               return st.text != None
 
        def draw(self, context):
                layout = self.layout
@@ -243,3 +240,4 @@ bpy.types.register(TEXT_MT_edit_view)
 bpy.types.register(TEXT_MT_edit_select)
 bpy.types.register(TEXT_MT_edit_markers)
 bpy.types.register(TEXT_MT_edit_to3d)
+