diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-20 18:36:38 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-20 18:42:08 +0300 |
commit | adfe68e2025b6d85312361a3d1b4d1397c1ce2a9 (patch) | |
tree | 22875c66ca2e851af3f805243d059a8572476a5e /release | |
parent | 8c60205bef314fe71df1116c76cd1ecf2e175580 (diff) |
UI: Replace big options button in file browser
The big options button in the lower left is now gone, it's replaced by a
smaller icon toggle button in the upper right.
That means I could also remove code for the region we had just for this
button.
I also added versioning code for the removal, to make sure the region is
removed cleanly when reading old files.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/space_filebrowser.py | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index 054ed93d6d2..3279271b5e8 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -328,36 +328,6 @@ class FILEBROWSER_PT_advanced_filter(Panel): col.prop(params, "filter_id") -class FILEBROWSER_PT_options_toggle(Panel): - bl_space_type = 'FILE_BROWSER' - bl_region_type = 'TOOLS' - bl_label = "Options Toggle" - bl_options = {'HIDE_HEADER'} - - @classmethod - def poll(cls, context): - sfile = context.space_data - return context.region.alignment == 'BOTTOM' and sfile.active_operator - - def is_option_region_visible(self, context): - for region in context.area.regions: - if region.type == 'TOOL_PROPS' and region.width <= 1: - return False - - return True - - def draw(self, context): - layout = self.layout - label = "Hide Options" if self.is_option_region_visible( - context) else "Options" - - layout.scale_x = 1.3 - layout.scale_y = 1.3 - - layout.operator("screen.region_toggle", - text=label).region_type = 'TOOL_PROPS' - - class FILEBROWSER_PT_directory_path(Panel): bl_space_type = 'FILE_BROWSER' bl_region_type = 'UI' @@ -372,6 +342,16 @@ class FILEBROWSER_PT_directory_path(Panel): return True + def is_option_region_visible(self, context, space): + if not space.active_operator: + return False + + for region in context.area.regions: + if region.type == 'TOOL_PROPS' and region.width <= 1: + return False + + return True + def draw(self, context): layout = self.layout space = context.space_data @@ -414,6 +394,14 @@ class FILEBROWSER_PT_directory_path(Panel): icon_only=True, ) + if space.active_operator: + row.operator( + "screen.region_toggle", + text="", + icon='PREFERENCES', + depress=self.is_option_region_visible(context, space) + ).region_type = 'TOOL_PROPS' + class FILEBROWSER_MT_view(Menu): bl_label = "View" @@ -500,7 +488,6 @@ classes = ( FILEBROWSER_PT_bookmarks_recents, FILEBROWSER_PT_advanced_filter, FILEBROWSER_PT_directory_path, - FILEBROWSER_PT_options_toggle, FILEBROWSER_MT_view, FILEBROWSER_MT_select, FILEBROWSER_MT_context_menu, |