From 418969e6c28e6137dd2e92bd95a92e5606310530 Mon Sep 17 00:00:00 2001 From: Wiktor Mazur Date: Tue, 24 Sep 2019 22:07:58 +0200 Subject: [PATCH] FIXED: configuration file in Windows OS --- gui/src/config.py | 12 ++++++++++-- gui/src/meter.py | 6 ++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gui/src/config.py b/gui/src/config.py index 0a5873d..4460fe5 100644 --- a/gui/src/config.py +++ b/gui/src/config.py @@ -15,10 +15,18 @@ opacity = 0.5 version = '%s' """ % (CFG_VERSION) +_script_path = None + + +def set_script_path(path): + global _script_path + _script_path = path + def config(): + global _script_path conf_file = os.path.join(os.path.dirname( - os.path.realpath(__file__)), 'albion-online-stats.cfg') + _script_path), 'albion-online-stats.cfg') try: with open(conf_file, "r") as cfg_file: @@ -32,4 +40,4 @@ def config(): cfg_file.write(default) return toml.loads(default) - return {} \ No newline at end of file + return {} diff --git a/gui/src/meter.py b/gui/src/meter.py index 26ad116..c53da32 100644 --- a/gui/src/meter.py +++ b/gui/src/meter.py @@ -5,15 +5,17 @@ from PySide2.QtWidgets import QApplication import libmeter +from config import set_script_path +set_script_path(sys.argv[0]) # pyinstaller creates tmpdir for python files, thus this is the way to get executable path + +from config import config from main import MainWidget from engine import initialize from styling import style -from config import config if __name__ == "__main__": initialize() - conf = config() window_config = conf['window']