Merge branch 'main' of https://gitee.com/gfdgd-xi/uengine-runner
This commit is contained in:
commit
3f9a3a7b9f
3
Makefile
3
Makefile
|
@ -30,7 +30,8 @@ build:
|
|||
cp -rv builer.svg new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/
|
||||
cp -rv api new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/
|
||||
cp -rv Help new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/
|
||||
cp -rv Download.py new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/
|
||||
cp -rv Download.py new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/
|
||||
cp -rv updatekiller.py new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/
|
||||
cp -rv pkexec/* new-deb-build/usr/share/polkit-1/actions
|
||||
python3 RemovePycacheFile.py
|
||||
cp -rv new-deb-build /tmp/uengine-runner-builder
|
||||
|
|
|
@ -26,6 +26,7 @@ import traceback
|
|||
import threading
|
||||
import webbrowser
|
||||
import subprocess
|
||||
import updatekiller
|
||||
map = True
|
||||
import matplotlib
|
||||
import matplotlib.figure
|
||||
|
@ -1099,7 +1100,7 @@ class UpdateWindow():
|
|||
updateWidgetLayout = QtWidgets.QGridLayout()
|
||||
versionLabel = QtWidgets.QLabel(f"当前版本:{version}\n最新版本:未知\n更新内容:")
|
||||
updateText = QtWidgets.QTextBrowser()
|
||||
ok = QtWidgets.QPushButton("更新(更新过程中会关闭所有Python应用,包括这个应用)")
|
||||
ok = QtWidgets.QPushButton("更新(更新过程中会关闭这个应用的所有进程)")
|
||||
ok.clicked.connect(UpdateWindow.Update)
|
||||
cancel = QtWidgets.QPushButton("取消")
|
||||
cancel.clicked.connect(UpdateWindow.update.close)
|
||||
|
@ -1134,8 +1135,8 @@ class UpdateWindow():
|
|||
write_txt("/tmp/uengine-runner/update.sh", f"""#!/bin/bash
|
||||
echo 删除多余的安装包
|
||||
rm -rfv /tmp/uengine-runner/update/*
|
||||
echo 关闭“UEngine 运行器”以及其它“Python 应用”
|
||||
killall python3
|
||||
echo 关闭“UEngine 运行器”
|
||||
python3 {programPath}/updatekiller.py
|
||||
echo 下载安装包
|
||||
wget -P /tmp/uengine-runner/update {UpdateWindow.data["Url"][0]}
|
||||
echo 安装安装包
|
||||
|
|
|
@ -18,6 +18,7 @@ import random
|
|||
import zipfile
|
||||
import traceback
|
||||
import subprocess
|
||||
import updatekiller
|
||||
import PyQt5.QtGui as QtGui
|
||||
import PyQt5.QtCore as QtCore
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
@ -490,4 +491,4 @@ try:
|
|||
except:
|
||||
print("无参数")
|
||||
window.show()
|
||||
sys.exit(app.exec_())
|
||||
sys.exit(app.exec_())
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import updatekiller
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "--help":
|
||||
print("帮助:")
|
||||
|
@ -8,4 +9,4 @@ if len(sys.argv) > 1:
|
|||
sys.exit(0)
|
||||
sys.exit(os.system("sudo /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(sys.argv[1])))
|
||||
print("命令参数错误")
|
||||
sys.exit(1)
|
||||
sys.exit(1)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from modulefinder import packagePathMap
|
||||
import sys
|
||||
import ttkthemes
|
||||
import updatekiller
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
|
||||
|
@ -31,4 +32,4 @@ def main():
|
|||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
sys.exit(main())
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import updatekiller
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "--help":
|
||||
print("帮助:")
|
||||
|
@ -8,4 +9,4 @@ if len(sys.argv) > 1:
|
|||
sys.exit(0)
|
||||
sys.exit(os.system("sudo /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(sys.argv[1])))
|
||||
print("命令参数错误")
|
||||
sys.exit(1)
|
||||
sys.exit(1)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import updatekiller
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "--help":
|
||||
print("帮助:")
|
||||
|
@ -8,4 +9,4 @@ if len(sys.argv) > 1:
|
|||
sys.exit(0)
|
||||
print("参数错误")
|
||||
sys.exit(1)
|
||||
sys.exit(os.system("sudo rm -rf /data/uengine"))
|
||||
sys.exit(os.system("sudo rm -rf /data/uengine"))
|
||||
|
|
|
@ -14,6 +14,7 @@ import traceback
|
|||
import ttkthemes
|
||||
import pyautogui
|
||||
import threading
|
||||
import updatekiller
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
import tkinter.messagebox as messagebox
|
||||
|
@ -238,4 +239,4 @@ keys.start()
|
|||
threading.Thread(target=ShowTips).start()
|
||||
pyautogui.FAILSAFE = False
|
||||
threading.Thread(target=RestartProgramTimer).start()
|
||||
window.mainloop()
|
||||
window.mainloop()
|
||||
|
|
|
@ -16,6 +16,7 @@ import time
|
|||
import json
|
||||
import ttkthemes
|
||||
import subprocess
|
||||
import updatekiller
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
|
||||
|
@ -167,4 +168,4 @@ def showhelp():
|
|||
print(windowflag)
|
||||
helpwindow.mainloop()
|
||||
#helpwindow.protocol("WM_DELETE_WINDOW", on_closing)
|
||||
showhelp()
|
||||
showhelp()
|
||||
|
|
|
@ -6,6 +6,7 @@ import base64
|
|||
import requests
|
||||
import traceback
|
||||
import webbrowser
|
||||
import updatekiller
|
||||
import urllib.parse as parse
|
||||
import PyQt5.QtGui as QtGui
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
@ -108,4 +109,4 @@ window.setCentralWidget(widget)
|
|||
window.setWindowTitle(f"UEngine 运行器 {version} 问题/建议反馈")
|
||||
window.setWindowIcon(QtGui.QIcon(iconPath))
|
||||
window.show()
|
||||
sys.exit(app.exec_())
|
||||
sys.exit(app.exec_())
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
import os
|
||||
import sys
|
||||
import traceback
|
||||
import updatekiller
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
########################
|
||||
#
|
||||
|
@ -69,4 +70,4 @@ try:
|
|||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.information(None, "错误", traceback.format_exc())
|
||||
sys.exit(2)
|
||||
sys.exit(2)
|
||||
|
|
|
@ -3,6 +3,7 @@ import os
|
|||
import sys
|
||||
import shutil
|
||||
import traceback
|
||||
import updatekiller
|
||||
|
||||
def Add():
|
||||
try:
|
||||
|
@ -41,4 +42,4 @@ if __name__ == "__main__":
|
|||
Del()
|
||||
sys.exit(0)
|
||||
print("参数错误!")
|
||||
sys.exit(1)
|
||||
sys.exit(1)
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
import atexit
|
||||
|
||||
PIDFILE = '/tmp/uengine-runner.pid'
|
||||
|
||||
#程序结束时清理pid
|
||||
@atexit.register
|
||||
def remove_pid():
|
||||
with open(PIDFILE) as pidfile:
|
||||
pidlst = pidfile.readlines()
|
||||
pidlst.remove(str(PID)+'\n')
|
||||
with open(PIDFILE,'w') as pidfile:
|
||||
pidfile.writelines(pidlst)
|
||||
|
||||
#更新时结束进程
|
||||
def main():
|
||||
for i in open(PIDFILE):
|
||||
try:
|
||||
os.kill(int(i),15)
|
||||
except ProcessLookupError:
|
||||
pass
|
||||
os.remove(PIDFILE)
|
||||
|
||||
#当该程序被直接执行时,执行结束进程操作。如果是导入的形式,则只是记录pid
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
else:
|
||||
#获取进程pid,用于更新时结束进程
|
||||
PID = os.getpid()
|
||||
with open(PIDFILE,'a') as pidfile:
|
||||
print(PID,file=pidfile) #使用print可以在行末输出换行符,而且可以省去类型转换
|
Loading…
Reference in New Issue