From a2469bd994a286dea14dd526b2bd5b243b891820 Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 24 Jul 2019 18:46:13 -0400 Subject: [PATCH] Don't use user theme in debug mode --- TODO.md | 1 - src/python/app.py | 5 ++++- src/python/config_files.py | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index a840c5eb..53e79f99 100644 --- a/TODO.md +++ b/TODO.md @@ -68,7 +68,6 @@ - Prevent using the SendBox if no permission (power levels) - Spinner when loading past room events, images or clicking buttons - Theming - - Don't use user theme in debug mode - Don't create additional lines in theme conversion (braces) - Recursively merge default and user theme - Distribute fonts diff --git a/src/python/app.py b/src/python/app.py index 0a4566dc..82f445ae 100644 --- a/src/python/app.py +++ b/src/python/app.py @@ -24,6 +24,7 @@ class App: from .backend import Backend self.backend = Backend(app=self) + self.debug = False from .image_provider import ImageProvider self.image_provider = ImageProvider(self) @@ -35,7 +36,9 @@ class App: def is_debug_on(self, cli_flags: Sequence[str] = ()) -> bool: - return "-d" in cli_flags or "--debug" in cli_flags + debug = "-d" in cli_flags or "--debug" in cli_flags + self.debug = debug + return debug def _loop_starter(self) -> None: diff --git a/src/python/config_files.py b/src/python/config_files.py index 96f0c0af..678eecf1 100644 --- a/src/python/config_files.py +++ b/src/python/config_files.py @@ -151,6 +151,10 @@ class Theme(ConfigFile): async def read(self) -> str: + # pylint: disable=no-member + if self.backend.app.debug: + return convert_to_qml(await self.default_data()) + if not self.path.exists(): await self.write(await self.default_data())