-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_admin.py
More file actions
49 lines (37 loc) · 1.28 KB
/
Copy pathrun_admin.py
File metadata and controls
49 lines (37 loc) · 1.28 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
from pathlib import Path
import sys
APP_DIR = Path(__file__).resolve().parent / "GameStoreApp"
sys.path.insert(0, str(APP_DIR))
sys.path.insert(0, str(APP_DIR.parent))
import customtkinter as ctk
import config
from admin.admin_dashboard import AdminDashboard
from auth.admin_login import AdminLoginFrame
from core.file_handler import init_db
from core.session import Session
class AdminStoreApp(ctk.CTk):
def __init__(self):
super().__init__()
self.title(config.ADMIN_APP_TITLE)
self.geometry(config.WINDOW_SIZE)
ctk.set_appearance_mode(config.THEME_MODE)
ctk.set_default_color_theme(config.COLOR_THEME)
init_db()
self.session = Session()
self.container = ctk.CTkFrame(self)
self.container.pack(fill="both", expand=True)
self.show_admin_login()
def clear_container(self):
for widget in self.container.winfo_children():
widget.destroy()
def show_admin_login(self):
self.clear_container()
self.session.clear()
AdminLoginFrame(self.container, self)
def show_admin_dashboard(self):
self.session.set_admin()
self.clear_container()
AdminDashboard(self.container, self)
if __name__ == "__main__":
app = AdminStoreApp()
app.mainloop()