fix: Fixed right temperature gauge
This commit is contained in:
2
build.sh
2
build.sh
@@ -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
10
main.py
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user