diff --git a/constants.py b/constants.py index def45109..745a7ede 100644 --- a/constants.py +++ b/constants.py @@ -33,6 +33,11 @@ # The Lib folder is also spelled in lowercase: 'lib' version_info = sys.version_info SYS_SITE_PACKAGES = f"lib/python{version_info.major}.{version_info.minor}/site-packages" +# scripts venv path changes depending on the system platform +if sys.platform == "win32": + SYS_SCRIPTS = "Scripts" +else: + SYS_SCRIPTS = "bin" def _resource_path(relative_path: Path | str) -> Path: @@ -90,6 +95,7 @@ def _merge_vars(base_vars: JsonType, vars: JsonType) -> None: # Development paths VENV_PATH = Path(WORKING_DIR, "env") SITE_PACKAGES_PATH = Path(VENV_PATH, SYS_SITE_PACKAGES) +SCRIPTS_PATH = Path(VENV_PATH, SYS_SCRIPTS) # Translations path # NOTE: These don't have to be available to the end-user, so the path points to the internal dir LANG_PATH = _resource_path("lang") diff --git a/gui.py b/gui.py index 856f8f9f..bdae6c64 100644 --- a/gui.py +++ b/gui.py @@ -34,6 +34,8 @@ from utils import resource_path, set_root_icon, webopen, Game, _T from constants import ( SELF_PATH, + IS_PACKAGED, + SCRIPTS_PATH, WINDOW_TITLE, LOGGING_LEVELS, MAX_WEBSOCKETS, @@ -1742,7 +1744,7 @@ def _get_self_path(self) -> str: return f'"{SELF_PATH.resolve()!s}"' def _get_autostart_path(self) -> str: - flags: list[str] = [''] # this will add a space between self path and flags + flags: list[str] = [] # if applicable, include the current logging level as well for lvl_idx, lvl_value in LOGGING_LEVELS.items(): if lvl_value == self._settings.logging_level: @@ -1751,7 +1753,10 @@ def _get_autostart_path(self) -> str: break if self._vars["tray"].get(): flags.append("--tray") - return self._get_self_path() + ' '.join(flags) + if not IS_PACKAGED: + # non-packaged autostart has to be done through the venv path pythonw + return f"\"{SCRIPTS_PATH / 'pythonw'!s}\" {self._get_self_path()} {' '.join(flags)}" + return f"{self._get_self_path()} {' '.join(flags)}" def _get_linux_autostart_filepath(self) -> Path: autostart_folder: Path = Path("~/.config/autostart").expanduser() @@ -2407,11 +2412,12 @@ async def main(exit_event: asyncio.Event): tray=False, priority=[], proxy=URL(), + alter=lambda: None, language="English", autostart_tray=False, exclude={"Lit Game"}, tray_notifications=True, - alter=lambda: None, + logging_level=LOGGING_LEVELS[0], priority_mode=PriorityMode.PRIORITY_ONLY, ) )