Files
DemonEditor/start.py

30 lines
806 B
Python
Raw Permalink Normal View History

2017-11-09 19:01:09 +03:00
#!/usr/bin/env python3
2020-01-15 07:26:59 +03:00
import os
2017-11-09 19:01:09 +03:00
2020-01-15 07:26:59 +03:00
def update_icon():
need_update = False
2022-05-31 22:37:52 +03:00
icon_name = "demon-editor.desktop"
2020-01-15 07:26:59 +03:00
2022-04-07 16:29:46 +03:00
with open(icon_name, "r", encoding="utf-8") as f:
2020-01-15 07:26:59 +03:00
lines = f.readlines()
for i, line in enumerate(lines):
if line.startswith("Icon="):
icon_path = line.lstrip("Icon=")
2022-04-07 16:29:46 +03:00
current_path = f"{os.getcwd()}/app/ui/icons/hicolor/96x96/apps/demon-editor.png"
2020-01-15 07:26:59 +03:00
if icon_path != current_path:
need_update = True
2022-04-07 16:29:46 +03:00
lines[i] = f"Icon={current_path}\n"
2020-01-15 07:26:59 +03:00
break
if need_update:
2022-04-07 16:29:46 +03:00
with open(icon_name, "w", encoding="utf-8") as f:
2020-01-15 07:26:59 +03:00
f.writelines(lines)
if __name__ == "__main__":
2021-08-15 14:37:21 +03:00
from app.ui.main import start_app
2020-01-15 07:26:59 +03:00
update_icon()
start_app()