diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-15 14:05:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-15 14:16:28 +0300 |
commit | 4965af1b7aa60466f6f8842a6f77a0d9b2cb72ac (patch) | |
tree | 9b6adf1fef11552ae69e5d8557fa60e5bc7f8c79 /release/scripts/startup/bl_ui/space_topbar.py | |
parent | 0819013eb45532e2ac26c725d09a4c74478e85d7 (diff) |
UI: add 'App' menu besides the 'File' menu
This uses the Blender icon that previously activated the splash.
Menu items which apply to the application are located here:
startup file, app templates & preferences.
Diffstat (limited to 'release/scripts/startup/bl_ui/space_topbar.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_topbar.py | 71 |
1 files changed, 41 insertions, 30 deletions
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 509c5bae355..22fc099fca2 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -38,7 +38,7 @@ class TOPBAR_HT_upper_bar(Header): window = context.window screen = context.screen - layout.operator("wm.splash", text="", icon='BLENDER', emboss=False) + layout.menu("TOPBAR_MT_app", text="", icon='BLENDER') TOPBAR_MT_editor_menus.draw_collapsible(context, layout) @@ -167,32 +167,17 @@ class TOPBAR_MT_editor_menus(Menu): layout.menu("TOPBAR_MT_help") -class TOPBAR_MT_file(Menu): - bl_label = "File" +class TOPBAR_MT_app(Menu): + bl_label = "Application" def draw(self, context): layout = self.layout prefs = context.preferences - layout.operator_context = 'INVOKE_AREA' - layout.menu("TOPBAR_MT_file_new", text="New", icon='FILE_NEW') - layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER') - layout.menu("TOPBAR_MT_file_open_recent") - layout.operator("wm.revert_mainfile") - layout.operator("wm.recover_last_session") - layout.operator("wm.recover_auto_save", text="Recover Auto Save...") + layout.operator("wm.splash", icon='BLENDER') layout.separator() - layout.operator_context = 'EXEC_AREA' if context.blend_data.is_saved else 'INVOKE_AREA' - layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK') - - layout.operator_context = 'INVOKE_AREA' - layout.operator("wm.save_as_mainfile", text="Save As...") - layout.operator_context = 'INVOKE_AREA' - layout.operator("wm.save_as_mainfile", text="Save Copy...").copy = True - - layout.separator() layout.operator_context = 'INVOKE_AREA' if any(bpy.utils.app_template_paths()): @@ -223,6 +208,42 @@ class TOPBAR_MT_file(Menu): layout.separator() + layout.operator("screen.userpref_show", text="Preferences...", icon='PREFERENCES') + + layout.separator() + + layout.operator_context = 'EXEC_AREA' + if bpy.data.is_dirty: + layout.operator_context = 'INVOKE_SCREEN' # quit dialog + layout.operator("wm.quit_blender", text="Quit", icon='QUIT') + + +class TOPBAR_MT_file(Menu): + bl_label = "File" + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'INVOKE_AREA' + layout.menu("TOPBAR_MT_file_new", text="New", icon='FILE_NEW') + layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER') + layout.menu("TOPBAR_MT_file_open_recent") + layout.operator("wm.revert_mainfile") + layout.operator("wm.recover_last_session") + layout.operator("wm.recover_auto_save", text="Recover Auto Save...") + + layout.separator() + + layout.operator_context = 'EXEC_AREA' if context.blend_data.is_saved else 'INVOKE_AREA' + layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK') + + layout.operator_context = 'INVOKE_AREA' + layout.operator("wm.save_as_mainfile", text="Save As...") + layout.operator_context = 'INVOKE_AREA' + layout.operator("wm.save_as_mainfile", text="Save Copy...").copy = True + + layout.separator() + layout.operator_context = 'INVOKE_AREA' layout.operator("wm.link", text="Link...", icon='LINK_BLEND') layout.operator("wm.append", text="Append...", icon='APPEND_BLEND') @@ -237,13 +258,6 @@ class TOPBAR_MT_file(Menu): layout.menu("TOPBAR_MT_file_external_data") - layout.separator() - - layout.operator_context = 'EXEC_AREA' - if bpy.data.is_dirty: - layout.operator_context = 'INVOKE_SCREEN' # quit dialog - layout.operator("wm.quit_blender", text="Quit", icon='QUIT') - class TOPBAR_MT_file_new(Menu): bl_label = "New File" @@ -448,10 +462,6 @@ class TOPBAR_MT_edit(Menu): tool_settings = context.tool_settings layout.prop(tool_settings, "lock_object_mode") - layout.separator() - - layout.operator("screen.userpref_show", text="Preferences...", icon='PREFERENCES') - class TOPBAR_MT_window(Menu): bl_label = "Window" @@ -713,6 +723,7 @@ classes = ( TOPBAR_MT_file_context_menu, TOPBAR_MT_workspace_menu, TOPBAR_MT_editor_menus, + TOPBAR_MT_app, TOPBAR_MT_file, TOPBAR_MT_file_new, TOPBAR_MT_templates_more, |