if self._grid:
self._fixed_frame.remove(self._grid)
+ if self._col_headers_grid:
+ self._col_headers_frame.remove(self._col_headers_grid)
self.slots = []
self._grid = Gtk.Grid()
self._fixed_frame.put(self._grid, 0, 0)
sort_attrs += [(s_name, self.items_attrs[s_name]['incl'])]
self._per_row = len(sort_attrs[-1][1])
build_rows_by_attrs(sort_attrs, entries_filtered, [])
+ self._col_headers_grid = Gtk.Grid()
+ self._col_headers_frame.put(self._col_headers_grid, 0, 0)
+ self._col_headers_grid.attach(Gtk.Box(), 0, 0, 1, 1)
+ top_attr_name = sort_attrs[-1][0]
+ for i, val in enumerate(sort_attrs[-1][1]):
+ label = Gtk.Label(label=f'<b>{top_attr_name}</b>: {val}',
+ xalign=0,
+ ellipsize=Pango.EllipsizeMode.MIDDLE)
+ label.set_use_markup(True)
+ self._col_headers_grid.attach(label, i + 1, 0, 1, 1)
+
else:
dir_entries_filtered_sorted = sorted(
entries_filtered, key=cmp_to_key(self._sort_cmp))
i_vlabels += 1
max_slot_width = (vp_width - side_offset) // self._per_row
slot_size = min(vp_height, max_slot_width)
- if self._col_headers_grid:
- self._col_headers_frame.remove(self._col_headers_grid)
- self._col_headers_grid = None
if self._by_1st:
- self._col_headers_grid = Gtk.Grid()
- spacer_box = Gtk.Box()
- spacer_box.set_size_request(side_offset, -1)
- self._col_headers_grid.attach(spacer_box, 0, 0, 1, 1)
- self._col_headers_frame.put(self._col_headers_grid, 0, 0)
- attr_name = self._sort_order[0].name
- attr_values = self.items_attrs[attr_name]['incl']
- for i, val in enumerate(attr_values):
- label = Gtk.Label(label=f'<b>{attr_name}</b>: {val}', xalign=0,
- ellipsize=Pango.EllipsizeMode.MIDDLE)
- label.set_use_markup(True)
- label.set_size_request(slot_size, -1)
- self._col_headers_grid.attach(label, i + 1, 0, 1, 1)
+ i_widgets = 0
+ while True:
+ widget = self._col_headers_grid.get_child_at(i_widgets, 0)
+ if 0 == i_widgets:
+ widget.set_size_request(side_offset, -1)
+ elif isinstance(widget, Gtk.Label):
+ widget.set_size_request(slot_size, -1)
+ else:
+ break
+ i_widgets += 1
slot_size_sans_margin = slot_size - self._slot_margin
for idx, slot in enumerate(self.slots):
slot.ensure_slot_size(slot_size_sans_margin, self._slot_margin)