From 71692e802fc50ad9dd76659d2868843e708dbd40 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 26 Jul 2011 07:39:00 +0000 Subject: py api: - added menu templates - move template menu into the header of the text editor (so users will find more easily) - updated mathutils examples, switching the order of multiplication. --- release/scripts/startup/bl_ui/space_text.py | 43 +++++++++++++++++------------ 1 file changed, 26 insertions(+), 17 deletions(-) (limited to '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 0fc8d937f66..582c9442a4a 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -16,7 +16,7 @@ # # ##### END GPL LICENSE BLOCK ##### -# +# import bpy @@ -36,10 +36,13 @@ class TEXT_HT_header(bpy.types.Header): 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") + sub.menu("TEXT_MT_templates") + if text and text.is_modified: row = layout.row() row.alert = True @@ -63,11 +66,13 @@ class TEXT_HT_header(bpy.types.Header): row = layout.row() if text.filepath: if text.is_dirty: - row.label(text="File: *%s (unsaved)" % text.filepath) + row.label(text="File: *%r (unsaved)" % text.filepath) else: - row.label(text="File: %s" % text.filepath) + row.label(text="File: %r" % text.filepath) else: - row.label(text="Text: External" if text.library else "Text: Internal") + row.label(text="Text: External" + if text.library + else "Text: Internal") class TEXT_PT_properties(bpy.types.Panel): @@ -150,8 +155,12 @@ class TEXT_MT_view(bpy.types.Menu): layout.separator() - layout.operator("text.move", text="Top of File").type = 'FILE_TOP' - layout.operator("text.move", text="Bottom of File").type = 'FILE_BOTTOM' + 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): @@ -185,19 +194,15 @@ class TEXT_MT_text(bpy.types.Menu): # XXX uiMenuItemO(head, 0, "text.refresh_pyconstraints"); #endif - layout.separator() - - layout.menu("TEXT_MT_templates") - class TEXT_MT_templates(bpy.types.Menu): - ''' - Creates the menu items by scanning scripts/templates - ''' - bl_label = "Script Templates" + bl_label = "Templates" def draw(self, context): - self.path_menu(bpy.utils.script_paths("templates"), "text.open", {"internal": True}) + self.path_menu(bpy.utils.script_paths("templates"), + "text.open", + {"internal": True}, + ) class TEXT_MT_edit_select(bpy.types.Menu): @@ -246,8 +251,12 @@ class TEXT_MT_edit_to3d(bpy.types.Menu): def draw(self, context): layout = self.layout - layout.operator("text.to_3d_object", text="One Object").split_lines = False - layout.operator("text.to_3d_object", text="One Object Per Line").split_lines = True + layout.operator("text.to_3d_object", + text="One Object", + ).split_lines = False + layout.operator("text.to_3d_object", + text="One Object Per Line", + ).split_lines = True class TEXT_MT_edit(bpy.types.Menu): -- cgit v1.2.3 From 9a250bea61340cb8b3625345df6560ba3e7b878f Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Tue, 26 Jul 2011 20:05:17 +0000 Subject: Fix part of [#28088] bad button spacing with layout engine for menu items. * Fixed a cut off text. * small cleanup --- release/scripts/startup/bl_ui/space_text.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to '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 582c9442a4a..b787fc5cf75 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -33,22 +33,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="") -- cgit v1.2.3