Copy default theme to user data dir if not exist
This commit is contained in:
parent
5dc6c071d6
commit
de11b53c4e
1
TODO.md
1
TODO.md
|
@ -69,7 +69,6 @@
|
|||
- Spinner when loading past room events, images or clicking buttons
|
||||
- Theming
|
||||
- Thin white icons
|
||||
- Copy the default theme to user data dir
|
||||
- Distribute fonts
|
||||
- preferredIconPack: accept multiple values
|
||||
- Find icon packs in user data dir
|
||||
|
|
|
@ -142,22 +142,16 @@ class Theme(ConfigFile):
|
|||
def path(self) -> Path:
|
||||
# pylint: disable=no-member
|
||||
data_dir = Path(self.backend.app.appdirs.user_data_dir)
|
||||
user_file = data_dir / "themes" / self.filename
|
||||
|
||||
if user_file.exists():
|
||||
return user_file
|
||||
|
||||
return Path("src") / "themes" / self.filename
|
||||
return data_dir / "themes" / self.filename
|
||||
|
||||
|
||||
async def default_data(self) -> str:
|
||||
async with aiofiles.open("src/themes/Default.qpl", "r") as file:
|
||||
return file.read()
|
||||
return await file.read()
|
||||
|
||||
|
||||
async def read(self) -> str:
|
||||
if not self.path.exists():
|
||||
await self.write(await self.default_data())
|
||||
|
||||
return convert_to_qml(await super().read())
|
||||
|
||||
|
||||
async def write(self, data: str) -> None:
|
||||
raise NotImplementedError()
|
||||
|
|
|
@ -58,11 +58,12 @@ colors:
|
|||
color link: accentText
|
||||
color code: hsluv(hue + 5, saturation * 1.5, intensity * 60)
|
||||
|
||||
NumberAnimation on intensity // For testing
|
||||
// Example of an animation, set running: true to enable
|
||||
NumberAnimation on hue
|
||||
running: false
|
||||
from: 0
|
||||
to: 10
|
||||
duration: 20000
|
||||
to: 360
|
||||
duration: 10000
|
||||
loops: Animation.Infinite
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user