do not read cache twice
This commit is contained in:
@@ -65,7 +65,6 @@ class MainApplication(QtWidgets.QApplication):
|
|||||||
settings.value("Server/client_token", type=str),
|
settings.value("Server/client_token", type=str),
|
||||||
)
|
)
|
||||||
|
|
||||||
self.cache = Cache()
|
|
||||||
self.downloader = Downloader()
|
self.downloader = Downloader()
|
||||||
|
|
||||||
self.messages_model = MessagesModel()
|
self.messages_model = MessagesModel()
|
||||||
@@ -311,11 +310,10 @@ class MainApplication(QtWidgets.QApplication):
|
|||||||
self.messages_model.clear()
|
self.messages_model.clear()
|
||||||
|
|
||||||
def image_popup_callback(self, link: str, pos: QtCore.QPoint):
|
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 = ImagePopup(filename, pos, link)
|
||||||
self.image_popup.show()
|
self.image_popup.show()
|
||||||
else:
|
else:
|
||||||
# TODO
|
|
||||||
logger.warning(f"Image {link} is not in the cache")
|
logger.warning(f"Image {link} is not in the cache")
|
||||||
|
|
||||||
def main_window_hidden_callback(self):
|
def main_window_hidden_callback(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user