Copy default theme to user data dir if not exist

This commit is contained in:
miruka 2019-07-24 18:09:28 -04:00
parent 5dc6c071d6
commit de11b53c4e
3 changed files with 9 additions and 15 deletions

View File

@ -69,7 +69,6 @@
- Spinner when loading past room events, images or clicking buttons - Spinner when loading past room events, images or clicking buttons
- Theming - Theming
- Thin white icons - Thin white icons
- Copy the default theme to user data dir
- Distribute fonts - Distribute fonts
- preferredIconPack: accept multiple values - preferredIconPack: accept multiple values
- Find icon packs in user data dir - Find icon packs in user data dir

View File

@ -142,22 +142,16 @@ class Theme(ConfigFile):
def path(self) -> Path: def path(self) -> Path:
# pylint: disable=no-member # pylint: disable=no-member
data_dir = Path(self.backend.app.appdirs.user_data_dir) data_dir = Path(self.backend.app.appdirs.user_data_dir)
user_file = data_dir / "themes" / self.filename return data_dir / "themes" / self.filename
if user_file.exists():
return user_file
return Path("src") / "themes" / self.filename
async def default_data(self) -> str: async def default_data(self) -> str:
async with aiofiles.open("src/themes/Default.qpl", "r") as file: async with aiofiles.open("src/themes/Default.qpl", "r") as file:
return file.read() return await file.read()
async def read(self) -> str: async def read(self) -> str:
if not self.path.exists():
await self.write(await self.default_data())
return convert_to_qml(await super().read()) return convert_to_qml(await super().read())
async def write(self, data: str) -> None:
raise NotImplementedError()

View File

@ -58,11 +58,12 @@ colors:
color link: accentText color link: accentText
color code: hsluv(hue + 5, saturation * 1.5, intensity * 60) 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 running: false
from: 0 from: 0
to: 10 to: 360
duration: 20000 duration: 10000
loops: Animation.Infinite loops: Animation.Infinite