diff --git a/ui/homeui.py b/ui/homeui.py index 92f1c65..bb7b755 100644 --- a/ui/homeui.py +++ b/ui/homeui.py @@ -59,7 +59,8 @@ def show_home_page(): def home_ui(root: mtk.Frame): global master - install_root_frame = mtk.Frame(root) - master = install_root_frame + home_root_frame = mtk.Frame(root) + master = home_root_frame show_home_page() - install_root_frame.pack(fill="both", expand=True) + home_root_frame.pack(fill="both", expand=True) + return home_root_frame diff --git a/ui/injectimg.py b/ui/injectimg.py new file mode 100644 index 0000000..fa2f7d1 --- /dev/null +++ b/ui/injectimg.py @@ -0,0 +1,30 @@ +import os +import sys +from magictk import mtk, color_tmpl +from magictk import fontconfig +from ui.lang import l +from logger.logger import * +from lib import vars +from tkinter import Label as tkLabel + +now_frame = None +master: mtk.Frame = None + + +def show_inject_page(): + global now_frame, master + inject_page = mtk.Frame(master) + mtk.Frame(inject_page, w=10000).pack(fill="both", expand=True) + # TODO + mtk.Frame(inject_page, w=10000).pack(fill="both", expand=True) + inject_page.pack(fill="both", expand=True) + now_frame = inject_page + + +def inject_ui(root: mtk.Frame): + global master + inject_root_frame = mtk.Frame(root) + master = inject_root_frame + show_inject_page() + inject_root_frame.pack(fill="both", expand=True) + return inject_root_frame diff --git a/ui/installer.py b/ui/installer.py index 6d6baba..b6fe2a9 100644 --- a/ui/installer.py +++ b/ui/installer.py @@ -24,7 +24,7 @@ def show_first_page(): mtk.Label(first_page, text="\n"+l("InstallInfo"), anchor='center', font=(fontconfig.getfont(), 12), background=color_tmpl.default_color["background"], foreground=color_tmpl.default_color["secondary_text"]).pack(fill='x') else: - mtk.Label(first_page, text=l("UpgradeWelcome"), + mtk.Label(first_page, text=l("InstallWelcome"), anchor='center', font=(fontconfig.getfont(), 22), background=color_tmpl.default_color["background"], foreground=color_tmpl.default_color["primary_text"]).pack(fill='x') mtk.Label(first_page, text="\n"+l("InstallInfo"), anchor='center', font=(fontconfig.getfont(), 12), background=color_tmpl.default_color["background"], foreground=color_tmpl.default_color["secondary_text"]).pack(fill='x') @@ -306,3 +306,4 @@ def installer_ui(root: mtk.Frame): master = install_root_frame show_first_page() install_root_frame.pack(fill="both", expand=True) + return install_root_frame diff --git a/ui/nav.py b/ui/nav.py index d752ab8..068a617 100644 --- a/ui/nav.py +++ b/ui/nav.py @@ -8,7 +8,7 @@ choose_id = 0 def nav_callback(obj): ids = obj.ids side = navlists[ids]["side"] - global choose_id + global choose_id, nav_main, lastobj if (choose_id == ids): return choose_id = ids @@ -19,9 +19,12 @@ def nav_callback(obj): nav_frame_now.place_forget() nav_frame_now.place(x=0, rely=1, width=3, height=50, anchor='sw') + lastobj.pack_forget() + lastobj = btn_frame_list[choose_id](nav_main) + def pack_nav(master: mtk.Frame, root: mtk.Frame, navlist: list): - global nav_frame_now, btn_list, navlists, nav_main, btn_frame_list + global nav_frame_now, btn_list, navlists, nav_main, btn_frame_list, lastobj navlists = navlist nav_frame = mtk.Frame(master) nav_frame_show = mtk.Frame(nav_frame, w=3) @@ -56,6 +59,5 @@ def pack_nav(master: mtk.Frame, root: mtk.Frame, navlist: list): nav_main = mtk.Frame( master, w=1000) - btn_frame_list[0](nav_main) - + lastobj = btn_frame_list[0](nav_main) nav_main.pack(side="right", fill='both') diff --git a/ui/win.py b/ui/win.py index 500a00d..2e3dc19 100644 --- a/ui/win.py +++ b/ui/win.py @@ -6,6 +6,7 @@ from logger import config from ui import nav from ui import installer from ui import homeui +from ui import injectimg from lib import get_disk from lib import vars from ui.lang import load_lang, l @@ -124,6 +125,10 @@ def main(): print("PEinjector Version: "+pver) sys.exit() if (errno == 2 or UPGRADE == 1 or UPGRADE == 2): + if (UPGRADE == 1): + installer.UPGRADE = 1 + else: + installer.UPGRADE = 0 if (UPGRADE == 0): info("[win]cannot find installed disk") elif (UPGRADE == 1): @@ -145,7 +150,6 @@ def main(): sys.exit(1) else: sys.exit() - installer.UPGRADE = 1 if (UPGRADE == 1): if (os.path.exists("software")): info("[win]clean install cache") @@ -158,7 +162,7 @@ def main(): info(f"[win]found installed disk \"{root_disk}\"") nav_list = [ {"icon": "home-filled", "frame": homeui.home_ui, "side": "top"}, - {"icon": "dvd", "frame": None, "side": "top"}, + {"icon": "dvd", "frame": injectimg.inject_ui, "side": "top"}, {"icon": "plugin", "frame": None, "side": "top"}, {"icon": "setting", "frame": None, "side": "bottom"} ]