From a71f072f9ccaae043069df1cbf95c169a60e494e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 27 Jan 2014 18:38:53 +1100 Subject: UI: Replace +/- menus with collapsible ones Patch D160, by Scott Petrovic with own modifications. --- release/scripts/startup/bl_ui/space_info.py | 35 ++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'release/scripts/startup/bl_ui/space_info.py') diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index 6457075c9e2..769cc53d953 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -34,15 +34,7 @@ class INFO_HT_header(Header): row = layout.row(align=True) row.template_header() - if context.area.show_menus: - sub = row.row(align=True) - sub.menu("INFO_MT_file") - if rd.use_game_engine: - sub.menu("INFO_MT_game") - else: - sub.menu("INFO_MT_render") - sub.menu("INFO_MT_window") - sub.menu("INFO_MT_help") + INFO_MT_editor_menus.draw_collapsible(context, layout) if window.screen.show_fullscreen: layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous") @@ -79,6 +71,29 @@ class INFO_HT_header(Header): row.label(text=scene.statistics(), translate=False) +class INFO_MT_editor_menus(Menu): + bl_idname = "INFO_MT_editor_menus" + bl_label = "" + + def draw(self, context): + self.draw_menus(self.layout, context) + + @staticmethod + def draw_menus(layout, context): + scene = context.scene + rd = scene.render + + layout.menu("INFO_MT_file") + + if rd.use_game_engine: + layout.menu("INFO_MT_game") + else: + layout.menu("INFO_MT_render") + + layout.menu("INFO_MT_window") + layout.menu("INFO_MT_help") + + class INFO_MT_file(Menu): bl_label = "File" @@ -132,7 +147,7 @@ class INFO_MT_file(Menu): layout.operator_context = 'EXEC_AREA' if bpy.data.is_dirty and context.user_preferences.view.use_quit_dialog: - layout.operator_context = 'INVOKE_SCREEN' # quit dialog + layout.operator_context = 'INVOKE_SCREEN' # quit dialog layout.operator("wm.quit_blender", text="Quit", icon='QUIT') -- cgit v1.2.3