修复'添加UEngine应用快捷方式出现问题'的问题
This commit is contained in:
parent
daa42d637c
commit
474babff87
|
@ -1386,18 +1386,18 @@ class AddNewUengineDesktopLink():
|
||||||
# 添加快捷方式
|
# 添加快捷方式
|
||||||
def SaveDesktopLink():
|
def SaveDesktopLink():
|
||||||
try:
|
try:
|
||||||
if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
|
if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.text())):
|
||||||
if QtWidgets.QMessageBox.question(widget, "提示", "文件已存在,是否要覆盖?") == QtWidgets.QMessageBox.No:
|
if QtWidgets.QMessageBox.question(widget, "提示", "文件已存在,是否要覆盖?") == QtWidgets.QMessageBox.No:
|
||||||
return
|
return
|
||||||
if not os.path.exists("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home())):
|
if not os.path.exists("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home())):
|
||||||
os.makedirs("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home()))
|
os.makedirs("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home()))
|
||||||
global activityName
|
global activityName
|
||||||
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), packageName.get())
|
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), packageName.text())
|
||||||
shutil.copy(programPath + "/defult.png", iconSavePath)
|
shutil.copy(programPath + "/defult.png", iconSavePath)
|
||||||
BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath,
|
BuildUengineDesktop(packageName.text(), activityName, packageName.text(), iconSavePath,
|
||||||
"{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get()))
|
"{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.text()))
|
||||||
BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath,
|
BuildUengineDesktop(packageName.text(), activityName, packageName.text(), iconSavePath,
|
||||||
"{}/{}.desktop".format(get_desktop_path(), packageName.get()))
|
"{}/{}.desktop".format(get_desktop_path(), packageName.text()))
|
||||||
AddNewUengineDesktopLink.SaveHistory()
|
AddNewUengineDesktopLink.SaveHistory()
|
||||||
QtWidgets.QMessageBox.information(widget, "提示", "创建完毕!")
|
QtWidgets.QMessageBox.information(widget, "提示", "创建完毕!")
|
||||||
except:
|
except:
|
||||||
|
@ -1409,13 +1409,13 @@ class AddNewUengineDesktopLink():
|
||||||
def DelDesktopLink():
|
def DelDesktopLink():
|
||||||
try:
|
try:
|
||||||
global packageName
|
global packageName
|
||||||
if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
|
if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.text())):
|
||||||
QtWidgets.QMessageBox.critical(widget, "错误", "此包名对应的 UEngine 桌面快捷方式不存在!")
|
QtWidgets.QMessageBox.critical(widget, "错误", "此包名对应的 UEngine 桌面快捷方式不存在!")
|
||||||
return
|
return
|
||||||
if QtWidgets.QMessageBox.warning(widget, "警告", "你确定要删除吗?删除后将无法恢复!", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Cancel) == QtWidgets.QMessageBox.Cancel:
|
if QtWidgets.QMessageBox.warning(widget, "警告", "你确定要删除吗?删除后将无法恢复!", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Cancel) == QtWidgets.QMessageBox.Cancel:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
os.remove("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get()))
|
os.remove("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.text()))
|
||||||
AddNewUengineDesktopLink.SaveHistory()
|
AddNewUengineDesktopLink.SaveHistory()
|
||||||
QtWidgets.QMessageBox.information(widget, "提示", "已删除")
|
QtWidgets.QMessageBox.information(widget, "提示", "已删除")
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in New Issue