From: Christian Heller Date: Wed, 28 Aug 2024 02:44:22 +0000 (+0200) Subject: Browser: Starting some fbox experiments … X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/day?a=commitdiff_plain;h=1807c8adac23c568ecf03fc7bc64e24aa90a4506;p=stable_plom Browser: Starting some fbox experiments … --- diff --git a/browser.py b/browser.py index 67e41cb..5a5ce3f 100755 --- a/browser.py +++ b/browser.py @@ -5,9 +5,11 @@ from operator import attrgetter from exiftool import ExifToolHelper # type: ignore import gi # type: ignore gi.require_version('Gtk', '4.0') +gi.require_version('Gdk', '4.0') +gi.require_version('GdkPixbuf', '2.0') gi.require_version('Gio', '2.0') # pylint: disable=wrong-import-position -from gi.repository import Gtk, Gio, GObject # type: ignore # noqa: E402 +from gi.repository import Gdk, GdkPixbuf, Gtk, Gio, GObject # type: ignore # noqa: E402 # pylint: disable=no-name-in-module from stable.gen_params import (GenParams, # noqa: E402 GEN_PARAMS, GEN_PARAMS_STR) # noqa: E402 @@ -93,8 +95,14 @@ class Window(Gtk.ApplicationWindow): add_button('reload', lambda _: self.reload_dir(), box_files_selection) self.box_sort_order = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) box_files_selection.append(self.box_sort_order) + + # self.fbox = Gtk.FlowBox(orientation=Gtk.Orientation.VERTICAL) + # self.fbox.set_max_children_per_line(3) + # self.fbox.set_selection_mode(Gtk.SelectionMode.NONE) + self.viewer = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.viewer.append(box_files_selection) + # self.viewer.append(self.fbox) self.viewer.append(self.metadata) self.viewer.append(self.label_nothing_to_show) @@ -143,6 +151,7 @@ class Window(Gtk.ApplicationWindow): self.dir_box.props.visible = not self.dir_box.props.visible def sort(self): + # self.fbox.remove_all() self.list_store.remove_all() for key in self.sort_order: self.unsorted_files.sort(key=attrgetter(key)) @@ -158,6 +167,13 @@ class Window(Gtk.ApplicationWindow): self.selection.set_selected(pos) return self.update_selected() + # for file_item in self.unsorted_files: + # pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(file_item.full_path, 128, 128, True) + # img = Gtk.Image() + # img.set_from_pixbuf(pixbuf) + # box = Gtk.Box() + # box.img = img + # self.fbox.append(box) def update_selected(self, *_args): if isinstance(self.selection.props.selected_item, ImgItem):