From 2f03f39e24053377dce108e45fde13ccd1e0ae22 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Tue, 24 Jun 2025 18:56:53 -0500 Subject: window can now handle no selected albums --- manager.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'manager.py') diff --git a/manager.py b/manager.py index 8f7ed80..918a0c4 100644 --- a/manager.py +++ b/manager.py @@ -1,6 +1,7 @@ import os import sys import signal +import copy from threading import Thread from OpenGL.GLUT import glutLeaveMainLoop @@ -49,10 +50,10 @@ class PixMan: signal.signal(signal.SIGINT, PixMan.handle_sigint) self.configfile = configfile - config = Config.load(self.configfile) if os.path.exists(self.configfile) else Config() + self.config = Config.load(self.configfile) if os.path.exists(self.configfile) else Config() self.init_web(host, port) - self.update_config(config, replace=True) + self.update_config(self.config, replace=True) def init_web(self, host, port): self.t_flask = Thread(target=self.app.run, kwargs={ "host": host, "port": port }) @@ -67,7 +68,7 @@ class PixMan: # Initialize texture list change_callback = lambda d: self.socketio.emit("seek", d) - album_keys = [ "38617851-6b57-44f1-b5f7-82577606afc4" ] + album_keys = [ ] self.texture_list = LazyCachingTextureList(album_keys, max_cache_items=self.config.max_cache_assets, change_callback=change_callback) # Begin downloading images @@ -79,6 +80,7 @@ class PixMan: self.display.main({}) # TODO glut args def update_config(self, config, replace=False): + oldconfig = copy.deepcopy(self.config) if replace: self.config = config else: @@ -90,6 +92,10 @@ class PixMan: self.display.update_config() + if oldconfig.album_list != self.config.album_list: + self.texture_list = LazyCachingTextureList(album_keys) + self.display.update_textures() + # If all goes well self.config.save(self.configfile) return True -- cgit v1.2.3