fix: Fixed right temperature gauge

This commit is contained in:
2026-01-14 14:58:30 +01:00
parent 7a79e48378
commit 1c53ac7a97
2 changed files with 11 additions and 1 deletions

View File

@@ -33,3 +33,5 @@ pyinstaller --name "volvodisplay" \
main.py
echo "Build complete. Binary is in 'dist/volvodisplay'"
cp config.json dist/
echo "Copied config.json to 'dist/'"

10
main.py
View File

@@ -39,7 +39,15 @@ class Backend(QObject):
self.timer.start(2000) # Poll every 2 seconds
def load_config(self):
config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.json")
# Determine path based on run mode (Script vs Frozen/Compiled)
if getattr(sys, 'frozen', False):
# If run as a compiled exe, look in the same directory as the executable
application_path = os.path.dirname(sys.executable)
else:
# If run as a script, look in the directory of the script
application_path = os.path.dirname(os.path.abspath(__file__))
config_path = os.path.join(application_path, "config.json")
if os.path.exists(config_path):
try:
with open(config_path, 'r') as f: