From 5e77a82629eb78851dc5ec5364bfb768f16820ea Mon Sep 17 00:00:00 2001 From: "dries.k" Date: Thu, 1 Sep 2022 21:39:24 +0200 Subject: [PATCH] do not read cache twice --- gotify_tray/gui/MainApplication.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gotify_tray/gui/MainApplication.py b/gotify_tray/gui/MainApplication.py index ce277f2..4d2db87 100644 --- a/gotify_tray/gui/MainApplication.py +++ b/gotify_tray/gui/MainApplication.py @@ -65,7 +65,6 @@ class MainApplication(QtWidgets.QApplication): settings.value("Server/client_token", type=str), ) - self.cache = Cache() self.downloader = Downloader() self.messages_model = MessagesModel() @@ -309,15 +308,14 @@ class MainApplication(QtWidgets.QApplication): return self.messages_model.clear() - + def image_popup_callback(self, link: str, pos: QtCore.QPoint): - if (filename := self.cache.lookup(link)) or (filename := self.downloader.get_filename(link)): # TODO: preload links + if filename := self.downloader.get_filename(link): self.image_popup = ImagePopup(filename, pos, link) self.image_popup.show() else: - # TODO logger.warning(f"Image {link} is not in the cache") - + def main_window_hidden_callback(self): if image_popup := getattr(self, "image_popup", None): image_popup.close()