From: Christian Heller Date: Sat, 24 Aug 2024 03:56:10 +0000 (+0200) Subject: Improve Browser layout. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/balance?a=commitdiff_plain;h=1fafd10e012bc3bd6646a2e159dd72df5820fb31;p=stable_plom Improve Browser layout. --- diff --git a/browser.py b/browser.py index 26b67a4..ac1afc7 100755 --- a/browser.py +++ b/browser.py @@ -83,8 +83,13 @@ class Window(Gtk.ApplicationWindow): self.list_store = Gio.ListStore(item_type=FileItem) self.selection = Gtk.SingleSelection.new(self.list_store) factory = Gtk.SignalListItemFactory() + factory.connect('setup', lambda _, i: i.set_child(Gtk.Label(xalign=0))) + factory.connect('bind', + lambda _, i: i.props.child.set_text(i.props.item.name)) self.selector = Gtk.ListView(model=self.selection, factory=factory) - dir_box.append(self.selector) + scrolled = Gtk.ScrolledWindow(child=self.selector, vexpand=True, + propagate_natural_width=True) + dir_box.append(scrolled) box_outer = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) box_outer.append(dir_box) @@ -99,10 +104,6 @@ class Window(Gtk.ApplicationWindow): self.max_index = 0 self.item = None self.selection.connect('selection-changed', self.update_selected) - factory.connect('setup', - lambda _, i: i.set_child(Gtk.Label())) - factory.connect('bind', - lambda _, i: i.props.child.set_text(i.props.item.name)) query_attrs = 'standard::name,standard::content-type,time::*' enumerator = self.dir.enumerate_children( query_attrs, Gio.FileQueryInfoFlags.NONE, None) @@ -140,6 +141,7 @@ class Window(Gtk.ApplicationWindow): self.metadata.props.label = '\n'.join([self.item.full_path] + params_strs) pic = Gtk.Picture.new_for_filename(self.item.name) + pic.props.halign = Gtk.Align.START self.viewer.append(pic) else: self.metadata.props.label = None