-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
31 lines (23 loc) · 857 Bytes
/
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
import os
from typing import Any
from kivy.config import Config
from kivymd.app import MDApp
from kivymd.uix.screenmanager import MDScreenManager
import databases
from logic import XNWPProfile
from screens import MainScreen
class MainApp(MDApp):
def __init__(self, profile: XNWPProfile, **kwargs: Any):
super().__init__(**kwargs)
self.profile = profile
def build(self) -> MDScreenManager:
self.theme_cls.theme_style = "Light"
self.theme_cls.primary_palette = "DeepPurple"
self.theme_cls.accent_palette = "Purple"
return MainScreen(self.profile)
def on_stop(self) -> None:
self.profile.savefile(os.path.join("bin", "default.json"))
databases.load()
Config.set("kivy", "exit_on_escape", "0")
profile = XNWPProfile.loadfile(os.path.join("bin", "default.json"))
MainApp(profile).run()