From 71f78feec651b7398bc8396b2219c8691c49bc90 Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 21 Jul 2019 06:05:01 -0400 Subject: [PATCH] Define UIState config file --- TODO.md | 2 ++ src/python/config_files.py | 21 ++++++++++++++++++--- src/qml/UI.qml | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index 3642faec..abf70131 100644 --- a/TODO.md +++ b/TODO.md @@ -12,6 +12,7 @@ - When qml syntax highlighting supports string interpolation, use them - Fixes + - Keyboard flicking against top/bottom edge - Don't strip user spacing in html - Past events loading (limit 100) freezes the GUI - need to move upsert func to a WorkerScript @@ -19,6 +20,7 @@ - Horrible performance for big rooms - UI + - When reduced, show the full-window sidepane instead of Default page - Adapt shortcuts flicking speed to font size and DPI - Show error box if uploading avatar fails - EditAccount page: diff --git a/src/python/config_files.py b/src/python/config_files.py index 91eb3fec..1155b9cf 100644 --- a/src/python/config_files.py +++ b/src/python/config_files.py @@ -18,13 +18,16 @@ WRITE_LOCK = asyncio.Lock() @dataclass class ConfigFile: - backend: Backend = field() - filename: str = field() + backend: Backend = field() + filename: str = field() + use_data_dir: bool = False @property def path(self) -> Path: # pylint: disable=no-member - return Path(self.backend.app.appdirs.user_config_dir) / self.filename + dirs = self.backend.app.appdirs + to = dirs.user_data_dir if self.use_data_dir else dirs.user_config_dir + return Path(to) / self.filename @dataclass @@ -87,3 +90,15 @@ class UISettings(JSONConfigFile): return { "write_aliases": {} } + + +@dataclass +class UIState(JSONConfigFile): + filename: str = "ui-state.json" + use_data_dir: bool = True + + async def default_data(self) -> JsonData: + return { + "page": "Pages/Default.qml", + "pageProperties": {}, + } diff --git a/src/qml/UI.qml b/src/qml/UI.qml index 8e845722..f29cb9f0 100644 --- a/src/qml/UI.qml +++ b/src/qml/UI.qml @@ -15,7 +15,7 @@ Item { target: py onWillLoadAccounts: will => { pageStack.showPage(will ? "Default": "SignIn") - if (will) { initialRoomTimer.start() } + // if (will) { initialRoomTimer.start() } } }