UI: Expose important settings from file browser popovers

We have established a convention of exposing the most important
settings from popovers, then aligning a popover to control more
detailed settings.

The file browser has powerful display / filtering settings, but
they're hidden in popovers at the moment, so it's sometimes a pain
to use them. The "display as" options are now exposed to the left of
the display settings popover, and the "filter" toggle is exposed to
the left of the filter settings popover. This convention is familiar
and intuitive for users and makes interaction faster.

Note that the "show hidden" item in the filter popover still has an
effect if filtering is disabled.

This commit also:
 - Removes the icons in the "Sort By" enum
 - Uses property split for the "Sort By" enum
 - Very slightly increases the default width of the file browser
   window to make room for the new buttons.

Differential Revision: https://developer.blender.org/D8719
This commit is contained in:
Hans Goudey 2020-09-03 10:02:09 -05:00
parent eb82b3947e
commit c8e5924cbb
3 changed files with 17 additions and 37 deletions

View File

@ -218,7 +218,7 @@ const UserDef U_default = {
.flag = FILE_HIDE_DOT,
.filter_id = FILTER_ID_ALL,
.temp_win_sizex = 1020,
.temp_win_sizex = 1060,
.temp_win_sizey = 600,
},

View File

@ -44,7 +44,8 @@ class FILEBROWSER_HT_header(Header):
class FILEBROWSER_PT_display(Panel):
bl_space_type = 'FILE_BROWSER'
bl_region_type = 'HEADER'
bl_label = "Display"
bl_label = "Display Settings" # Shows as tooltip in popover
bl_ui_units_x = 10
@classmethod
def poll(cls, context):
@ -57,9 +58,6 @@ class FILEBROWSER_PT_display(Panel):
space = context.space_data
params = space.params
layout.label(text="Display as")
layout.column().prop(params, "display_type", expand=True)
layout.use_property_split = True
layout.use_property_decorate = False # No animation.
@ -72,18 +70,15 @@ class FILEBROWSER_PT_display(Panel):
layout.prop(params, "recursion_level", text="Recursions")
layout.use_property_split = False
layout.separator()
layout.label(text="Sort by")
layout.column().prop(params, "sort_method", expand=True)
layout.column().prop(params, "sort_method", text="Sort By", expand=True)
layout.prop(params, "use_sort_invert")
class FILEBROWSER_PT_filter(Panel):
bl_space_type = 'FILE_BROWSER'
bl_region_type = 'HEADER'
bl_label = "Filter"
bl_label = "Filter Settings" # Shows as tooltip in popover
bl_ui_units_x = 8
@classmethod
def poll(cls, context):
@ -97,8 +92,6 @@ class FILEBROWSER_PT_filter(Panel):
params = space.params
is_lib_browser = params.use_library_browsing
layout.prop(params, "use_filter", text="Filter", toggle=False)
col = layout.column()
col.active = params.use_filter
@ -383,22 +376,13 @@ class FILEBROWSER_PT_directory_path(Panel):
subsubrow.scale_x = 0.6
subsubrow.prop(params, "filter_search", text="", icon='VIEWZOOM')
# Uses prop_with_popover() as popover() only adds the triangle icon in headers.
subrow.prop_with_popover(
params,
"display_type",
panel="FILEBROWSER_PT_display",
text="",
icon_only=True,
)
subrow.prop_with_popover(
params,
"display_type",
panel="FILEBROWSER_PT_filter",
text="",
icon='FILTER',
icon_only=True,
)
subsubrow = subrow.row(align=True)
subsubrow.prop(params, "display_type", expand=True, icon_only=True)
subsubrow.popover("FILEBROWSER_PT_display", text="")
subsubrow = subrow.row(align=True)
subsubrow.prop(params, "use_filter", toggle=True, icon='FILTER', icon_only=True)
subsubrow.popover("FILEBROWSER_PT_filter", text="")
if space.active_operator:
subrow.operator(

View File

@ -464,22 +464,18 @@ static const EnumPropertyItem fileselectparams_recursion_level_items[] = {
};
const EnumPropertyItem rna_enum_file_sort_items[] = {
{FILE_SORT_ALPHA,
"FILE_SORT_ALPHA",
ICON_SORTALPHA,
"Name",
"Sort the file list alphabetically"},
{FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_NONE, "Name", "Sort the file list alphabetically"},
{FILE_SORT_EXTENSION,
"FILE_SORT_EXTENSION",
ICON_SORTBYEXT,
ICON_NONE,
"Extension",
"Sort the file list by extension/type"},
{FILE_SORT_TIME,
"FILE_SORT_TIME",
ICON_SORTTIME,
ICON_NONE,
"Modified Date",
"Sort files by modification time"},
{FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Size", "Sort files by size"},
{FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_NONE, "Size", "Sort files by size"},
{0, NULL, 0, NULL, NULL},
};