From a071f700594e467e5ef1336b1e949009d244b4e4 Mon Sep 17 00:00:00 2001 From: WorldTeacher <41587052+WorldTeacher@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:02:36 +0200 Subject: [PATCH] updates --- .vscode/tasks.json | 111 +++++++++++++++++++++++++++++++++++++++++ build.app.json | 77 ++++++++++++++++++++++++++++ build.debug.app.json | 77 ++++++++++++++++++++++++++++ build.release.app.json | 77 ++++++++++++++++++++++++++++ config/config.py | 26 ++++++++-- main.py | 1 + main_dev.py | 5 ++ 7 files changed, 369 insertions(+), 5 deletions(-) create mode 100644 .vscode/tasks.json create mode 100644 build.app.json create mode 100644 build.debug.app.json create mode 100644 build.release.app.json create mode 100644 main_dev.py diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..512893a --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,111 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build LibrarySystem (Debug)", + "type": "shell", + "command": "pyinstaller", + "args": [ + "--noconfirm", + "--onedir", + "--console", + "--icon", + "'${config:ApplicationIconPath}'", + "--name", + "LibrarySystem-debug", + "--contents-directory", + ".", + "--clean", + "--add-data", + "'${config:configPath};config/'", + "--add-data", + "'${config:iconsPath};icons/'", + "'${workspaceFolder}/main_dev.py'" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "reveal": "always", + "panel": "new", + "focus": false + }, + "dependsOn": "Compress dist Folder Debug", + "problemMatcher": "$pyinstaller" + }, + { + "label": "Build LibrarySystem (Release)", + "type": "shell", + "command": "pyinstaller", + "args": [ + "--noconfirm", + "--onedir", + "--windowed", + "--name", + "LibrarySystem", + "--contents-directory", + ".", + "--clean", + "--add-data", + "'${config:configPath};config/'", + "--add-data", + "'${config:iconsPath};icons/'", + "--icon", + "'${config:ApplicationIconPath}'", + "'${workspaceFolder}/main.py'" + ], + "group": { + "kind": "build", + "isDefault": false + }, + "presentation": { + "reveal": "always", + "panel": "new", + "focus": false + }, + "dependsOn": "Compress dist Folder Release", + "problemMatcher": "$pyinstaller" + }, + { + "label": "Run LibrarySystem (live)", + "type": "shell", + "command": "c:/Users/aky547/GitHub/LibrarySystem/.venv/Scripts/python.exe", + "args": [ + "'c:/Users/aky547/GitHub/LibrarySystem/main_dev.py'", + "--ic-logging" + ], + "group": { + "kind": "test", + "isDefault": true + }, + "problemMatcher": "$python" + }, + { + "label": "Compress dist Folder Debug", + "type": "shell", + "command": "Compress-Archive", + "args": [ + "-Path", + "${workspaceFolder}/dist/LibrarySystem-debug/", + "-DestinationPath", + "${workspaceFolder}/output/LibrarySystem-debug.zip", + ], + "group": "build", + "presentation": "panel" + }, + { + "label": "Compress dist Folder Release", + "type": "shell", + "command": "Compress-Archive", + "args": [ + "-Path", + "${workspaceFolder}/dist/LibrarySystem/", + "-DestinationPath", + "${workspaceFolder}/output/LibrarySystem.zip", + ], + "group": "build", + "presentation": "panel" + } + ] +} \ No newline at end of file diff --git a/build.app.json b/build.app.json new file mode 100644 index 0000000..813c03a --- /dev/null +++ b/build.app.json @@ -0,0 +1,77 @@ +{ + "version": "auto-py-to-exe-configuration_v1", + "pyinstallerOptions": [ + { + "optionDest": "noconfirm", + "value": true + }, + { + "optionDest": "filenames", + "value": "C:/Users/aky547/GitHub/LibrarySystem/main.py" + }, + { + "optionDest": "onefile", + "value": false + }, + { + "optionDest": "console", + "value": false + }, + { + "optionDest": "icon_file", + "value": "C:/Users/aky547/Downloads/1490971308-map-icons-7_82746.ico" + }, + { + "optionDest": "name", + "value": "LibrarySystem" + }, + { + "optionDest": "contents_directory", + "value": "." + }, + { + "optionDest": "clean_build", + "value": true + }, + { + "optionDest": "strip", + "value": false + }, + { + "optionDest": "noupx", + "value": false + }, + { + "optionDest": "disable_windowed_traceback", + "value": false + }, + { + "optionDest": "uac_admin", + "value": false + }, + { + "optionDest": "uac_uiaccess", + "value": false + }, + { + "optionDest": "argv_emulation", + "value": false + }, + { + "optionDest": "bootloader_ignore_signals", + "value": false + }, + { + "optionDest": "datas", + "value": "C:/Users/aky547/GitHub/LibrarySystem/config;config/" + }, + { + "optionDest": "datas", + "value": "C:/Users/aky547/GitHub/LibrarySystem/icons;icons/" + } + ], + "nonPyinstallerOptions": { + "increaseRecursionLimit": true, + "manualArguments": "" + } +} \ No newline at end of file diff --git a/build.debug.app.json b/build.debug.app.json new file mode 100644 index 0000000..0e01b4b --- /dev/null +++ b/build.debug.app.json @@ -0,0 +1,77 @@ +{ + "version": "auto-py-to-exe-configuration_v1", + "pyinstallerOptions": [ + { + "optionDest": "noconfirm", + "value": true + }, + { + "optionDest": "filenames", + "value": "C:/Users/aky547/GitHub/LibrarySystem/main_dev.py" + }, + { + "optionDest": "onefile", + "value": false + }, + { + "optionDest": "console", + "value": true + }, + { + "optionDest": "icon_file", + "value": "C:/Users/aky547/Downloads/1490971308-map-icons-7_82746.ico" + }, + { + "optionDest": "name", + "value": "LibrarySystem-debug" + }, + { + "optionDest": "contents_directory", + "value": "." + }, + { + "optionDest": "clean_build", + "value": true + }, + { + "optionDest": "strip", + "value": false + }, + { + "optionDest": "noupx", + "value": false + }, + { + "optionDest": "disable_windowed_traceback", + "value": false + }, + { + "optionDest": "uac_admin", + "value": false + }, + { + "optionDest": "uac_uiaccess", + "value": false + }, + { + "optionDest": "argv_emulation", + "value": false + }, + { + "optionDest": "bootloader_ignore_signals", + "value": false + }, + { + "optionDest": "datas", + "value": "C:/Users/aky547/GitHub/LibrarySystem/config;config/" + }, + { + "optionDest": "datas", + "value": "C:/Users/aky547/GitHub/LibrarySystem/icons;icons/" + } + ], + "nonPyinstallerOptions": { + "increaseRecursionLimit": true, + "manualArguments": "" + } +} \ No newline at end of file diff --git a/build.release.app.json b/build.release.app.json new file mode 100644 index 0000000..813c03a --- /dev/null +++ b/build.release.app.json @@ -0,0 +1,77 @@ +{ + "version": "auto-py-to-exe-configuration_v1", + "pyinstallerOptions": [ + { + "optionDest": "noconfirm", + "value": true + }, + { + "optionDest": "filenames", + "value": "C:/Users/aky547/GitHub/LibrarySystem/main.py" + }, + { + "optionDest": "onefile", + "value": false + }, + { + "optionDest": "console", + "value": false + }, + { + "optionDest": "icon_file", + "value": "C:/Users/aky547/Downloads/1490971308-map-icons-7_82746.ico" + }, + { + "optionDest": "name", + "value": "LibrarySystem" + }, + { + "optionDest": "contents_directory", + "value": "." + }, + { + "optionDest": "clean_build", + "value": true + }, + { + "optionDest": "strip", + "value": false + }, + { + "optionDest": "noupx", + "value": false + }, + { + "optionDest": "disable_windowed_traceback", + "value": false + }, + { + "optionDest": "uac_admin", + "value": false + }, + { + "optionDest": "uac_uiaccess", + "value": false + }, + { + "optionDest": "argv_emulation", + "value": false + }, + { + "optionDest": "bootloader_ignore_signals", + "value": false + }, + { + "optionDest": "datas", + "value": "C:/Users/aky547/GitHub/LibrarySystem/config;config/" + }, + { + "optionDest": "datas", + "value": "C:/Users/aky547/GitHub/LibrarySystem/icons;icons/" + } + ], + "nonPyinstallerOptions": { + "increaseRecursionLimit": true, + "manualArguments": "" + } +} \ No newline at end of file diff --git a/config/config.py b/config/config.py index 14ba493..dbecbf7 100644 --- a/config/config.py +++ b/config/config.py @@ -4,7 +4,7 @@ import omegaconf class Config: _config: Optional[omegaconf.DictConfig] = None - + def __init__(self, config_path: str): """ Loads the configuration file and stores it for future access. @@ -94,17 +94,33 @@ class Config: if self._config is None: raise RuntimeError("Configuration not loaded") self._config.log_debug = value + @property + def ic_logging(self)->bool: + if self._config is None: + raise RuntimeError("Configuration not loaded") + return self._config.ic_logging + @ic_logging.setter + def ic_logging(self, value:bool): + if self._config is None: + raise RuntimeError("Configuration not loaded") + self._config.ic_logging = value def save(self): if self._config is None: raise RuntimeError("Configuration not loaded") omegaconf.OmegaConf.save(self._config, "config/settings.yaml") - - + def apply_options(options:list): + if self._config is None: + raise RuntimeError("Configuration not loaded") + for option in options: + if option in self._config: + self._config[option] = True + else: + raise KeyError(f"Option {option} not found in configuration") if __name__ == "__main__": cfg = Config("config/settings.yaml") - print(cfg.database.path) + #print(cfg.database.path) cfg.database.path = "nopathhere" - print(cfg.database.path) + #print(cfg.database.path) cfg.save() #cfg.updateValue("database.path", "Test") \ No newline at end of file diff --git a/main.py b/main.py index 1bce9d3..c47644c 100644 --- a/main.py +++ b/main.py @@ -2,3 +2,4 @@ from src.ui.main_ui import launch if __name__ == "__main__": launch() + diff --git a/main_dev.py b/main_dev.py new file mode 100644 index 0000000..295af3d --- /dev/null +++ b/main_dev.py @@ -0,0 +1,5 @@ +from src.ui.main_ui import launch + +if __name__ == "__main__": + launch("--debug") +