diff options
Diffstat (limited to 'release/scripts/ui/space_text.py')
-rw-r--r-- | release/scripts/ui/space_text.py | 90 |
1 files changed, 37 insertions, 53 deletions
diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py index 692f1581bd6..0b7e215dc37 100644 --- a/release/scripts/ui/space_text.py +++ b/release/scripts/ui/space_text.py @@ -34,12 +34,13 @@ class TEXT_HT_header(bpy.types.Header): if context.area.show_menus: sub = row.row(align=True) + sub.menu("TEXT_MT_view") sub.menu("TEXT_MT_text") if text: sub.menu("TEXT_MT_edit") sub.menu("TEXT_MT_format") - if text and text.modified: + if text and text.is_modified: row = layout.row() # row.color(redalert) row.operator("text.resolve_conflict", text="", icon='HELP') @@ -47,9 +48,9 @@ class TEXT_HT_header(bpy.types.Header): layout.template_ID(st, "text", new="text.new", unlink="text.unlink") row = layout.row(align=True) - row.prop(st, "line_numbers", text="") - row.prop(st, "word_wrap", text="") - row.prop(st, "syntax_highlight", text="") + row.prop(st, "show_line_numbers", text="") + row.prop(st, "show_word_wrap", text="") + row.prop(st, "show_syntax_highlight", text="") if text: row = layout.row() @@ -61,7 +62,7 @@ class TEXT_HT_header(bpy.types.Header): row = layout.row() if text.filepath: - if text.dirty: + if text.is_dirty: row.label(text="File: *%s (unsaved)" % text.filepath) else: row.label(text="File: %s" % text.filepath) @@ -80,10 +81,11 @@ class TEXT_PT_properties(bpy.types.Panel): st = context.space_data flow = layout.column_flow() - flow.prop(st, "line_numbers") - flow.prop(st, "word_wrap") - flow.prop(st, "syntax_highlight") - flow.prop(st, "live_edit") + flow.prop(st, "show_line_numbers") + flow.prop(st, "show_word_wrap") + flow.prop(st, "show_syntax_highlight") + flow.prop(st, "show_line_highlight") + flow.prop(st, "use_live_edit") flow = layout.column_flow() flow.prop(st, "font_size") @@ -91,7 +93,7 @@ class TEXT_PT_properties(bpy.types.Panel): text = st.text if text: - flow.prop(text, "tabs_as_spaces") + flow.prop(text, "use_tabs_as_spaces") class TEXT_PT_find(bpy.types.Panel): @@ -123,10 +125,29 @@ class TEXT_PT_find(bpy.types.Panel): # settings row = layout.row() - row.prop(st, "find_wrap", text="Wrap") - row.prop(st, "find_all", text="All") + row.prop(st, "use_find_wrap", text="Wrap") + row.prop(st, "use_find_all", text="All") +class TEXT_MT_view(bpy.types.Menu): + bl_label = "View" + + def draw(self, context): + layout = self.layout + + layout.operator("text.properties", icon='MENU_PANEL') + + layout.separator() + + layout.operator("screen.area_dupli") + layout.operator("screen.screen_full_area") + + layout.separator() + + layout.operator("text.move", text="Top of File").type = 'FILE_TOP' + layout.operator("text.move", text="Bottom of File").type = 'FILE_BOTTOM' + + class TEXT_MT_text(bpy.types.Menu): bl_label = "Text" @@ -160,15 +181,8 @@ class TEXT_MT_text(bpy.types.Menu): layout.separator() - layout.operator("text.properties", icon='MENU_PANEL') - layout.menu("TEXT_MT_templates") - layout.separator() - - layout.operator("screen.area_dupli") - layout.operator("screen.screen_full_area") - class TEXT_MT_templates(bpy.types.Menu): ''' @@ -180,16 +194,6 @@ class TEXT_MT_templates(bpy.types.Menu): self.path_menu(bpy.utils.script_paths("templates"), "text.open", {"internal": True}) -class TEXT_MT_edit_view(bpy.types.Menu): - bl_label = "View" - - def draw(self, context): - layout = self.layout - - layout.operator("text.move", text="Top of File").type = 'FILE_TOP' - layout.operator("text.move", text="Bottom of File").type = 'FILE_BOTTOM' - - class TEXT_MT_edit_select(bpy.types.Menu): bl_label = "Select" @@ -243,7 +247,8 @@ class TEXT_MT_edit_to3d(bpy.types.Menu): class TEXT_MT_edit(bpy.types.Menu): bl_label = "Edit" - def poll(self, context): + @classmethod + def poll(cls, context): return (context.space_data.text) def draw(self, context): @@ -260,7 +265,6 @@ class TEXT_MT_edit(bpy.types.Menu): layout.separator() - layout.menu("TEXT_MT_edit_view") layout.menu("TEXT_MT_edit_select") layout.menu("TEXT_MT_edit_markers") @@ -289,32 +293,12 @@ class TEXT_MT_toolbox(bpy.types.Menu): layout.operator("text.run_script") - -classes = [ - TEXT_HT_header, - TEXT_PT_properties, - TEXT_PT_find, - TEXT_MT_text, - TEXT_MT_templates, - TEXT_MT_format, - TEXT_MT_edit, - TEXT_MT_edit_view, - TEXT_MT_edit_select, - TEXT_MT_edit_markers, - TEXT_MT_edit_to3d, - TEXT_MT_toolbox] - - def register(): - register = bpy.types.register - for cls in classes: - register(cls) + pass def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) + pass if __name__ == "__main__": register() |