do not read cache twice

This commit is contained in:
dries.k
2022-09-01 21:39:24 +02:00
parent 5fdfef2734
commit 5e77a82629

View File

@@ -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()
@@ -311,11 +310,10 @@ class MainApplication(QtWidgets.QApplication):
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):