添加但未实现inject_img页面

This commit is contained in:
cxykevin 2024-05-04 22:28:55 +08:00
parent f329f83ec0
commit 4398c4a67f
5 changed files with 48 additions and 10 deletions

View File

@ -59,7 +59,8 @@ def show_home_page():
def home_ui(root: mtk.Frame): def home_ui(root: mtk.Frame):
global master global master
install_root_frame = mtk.Frame(root) home_root_frame = mtk.Frame(root)
master = install_root_frame master = home_root_frame
show_home_page() show_home_page()
install_root_frame.pack(fill="both", expand=True) home_root_frame.pack(fill="both", expand=True)
return home_root_frame

30
ui/injectimg.py Normal file
View File

@ -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

View File

@ -24,7 +24,7 @@ def show_first_page():
mtk.Label(first_page, text="\n"+l("InstallInfo"), 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') anchor='center', font=(fontconfig.getfont(), 12), background=color_tmpl.default_color["background"], foreground=color_tmpl.default_color["secondary_text"]).pack(fill='x')
else: 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') 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"), 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') 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 master = install_root_frame
show_first_page() show_first_page()
install_root_frame.pack(fill="both", expand=True) install_root_frame.pack(fill="both", expand=True)
return install_root_frame

View File

@ -8,7 +8,7 @@ choose_id = 0
def nav_callback(obj): def nav_callback(obj):
ids = obj.ids ids = obj.ids
side = navlists[ids]["side"] side = navlists[ids]["side"]
global choose_id global choose_id, nav_main, lastobj
if (choose_id == ids): if (choose_id == ids):
return return
choose_id = ids choose_id = ids
@ -19,9 +19,12 @@ def nav_callback(obj):
nav_frame_now.place_forget() nav_frame_now.place_forget()
nav_frame_now.place(x=0, rely=1, width=3, height=50, anchor='sw') 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): 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 navlists = navlist
nav_frame = mtk.Frame(master) nav_frame = mtk.Frame(master)
nav_frame_show = mtk.Frame(nav_frame, w=3) 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( nav_main = mtk.Frame(
master, w=1000) master, w=1000)
btn_frame_list[0](nav_main) lastobj = btn_frame_list[0](nav_main)
nav_main.pack(side="right", fill='both') nav_main.pack(side="right", fill='both')

View File

@ -6,6 +6,7 @@ from logger import config
from ui import nav from ui import nav
from ui import installer from ui import installer
from ui import homeui from ui import homeui
from ui import injectimg
from lib import get_disk from lib import get_disk
from lib import vars from lib import vars
from ui.lang import load_lang, l from ui.lang import load_lang, l
@ -124,6 +125,10 @@ def main():
print("PEinjector Version: "+pver) print("PEinjector Version: "+pver)
sys.exit() sys.exit()
if (errno == 2 or UPGRADE == 1 or UPGRADE == 2): if (errno == 2 or UPGRADE == 1 or UPGRADE == 2):
if (UPGRADE == 1):
installer.UPGRADE = 1
else:
installer.UPGRADE = 0
if (UPGRADE == 0): if (UPGRADE == 0):
info("[win]cannot find installed disk") info("[win]cannot find installed disk")
elif (UPGRADE == 1): elif (UPGRADE == 1):
@ -145,7 +150,6 @@ def main():
sys.exit(1) sys.exit(1)
else: else:
sys.exit() sys.exit()
installer.UPGRADE = 1
if (UPGRADE == 1): if (UPGRADE == 1):
if (os.path.exists("software")): if (os.path.exists("software")):
info("[win]clean install cache") info("[win]clean install cache")
@ -158,7 +162,7 @@ def main():
info(f"[win]found installed disk \"{root_disk}\"") info(f"[win]found installed disk \"{root_disk}\"")
nav_list = [ nav_list = [
{"icon": "home-filled", "frame": homeui.home_ui, "side": "top"}, {"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": "plugin", "frame": None, "side": "top"},
{"icon": "setting", "frame": None, "side": "bottom"} {"icon": "setting", "frame": None, "side": "bottom"}
] ]