home · contact · privacy
Browser: In by_1st view, label *all* active non-1st sorters to the left.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 26 Oct 2024 13:25:06 +0000 (15:25 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 26 Oct 2024 13:25:06 +0000 (15:25 +0200)
browser.py

index 8db39e30a774b12c667f5c3e929d28cbe8133458..939dc1a53e5675afde81f76cf285aa9a00a5ef8d 100755 (executable)
@@ -792,13 +792,15 @@ class Gallery:
 
             def build_rows_by_attrs(remaining_attrs,
                                     items_of_parent_attr_value,
-                                    parent_attr_value=None):
+                                    parent_attrs_values):
                 if not items_of_parent_attr_value:
                     return
                 attr_name, attr_values = remaining_attrs[0]
                 if 1 == len(remaining_attrs):
-                    self._grid.attach(VerticalLabel(str(parent_attr_value)),
-                                      0, i_row_ref[0], 1, 1)
+                    v_offset = len(parent_attrs_values)
+                    for i, val in enumerate(parent_attrs_values):
+                        self._grid.attach(VerticalLabel(str(val)),
+                                          i, i_row_ref[0], 1, 1)
                     row = [None] * len(attr_values)
                     for item in items_of_parent_attr_value:
                         val = getattr(item, attr_name)
@@ -814,7 +816,8 @@ class Gallery:
                             slot = GallerySlot(GalleryItem('', ''))  # dummy
                         self.slots += [slot]
                         i_slot_ref[0] += 1
-                        self._grid.attach(slot, i_col+1, i_row_ref[0], 1, 1)
+                        self._grid.attach(slot, i_col + v_offset,
+                                          i_row_ref[0], 1, 1)
                     i_row_ref[0] += 1
                     return
                 for attr_value in attr_values:
@@ -823,7 +826,7 @@ class Gallery:
                             if attr_value == getattr(x, attr_name)]
                     build_rows_by_attrs(remaining_attrs[1:],
                                         items_of_attr_value,
-                                        attr_value)
+                                        parent_attrs_values + [attr_value])
 
             if self._grid:
                 self._fixed_frame.remove(self._grid)
@@ -838,7 +841,7 @@ class Gallery:
                     if len(vals) > 1:
                         sort_attrs += [(sorter.name, vals)]
                 self._per_row = len(sort_attrs[-1][1])
-                build_rows_by_attrs(sort_attrs, entries_filtered)
+                build_rows_by_attrs(sort_attrs, entries_filtered, [])
             else:
                 dir_entries_filtered_sorted = sorted(
                         entries_filtered, key=cmp_to_key(self._sort_cmp))