diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-01-27 11:38:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-01-27 11:42:11 +0400 |
commit | a71f072f9ccaae043069df1cbf95c169a60e494e (patch) | |
tree | 6e24b45d6dbeff8f6a3774373aeb0171a37fd55a /release/scripts/startup/bl_ui/space_dopesheet.py | |
parent | 8f2eec5a15b5f26bfbe73382677add202adc89a9 (diff) |
UI: Replace +/- menus with collapsible ones
Patch D160, by Scott Petrovic with own modifications.
Diffstat (limited to 'release/scripts/startup/bl_ui/space_dopesheet.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_dopesheet.py | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 9d317033bb9..269c960ee7e 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -107,20 +107,7 @@ class DOPESHEET_HT_header(Header): row = layout.row(align=True) row.template_header() - if context.area.show_menus: - row.menu("DOPESHEET_MT_view") - row.menu("DOPESHEET_MT_select") - row.menu("DOPESHEET_MT_marker") - - if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action is not None): - row.menu("DOPESHEET_MT_channel") - elif st.mode == 'GPENCIL': - row.menu("DOPESHEET_MT_gpencil_channel") - - if st.mode != 'GPENCIL': - row.menu("DOPESHEET_MT_key") - else: - row.menu("DOPESHEET_MT_gpencil_frame") + DOPESHEET_MT_editor_menus.draw_collapsible(context, layout) layout.prop(st, "mode", text="") layout.prop(st.dopesheet, "show_summary", text="Summary") @@ -144,6 +131,32 @@ class DOPESHEET_HT_header(Header): row.operator("action.paste", text="", icon='PASTEDOWN') +class DOPESHEET_MT_editor_menus(Menu): + bl_idname = "DOPESHEET_MT_editor_menus" + bl_label = "" + + def draw(self, context): + self.draw_menus(self.layout, context) + + @staticmethod + def draw_menus(layout, context): + st = context.space_data + + layout.menu("DOPESHEET_MT_view") + layout.menu("DOPESHEET_MT_select") + layout.menu("DOPESHEET_MT_marker") + + if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action is not None): + layout.menu("DOPESHEET_MT_channel") + elif st.mode == 'GPENCIL': + layout.menu("DOPESHEET_MT_gpencil_channel") + + if st.mode != 'GPENCIL': + layout.menu("DOPESHEET_MT_key") + else: + layout.menu("DOPESHEET_MT_gpencil_frame") + + class DOPESHEET_MT_view(Menu): bl_label = "View" |