self.img_dir_absolute = abspath(opts.directory)
self.bookmarks_db = JsonDb(BOOKMARKS_PATH)
self.cache_db = JsonDb(CACHE_PATH)
+
sort_suggestion = opts.sort_order.split(',')
names = [p.lower() for p in GEN_PARAMS] + ['bookmarked']
self.sort_order = []
self.selected_idx = 0
self.slots: list[GallerySlot] = []
- self._grid = None
+ self._grid = Gtk.Grid()
self._force_width, self._force_height = 0, 0
scroller = Gtk.ScrolledWindow(propagate_natural_height=True)
self._col_headers_frame = Gtk.Fixed()
- self._col_headers_grid = None
+ self._col_headers_grid = Gtk.Grid()
self.frame = Gtk.Box(orientation=OR_V)
self.frame.append(self._col_headers_frame)
self.frame.append(scroller)
for i, attr in enumerate(ancestors):
vlabel = VerticalLabel(f'<b>{attr[0]}</b>: {attr[1]}',
self._slots_geometry)
- assert self._grid is not None
self._grid.attach(vlabel, i, i_row_ref[0], 1, 1)
row: list[Optional[GalleryItem]]
row = [None] * len(attr_values)
self._slots_geometry)
self.slots += [slot]
i_slot_ref[0] += 1
- assert self._grid is not None
self._grid.attach(slot, i_col + len(ancestors),
i_row_ref[0], 1, 1)
i_row_ref[0] += 1
build_rows_by_attrs(remaining[1:], items_of_attr_value,
ancestors + [(attr_name, attr_value)])
- if self._grid:
+ if self._grid.get_parent():
self._fixed_frame.remove(self._grid)
- if self._col_headers_grid:
+ self._grid = Gtk.Grid()
+ if self._col_headers_grid.get_parent():
self._col_headers_frame.remove(self._col_headers_grid)
- self._col_headers_grid = None
+ self._col_headers_grid = Gtk.Grid()
self.slots = []
- self._grid = Gtk.Grid()
self._fixed_frame.put(self._grid, 0, 0)
if self._by_1st:
self._show_dirs = False
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)
- assert self._col_headers_grid is not None
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]):
i_row += 1
slot = GallerySlot(item, self._slots_geometry,
self._on_hit_item)
- assert self._grid is not None
self._grid.attach(slot, i_col, i_row, 1, 1)
self.slots += [slot]
i_col += 1
side_offset, i_vlabels = 0, 0
if self._by_1st:
while True:
- assert self._grid is not None
widget = self._grid.get_child_at(i_vlabels, 0)
if isinstance(widget, VerticalLabel):
side_offset += widget.width