-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
49 lines (33 loc) · 1.04 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import getDependency
from PySide6.QtWidgets import QApplication
from PySide6.QtGui import QIcon
from qfluentwidgets import FluentWindow, setTheme, Theme
from Tasks import TaskMain
import json
import warnings
import os
warnings.filterwarnings("ignore")
class MainWindow(FluentWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("任务管理")
self.setMinimumSize(800, 600)
self.setWindowIcon(QIcon("assests/files.svg"))
self.task_main = TaskMain()
self.addSubInterface(self.task_main, QIcon("assests/checklist.svg"), "任务")
def load_tasks(self):
if os.path.exists("tasks.json"):
tasks = json.load(open("tasks.json", "r"))
else:
tasks = []
self.task_main.load_tasks(tasks)
def save_tasks(self):
data = self.task_main.get_tasks_attr()
json.dump(data, open("tasks.json", "w"))
setTheme(Theme.DARK)
app = QApplication()
window = MainWindow()
window.load_tasks()
window.show()
app.exec()
window.save_tasks()