优化
This commit is contained in:
@@ -1,7 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
||||
def RunProgram():
|
||||
window.hide()
|
||||
if os.system("which gx-env-run"):
|
||||
QtWidgets.QMessageBox.critical(window, "错误", "gx-env-run 不存在!")
|
||||
return
|
||||
if runProgramWithRoot.isChecked():
|
||||
if os.getenv("HOME") + "/.config/gx-env/bwrap":
|
||||
envDist = os.environ
|
||||
envSet = "DISPLAY=$DISPLAY "
|
||||
for i in envDist:
|
||||
envSet += "{}=${} ".format(i, i)
|
||||
os.system("pkexec env " + envSet + " gx-env-run " + programPath.text())
|
||||
return
|
||||
else:
|
||||
os.system("gx-env-run-root " + programPath.text())
|
||||
return
|
||||
os.system("gx-env-run " + programPath.text())
|
||||
sys.exit(0)
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
window = QtWidgets.QMainWindow()
|
||||
widget = QtWidgets.QWidget()
|
||||
@@ -18,6 +38,7 @@ layout.addWidget(programPath, 1, 1, 1, 3)
|
||||
controlLayout = QtWidgets.QHBoxLayout()
|
||||
cancelButton = QtWidgets.QPushButton("取消")
|
||||
okButton = QtWidgets.QPushButton("确定")
|
||||
okButton.clicked.connect(RunProgram)
|
||||
controlLayout.addWidget(runProgramWithRoot)
|
||||
controlLayout.addWidget(browser)
|
||||
controlLayout.addWidget(cancelButton)
|
||||
|
||||
Reference in New Issue
Block a user