"""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)
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():
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:
'\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} – <b>{selected_item.full_path}</b>'
+ 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"""