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()
|
||||||
@@ -309,15 +308,14 @@ class MainApplication(QtWidgets.QApplication):
|
|||||||
return
|
return
|
||||||
|
|
||||||
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):
|
||||||
if image_popup := getattr(self, "image_popup", None):
|
if image_popup := getattr(self, "image_popup", None):
|
||||||
image_popup.close()
|
image_popup.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user