From b7c4aa1d1911f11d6d2e286ee8f7c8760c49a5ae Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 26 Oct 2024 15:25:06 +0200 Subject: [PATCH] Browser: In by_1st view, label *all* active non-1st sorters to the left. --- browser.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/browser.py b/browser.py index 8db39e3..939dc1a 100755 --- a/browser.py +++ b/browser.py @@ -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)) -- 2.30.2