From: Christian Heller Date: Thu, 24 Oct 2024 16:49:07 +0000 (+0200) Subject: Browser.py: In header bar, don't crash on empty gallery. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/balance?a=commitdiff_plain;h=eac8be259abb0f35b5d2e846fe76fe8497477fff;p=stable_plom Browser.py: In header bar, don't crash on empty gallery. --- diff --git a/browser.py b/browser.py index b775516..8db39e3 100755 --- a/browser.py +++ b/browser.py @@ -1125,7 +1125,9 @@ class MainWindow(Gtk.Window): """Update .metadata about individual file, .topbar also on idx/total""" self.metadata.set_text('') selected_item = self.gallery.selected_item + display_name = '(none)' if selected_item: + display_name = selected_item.full_path if isinstance(selected_item, ImgItem): params_strs = [f'{k}: {getattr(selected_item, k.lower())}' for k in GEN_PARAMS] @@ -1136,7 +1138,7 @@ class MainWindow(Gtk.Window): total = len([s for s in self.gallery.slots if isinstance(s.item, (DirItem, ImgItem))]) n_selected = self.gallery.selected_idx + 1 - txt = f' {n_selected} of {total} – {selected_item.full_path}' + txt = f' {n_selected} of {total} – {display_name}' self.topbar.set_text(txt) self.topbar.set_use_markup(True)