Adding to settings control
This commit is contained in:
parent
6d8079b3fe
commit
7e7b8ebfba
|
@ -33,6 +33,9 @@ def daemon_threaded_wrapper(fn):
|
|||
builtins.app_name = "<change_me>"
|
||||
builtins.event_system = EventSystem()
|
||||
builtins.settings_manager = SettingsManager()
|
||||
|
||||
settings_manager.load_settings()
|
||||
|
||||
builtins.settings = settings_manager.settings
|
||||
builtins.logger = Logger(settings_manager.get_home_config_path(), \
|
||||
_ch_log_lvl=settings.debugging.ch_log_lvl, \
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Python imports
|
||||
import signal
|
||||
import json
|
||||
from os import path
|
||||
from os import mkdir
|
||||
|
@ -34,12 +35,12 @@ class SettingsManager(Singleton):
|
|||
self._trace_debug = False
|
||||
self._debug = False
|
||||
|
||||
self.load_settings()
|
||||
|
||||
def set_main_window(self, window): self._main_window = window
|
||||
|
||||
def get_home_config_path(self) -> str: return self._HOME_CONFIG_PATH
|
||||
def get_main_window(self): return self._main_window
|
||||
def get_main_window(self): return self._main_window
|
||||
def get_home_config_path(self) -> str: return self._HOME_CONFIG_PATH
|
||||
def get_home_path(self) -> str: return self._USER_HOME
|
||||
|
||||
def is_trace_debug(self) -> bool: return self._trace_debug
|
||||
def is_debug(self) -> bool: return self._debug
|
||||
|
@ -50,6 +51,11 @@ class SettingsManager(Singleton):
|
|||
def set_debug(self, debug: bool):
|
||||
self._debug = debug
|
||||
|
||||
def call_method(self, target_class = None, _method_name = None, data = None):
|
||||
method_name = str(_method_name)
|
||||
method = getattr(target_class, method_name, lambda data: f"No valid key passed...\nkey={method_name}\nargs={data}")
|
||||
return method(data) if data else method()
|
||||
|
||||
def load_settings(self):
|
||||
if not path.exists(self._CONFIG_FILE):
|
||||
self.settings = Settings()
|
||||
|
|
|
@ -25,3 +25,7 @@ class Config:
|
|||
sys_icon_wh: list = field(default_factory=lambda: [56, 56])
|
||||
steam_cdn_url: str = "https://steamcdn-a.akamaihd.net/steam/apps/"
|
||||
remux_folder_max_disk_usage: str = "8589934592"
|
||||
application_dirs: list = field(default_factory=lambda: [
|
||||
"/usr/share/applications",
|
||||
f"{settings_manager.get_home_path()}/.local/share/applications"
|
||||
])
|
||||
|
|
Loading…
Reference in New Issue