From: Christian Heller Date: Wed, 16 Oct 2024 13:48:40 +0000 (+0200) Subject: browser.py: Update topbar design. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/static/templates?a=commitdiff_plain;h=9ec9a52f007056d95555c5f9f18d81bb280104a8;p=stable_plom browser.py: Update topbar design. --- diff --git a/browser.py b/browser.py index 92bd4c1..dd83eca 100755 --- a/browser.py +++ b/browser.py @@ -962,7 +962,7 @@ class MainWindow(Gtk.Window): """Image browser app top-level window.""" metadata: Gtk.TextBuffer prev_key: list - counter: Gtk.Label + topbar: Gtk.Label def __init__(self, app, **kwargs): super().__init__(**kwargs) @@ -970,9 +970,9 @@ class MainWindow(Gtk.Window): def init_navbar(): navbar = Gtk.Box(orientation=OR_H) - self.counter = Gtk.Label() - navbar.append(self.counter) _add_button(navbar, 'sidebar', lambda _: self.toggle_side_box()) + self.topbar = Gtk.Label() + navbar.append(self.topbar) return navbar def init_metadata_box(): @@ -1084,7 +1084,7 @@ class MainWindow(Gtk.Window): self.gallery.on_resize(self.get_width() - side_box_width) def update_metadata_on_gallery_selection(self): - """Update .metadata about individual file, .counter on its idx/total""" + """Update .metadata about individual file, .topbar also on idx/total""" self.metadata.set_text('') selected_item = self.gallery.selected_item if selected_item: @@ -1097,7 +1097,10 @@ class MainWindow(Gtk.Window): '\n'.join([title, bookmarked] + params_strs)) total = len([s for s in self.gallery.slots if isinstance(s.item, (DirItem, ImgItem))]) - self.counter.set_text(f' {self.gallery.selected_idx + 1} of {total} ') + n_selected = self.gallery.selected_idx + 1 + txt = f' {n_selected} of {total} – {selected_item.full_path}' + self.topbar.set_text(txt) + self.topbar.set_use_markup(True) def handle_keypress(self, keyval): """Handle keys if not in Gtk.Entry, return True if key handling done"""