Define UIState config file

This commit is contained in:
miruka 2019-07-21 06:05:01 -04:00
parent 414082d258
commit 71f78feec6
3 changed files with 21 additions and 4 deletions

View File

@ -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:

View File

@ -20,11 +20,14 @@ WRITE_LOCK = asyncio.Lock()
class ConfigFile:
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": {},
}

View File

@ -15,7 +15,7 @@ Item {
target: py
onWillLoadAccounts: will => {
pageStack.showPage(will ? "Default": "SignIn")
if (will) { initialRoomTimer.start() }
// if (will) { initialRoomTimer.start() }
}
}