-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathapp.py
More file actions
62 lines (53 loc) · 2.26 KB
/
app.py
File metadata and controls
62 lines (53 loc) · 2.26 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
import multiprocessing
multiprocessing.set_start_method("spawn", force=True)
from dotenv import load_dotenv
load_dotenv()
import argparse
from nicegui import ui, app
from app_core import models
from app_core.profile_selector import ProfileSelector
from app_core.setting_selector import SettingSelector
from app_core.resign import Resign
from app_core.encrypt import Encrypt
from app_core.decrypt import Decrypt
from app_core.reregion import Reregion
from app_core.createsave import Createsave
from app_core.convert import Convert
from app_core.quickcodes import QuickCodes
from app_core.sfo_editor import SFOEditor
from utils.constants import APP_PROFILES_PATH, APP_SETTINGS_PATH, VERSION
from utils.workspace import WorkspaceOpt, startup, check_version
workspace_opt = WorkspaceOpt()
async def initialize_tabs() -> None:
status = await check_version()
profiles = models.Profiles(APP_PROFILES_PATH)
settings = models.Settings(APP_SETTINGS_PATH)
with ui.header().classes("h-12"):
ui.button("X", on_click=app.shutdown, color="red").props("dense flat round").classes("-translate-y-2")
ui.label(f"HTOS {VERSION} ({status})").style("font-size: 15px; font-weight: bold;").classes("absolute-center")
with ui.tabs().classes("w-full") as tabs:
tab_container = [
ProfileSelector(profiles),
Resign(profiles, settings),
Decrypt(settings),
Encrypt(profiles, settings),
Reregion(profiles, settings),
Createsave(profiles, settings),
Convert(settings),
QuickCodes(settings),
SFOEditor(),
SettingSelector(settings)
]
with ui.tab_panels(tabs, value=tab_container[0].tab).classes("w-full"):
for t in tab_container:
with ui.tab_panel(t.tab):
t.construct()
if __name__ in {"__main__", "__mp_main__"}:
parser = argparse.ArgumentParser()
parser.add_argument("--ignore-startup", action="store_true")
parser.add_argument("--reload", action="store_true")
args, _ = parser.parse_known_args()
if args.ignore_startup:
workspace_opt.ignore_startup = True
startup(workspace_opt, lite=True)
ui.run(root=initialize_tabs, reload=args.reload, native=True, dark=True, window_size=(1400, 800))