From 39738b84e9164b0f2d01f22440548c4393160013 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sat, 6 Dec 2025 17:36:41 -0600 Subject: port to pygame --- manager.py | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'manager.py') diff --git a/manager.py b/manager.py index 275e6b2..363aa2f 100644 --- a/manager.py +++ b/manager.py @@ -1,27 +1,14 @@ import os import sys -import signal import copy from threading import Thread from pathlib import Path -from OpenGL.GLUT import glutLeaveMainLoop class PixMan: _instance = None _initialized = False - @staticmethod - def handle_sigint(sig, frame): - try: - # Threads are started as daemons so will automatically shut down - glutLeaveMainLoop() - sys.exit(0) - except: - pass - finally: - print("Exiting...") - def __new__(cls, *args, **kwargs): if cls._instance is None: cls._instance = super().__new__(cls) @@ -48,8 +35,6 @@ class PixMan: self.t_flask = None self.t_idle_download = None - signal.signal(signal.SIGINT, PixMan.handle_sigint) - self.configfile = configfile self.config = Config.load(self.configfile) if os.path.exists(self.configfile) else Config() @@ -76,7 +61,8 @@ class PixMan: # Create display self.display = PixDisplay(self.texture_list) - self.display.main({}) # TODO glut args + self.display.main() + self.die() def update_textures(self): if self.texture_list: @@ -110,6 +96,12 @@ class PixMan: return True + def die(self): + # Join threads and exit + self.t_flask.join() + self.t_idle_download.join() + sys.exit(0) + @property def frozen(self): # For pyinstaller -- cgit v1.2.3