1.7.0实现

This commit is contained in:
2022-07-08 04:02:21 +08:00
parent d3970b8b28
commit 7f18273cca
15 changed files with 225 additions and 79 deletions

View File

@@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行
###########################################################################################
# 作者gfdgd xi
# 版本1.6.1
# 更新时间2022年04月30日五一了)
# 版本1.7.0
# 更新时间2022年07月08日暑假了)
# 感谢anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建
###########################################################################################
@@ -46,8 +46,18 @@ def BuildDeb():
threading.Thread(target=GetBuildApkDebError, args=(combobox1.get(),)).start()
def RunCommandShow(command):
TextboxAddText1("$> {}".format(command))
TextboxAddText1(GetCommandReturn(command))
TextboxAddText1("$> {}".format(command) + "\n")
res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# 实时读取程序返回
while res.poll() is None:
try:
texts = res.stdout.readline().decode("utf8")
except:
texts = ""
print(texts, end="")
TextboxAddText1(texts)
# 已废弃
# TextboxAddText1(GetCommandReturn(command))
def GetBuildApkDebError(apkPath):
try:
@@ -58,6 +68,7 @@ def GetBuildApkDebError(apkPath):
DisabledAndEnbled(False)
def BuildApkDeb(apkPath):
textbox1.delete("1.0","end")
tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024)))
RunCommandShow("echo '======================================New===================================='")
RunCommandShow("echo '创建目录'")
@@ -344,7 +355,7 @@ def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标":
def TextboxAddText1(message):
global textbox1
textbox1.configure(state=tk.NORMAL)
textbox1.insert(tk.END,message + "\n")
textbox1.insert(tk.END,message)
textbox1.configure(state=tk.DISABLED)
# 获取用户桌面目录
@@ -397,7 +408,20 @@ findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/F
###########################
# 窗口创建
###########################
win = tk.Tk()
# 读取主题
try:
theme = not ("dark" in readtxt(get_home() + "/.gtkrc-2.0") and "gtk-theme-name=" in readtxt(get_home() + "/.gtkrc-2.0"))
except:
print("主题读取错误,默认使用浅色主题")
theme = True
if theme:
win = tk.Tk()
themes = ttkthemes.ThemedStyle(win)
themes.set_theme("breeze")
else:
import ttkbootstrap
style = ttkbootstrap.Style(theme="darkly")
win = style.master # 创建窗口
qianZhui = tk.BooleanVar()
@@ -422,9 +446,6 @@ textbox1.config(foreground='white', background='black')
if len(sys.argv) > 1:
combobox1.set(sys.argv[1])
# 设置窗口
style = ttkthemes.ThemedStyle(win)
style.set_theme("breeze")
#win.attributes('-alpha', 0.5)
win.title(title)
win.resizable(0, 0)
win.iconphoto(False, tk.PhotoImage(file=iconPath))