self.items_attrs_filtered = {}
self._fixed_frame = Gtk.Fixed(hexpand=True, vexpand=True)
- self.scroller = Gtk.ScrolledWindow(propagate_natural_height=True)
- self.scroller.get_vadjustment().connect(
+ scroller = Gtk.ScrolledWindow(propagate_natural_height=True)
+ self.frame = Gtk.Box(orientation=OR_V)
+ self._col_headers_frame = Gtk.Fixed()
+ self._col_headers_grid = None
+ self.frame.append(self._col_headers_frame)
+ self.frame.append(scroller)
+ scroller.get_vadjustment().connect(
'value-changed', lambda _: self._update_view(refocus=False))
# We want our viewport at always maximum possible size (so we can
# safely calculate what's in it and what not), even if the gallery
# would be smaller. Therefore we frame the gallery in an expanding
# Fixed, to stretch out the viewport even if the gallery is small.
- self.scroller.set_child(self._fixed_frame)
+ scroller.set_child(self._fixed_frame)
self._viewport = self._fixed_frame.get_parent()
self._should_update_view = True
slot_bottom = slot_top + slot_size
in_vp = (slot_bottom >= vp_top and slot_top <= vp_bottom)
slot.update_widget(slot_size, self._slot_margin, in_vp)
+ if self._col_headers_grid:
+ self._col_headers_frame.remove(self._col_headers_grid)
+ self._col_headers_grid = None
+ if self.per_row_by_first_sorter:
+ self._col_headers_grid = Gtk.Grid()
+ self._col_headers_frame.put(self._col_headers_grid, 0, 0)
+ attr_name = self._sort_order[0].name
+ attr_values = sorted(self.items_attrs_filtered[attr_name])
+ for i, val in enumerate(attr_values):
+ label = Gtk.Label(label=str(val))
+ label.set_size_request(slot_size, -1)
+ self._col_headers_grid.attach(label, i, 0, 1, 1)
self._should_update_view = False
if (not refocus) or (not self.slots):
return
viewer = Gtk.Box(orientation=OR_V)
self.navbar = init_navbar()
viewer.append(self.navbar)
- viewer.append(self.gallery.scroller)
+ viewer.append(self.gallery.frame)
self.side_box = Gtk.Box(orientation=OR_V)
self.sort_box = init_sorter_and_filterer()
self.side_box.append(self.sort_box)