[Bf-blender-cvs] [df79abdae86] filebrowser_redesign: Split Filter popover into Filter and Display

William Reynish noreply at git.blender.org
Sun Jul 28 09:30:39 CEST 2019


Commit: df79abdae86f3edc5eba0b7a38b73baf061d3fb4
Author: William Reynish
Date:   Sun Jul 28 09:30:37 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rBdf79abdae86f3edc5eba0b7a38b73baf061d3fb4

Split Filter popover into Filter and Display

Filter contains options about *what* to show
Display contains options about *how* to show it

I used prop_with_popover for the Filter popover too to force it to show the disclosure triangle. Ideally this would not be needed.

===================================================================

M	release/scripts/startup/bl_ui/space_filebrowser.py
M	source/blender/makesrna/intern/rna_space.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index 134626a4b76..af489c724cc 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -82,10 +82,10 @@ class FILEBROWSER_HT_header(Header):
             row.prop(params, "filter_search", text="", icon='VIEWZOOM')
 
 
-class FILEBROWSER_PT_filter(Panel):
+class FILEBROWSER_PT_display(Panel):
     bl_space_type = 'FILE_BROWSER'
     bl_region_type = 'UI'
-    bl_label = "Filter"
+    bl_label = "Display"
     bl_options = {'HIDDEN'}
 
     @classmethod
@@ -100,25 +100,45 @@ class FILEBROWSER_PT_filter(Panel):
         params = space.params
         is_lib_browser = params.use_library_browsing
 
-        layout.label(text="Display Type:")
-        layout.prop(params, "display_type", expand=True, text="")
+        layout.label(text="Display As")
+        layout.column().prop(params, "display_type", expand=True)
 
-        layout.label(text="Sort By:")
-        layout.prop(params, "sort_method", expand=True, text="")
-        layout.prop(params, "use_sort_invert")
+        layout.use_property_split = True
+        layout.use_property_decorate = False  # No animation.
 
-        layout.separator()
+        if params.display_type == 'THUMBNAIL':
+            layout.prop(params, "display_size", text="Size")
+        else:
+            layout.prop(params, "show_details_size", text="Size")
+            layout.prop(params, "show_details_datetime", text="Date")
 
-        layout.prop(params, "show_hidden")
+        layout.prop(params, "recursion_level", text="Recursions")
 
+        layout.use_property_split = False
         layout.separator()
 
-        layout.label(text="Show Details:")
-        row = layout.row(align=True)
-        row.prop(params, "show_details_size", text="Size")
-        row.prop(params, "show_details_datetime", text="Date")
+        layout.label(text="Sort By")
+        layout.column().prop(params, "sort_method", expand=True)
+        layout.prop(params, "use_sort_invert")
 
-        layout.separator()
+
+class FILEBROWSER_PT_filter(Panel):
+    bl_space_type = 'FILE_BROWSER'
+    bl_region_type = 'UI'
+    bl_label = "Filter"
+    bl_options = {'HIDDEN'}
+
+    @classmethod
+    def poll(cls, context):
+        # can be None when save/reload with a file selector open
+        return context.space_data.params is not None
+
+    def draw(self, context):
+        layout = self.layout
+
+        space = context.space_data
+        params = space.params
+        is_lib_browser = params.use_library_browsing
 
         row = layout.row(align=True)
         row.prop(params, "use_filter", text="", toggle=0)
@@ -172,14 +192,7 @@ class FILEBROWSER_PT_filter(Panel):
 
                 col.separator()
 
-        col.prop(params, "filter_search", text="", icon='VIEWZOOM')
-
-        layout.separator()
-
-        layout.label(text="Display Size:")
-        layout.prop(params, "display_size", text="")
-        layout.label(text="Recursion Level:")
-        layout.prop(params, "recursion_level", text="")
+        layout.prop(params, "show_hidden")
 
 
 class FILEBROWSER_UL_dir(UIList):
@@ -364,21 +377,36 @@ class FILEBROWSER_PT_directory_path(Panel):
         subrow.operator("file.next", text="", icon='FORWARD')
         subrow.operator("file.parent", text="", icon='FILE_PARENT')
         subrow.operator("file.refresh", text="", icon='FILE_REFRESH')
+
+        row.operator("file.directory_new", icon='NEWFOLDER', text="")
+
         # TODO proper directory input text field
 
         subrow = row.row()
         subrow.prop(params, "directory", text="")
+        
+        subrow = row.row()
+        subrow.scale_x = 0.5
+        subrow.prop(params, "filter_search", text="", icon='VIEWZOOM')
 
         # TODO down triangle only created for UI_LAYOUT_HEADER
-        if self.is_header_visible(context) is False:
-            row.popover(
-                panel="FILEBROWSER_PT_filter",
-                text="",
-                icon='FILTER',
-            )
 
-        subrow = row.row(align=True)
-        subrow.operator("file.directory_new", icon='NEWFOLDER', text="")
+        row.prop_with_popover(
+            params,
+            "display_type",
+            panel="FILEBROWSER_PT_display",
+            text="",
+            icon_only=True,
+        )
+
+        row.prop_with_popover(
+            params,
+            "display_type",
+            panel="FILEBROWSER_PT_filter",
+            text="",
+            icon='FILTER',
+            icon_only=True,
+        )
 
 
 class FILEBROWSER_PT_file_operation(Panel):
@@ -468,6 +496,7 @@ class FILEBROWSER_MT_context_menu(Menu):
 
 classes = (
     FILEBROWSER_HT_header,
+    FILEBROWSER_PT_display,
     FILEBROWSER_PT_filter,
     FILEBROWSER_UL_dir,
     FILEBROWSER_PT_bookmarks_volumes,
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 898c3d107fe..67705beb419 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -418,19 +418,19 @@ const EnumPropertyItem rna_enum_file_sort_items[] = {
     {FILE_SORT_ALPHA,
      "FILE_SORT_ALPHA",
      ICON_SORTALPHA,
-     "Sort alphabetically",
+     "Alphabet",
      "Sort the file list alphabetically"},
     {FILE_SORT_EXTENSION,
      "FILE_SORT_EXTENSION",
      ICON_SORTBYEXT,
-     "Sort by extension",
+     "Kind",
      "Sort the file list by extension/type"},
     {FILE_SORT_TIME,
      "FILE_SORT_TIME",
      ICON_SORTTIME,
-     "Sort by time",
+     "Date",
      "Sort files by modification time"},
-    {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"},
+    {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Size", "Sort files by size"},
     {0, NULL, 0, NULL, NULL},
 };
 
@@ -5339,7 +5339,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
   prop = RNA_def_property(srna, "use_sort_invert", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_SORT_INVERT);
   RNA_def_property_ui_text(
-      prop, "Sort Inverted", "Sort items descending, from highest value to lowest");
+      prop, "Reverse Sorting", "Sort items descending, from highest value to lowest");
   RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
 
   prop = RNA_def_property(srna, "use_filter_image", PROP_BOOLEAN, PROP_NONE);



More information about the Bf-blender-cvs mailing list