summaryrefslogtreecommitdiff
path: root/manager.py
diff options
context:
space:
mode:
Diffstat (limited to 'manager.py')
-rw-r--r--manager.py24
1 files changed, 8 insertions, 16 deletions
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