-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.py
67 lines (55 loc) · 1.73 KB
/
app.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding: utf-8 -*-
from loginView import login_view
from skipView import skip_view
import flet as ft
import tempfile
import os
import logging
from logging.handlers import RotatingFileHandler
folder_path = f"{tempfile.gettempdir()+os.sep}fuckcqooc"
if not os.path.exists(folder_path):
os.makedirs(folder_path)
else:
# Empty the folder
for file in os.listdir(folder_path):
os.remove(folder_path + os.sep + file)
log_location = f"{folder_path+os.sep}fuckcqooc.log"
logger = logging.getLogger()
logger.setLevel(logging.INFO)
handler = RotatingFileHandler(
log_location, "a", maxBytes=1024 * 1024 * 5, backupCount=5
)
logger.addHandler(handler)
logging.info(f"Started logging to file {log_location}.")
font_family = {
"Noto Sans SC": "/fonts/NotoSansSC-Regular.otf",
"JetBrains Mono": "/fonts/JetBrainsMono-Regular.ttf",
}
def main(page: ft.Page):
def on_route_change(e):
page.views.clear()
login_view(page)
if e.route == "/course":
skip_view(page)
page.update()
def view_pop():
page.views.pop()
top_view = page.views[-1]
page.go(top_view.route)
page.core = None
page.log_folder_path = folder_path
page.title = "小鱼高校平台助手V3.3.1"
page.vertical_alignment = "center"
page.horizontal_alignment = "center"
page.fonts = {
"Noto Sans SC": "/fonts/NotoSansSC-Regular.otf",
"JetBrains Mono": "/fonts/JetBrainsMono-Regular.ttf",
}
page.on_route_change = on_route_change
page.on_view_pop = view_pop
page.window_min_width = 1200
page.window_width = 1200
page.window_height = 800
page.window_min_height = 800
page.go(page.route)
ft.app(target=main, assets_dir="../assets")