From b4c2bf500d1939d93f1c2146798842d5f98902de Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Wed, 25 Jun 2025 00:17:14 -0500 Subject: pyinstaller support --- manager.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'manager.py') diff --git a/manager.py b/manager.py index 6a6498e..275e6b2 100644 --- a/manager.py +++ b/manager.py @@ -3,6 +3,7 @@ import sys import signal import copy from threading import Thread +from pathlib import Path from OpenGL.GLUT import glutLeaveMainLoop @@ -109,6 +110,26 @@ class PixMan: return True + @property + def frozen(self): + # For pyinstaller + # https://api.arcade.academy/en/latest/tutorials/bundling_with_pyinstaller/index.html#handling-data-files + if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"): + return True + return False + + @property + def static_dir(self): + if self.frozen: + return Path(sys._MEIPASS) / "static" + return Path("./static/dist") + + @property + def static_public(self): + if self.frozen: + return Path(sys._MEIPASS) / "public" + return Path("./static/public") + from lazycachelist import LazyCachingTextureList from window import PixDisplay -- cgit v1.2.3