From 4a095393d82504d3e9f6ff354f38f5ffc99704b6 Mon Sep 17 00:00:00 2001
From: gfdgd_xi <3025613752@qq.com>
Date: Sun, 23 Oct 2022 22:19:23 +0800
Subject: [PATCH] =?UTF-8?q?=E2=80=BB7=E3=80=81=E5=AE=B9=E5=99=A8=E8=87=AA?=
=?UTF-8?q?=E5=8A=A8=E9=85=8D=E7=BD=AE=E8=84=9A=E6=9C=AC=E6=94=AF=E6=8C=81?=
=?UTF-8?q?=E8=AF=84=E5=88=86=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
AutoConfig.py | 129 +++++++++++++++++++++++
UI/AutoConfig.py | 10 +-
UI/AutoConfig.ui | 16 ++-
UI/__pycache__/AutoConfig.cpython-37.pyc | Bin 2536 -> 2765 bytes
mainwindow.py | 1 +
5 files changed, 154 insertions(+), 2 deletions(-)
diff --git a/AutoConfig.py b/AutoConfig.py
index a908704..021290a 100755
--- a/AutoConfig.py
+++ b/AutoConfig.py
@@ -10,6 +10,7 @@
#################
# 引入所需的库
#################
+from fileinput import filename
import os
import sys
import json
@@ -21,6 +22,131 @@ from Model import *
urlSources = "https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/auto"
lists = []
+class ProgramRunStatusUpload():
+ msgWindow = None
+ starLayout = None
+ fen = None
+ starList = []
+ sha1Value = ""
+ programName = None
+ def ChangeStar():
+ if ProgramRunStatusUpload.fen.currentIndex() > 5:
+ for i in ProgramRunStatusUpload.starList:
+ i.setText(f"")
+ return
+ for i in range(ProgramRunStatusUpload.fen.currentIndex()):
+ ProgramRunStatusUpload.starList[i].setText(f"")
+ head = ProgramRunStatusUpload.fen.currentIndex()
+ end = len(ProgramRunStatusUpload.starList)
+ for i in range(head, end):
+ ProgramRunStatusUpload.starList[i].setText(f"")
+
+ def ShowWindow(sha="", title=""):
+ ProgramRunStatusUpload.starList = []
+ ProgramRunStatusUpload.sha1Value = sha
+ ProgramRunStatusUpload.msgWindow = QtWidgets.QMainWindow()
+ msgWidget = QtWidgets.QWidget()
+ msgWidgetLayout = QtWidgets.QGridLayout()
+ ProgramRunStatusUpload.programName = QtWidgets.QLineEdit()
+ ProgramRunStatusUpload.fen = QtWidgets.QComboBox()
+ ProgramRunStatusUpload.starLayout = QtWidgets.QHBoxLayout()
+ upload = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "上传"))
+ upload.clicked.connect(ProgramRunStatusUpload.Upload)
+ if title != "":
+ ProgramRunStatusUpload.programName.setText(title)
+ ProgramRunStatusUpload.programName.setDisabled(True)
+ # 生成星星列表
+ for i in [1, 1, 1, 1, 0]:
+ ProgramRunStatusUpload.starList.append(QtWidgets.QLabel(f""))
+ ProgramRunStatusUpload.starLayout.addWidget(ProgramRunStatusUpload.starList[-1])
+ ProgramRunStatusUpload.starLayout.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum))
+ ProgramRunStatusUpload.programName.setPlaceholderText(QtCore.QCoreApplication.translate("U", "如果这个程序和程序名确实是合法还是检测到敏感词,改为“NULL”即可"))
+ ProgramRunStatusUpload.fen.addItems(["0分",
+ "1分",
+ "2分",
+ "3分",
+ "4分",
+ "5分"])
+ ProgramRunStatusUpload.fen.setCurrentIndex(4)
+ ProgramRunStatusUpload.fen.currentIndexChanged.connect(ProgramRunStatusUpload.ChangeStar)
+ msgWidgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "程序名:")), 0, 0)
+ msgWidgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "评分:")), 1, 0)
+ msgWidgetLayout.addWidget(ProgramRunStatusUpload.programName, 0, 1)
+ msgWidgetLayout.addWidget(ProgramRunStatusUpload.fen, 1, 1)
+ msgWidgetLayout.addLayout(ProgramRunStatusUpload.starLayout, 2, 1)
+ msgWidgetLayout.addWidget(upload, 3, 1)
+ msgWidget.setLayout(msgWidgetLayout)
+ ProgramRunStatusUpload.msgWindow.setCentralWidget(msgWidget)
+ ProgramRunStatusUpload.msgWindow.setWindowTitle(QtCore.QCoreApplication.translate("U", "上传程序运行情况"))
+ ProgramRunStatusUpload.msgWindow.setWindowIcon(QtGui.QIcon(iconPath))
+ ProgramRunStatusUpload.msgWindow.show()
+
+ def Upload():
+ try:
+ #if ProgramRunStatusUpload.sha1Value == "":
+ #ProgramRunStatusUpload.sha1Value = ProgramRunStatusUpload.GetSHA1(e2.currentText())
+ QtWidgets.QMessageBox.information(None, QtCore.QCoreApplication.translate("U", "提示"), json.loads(requests.post("http://120.25.153.144:30250/bash", {
+ "BashName": ProgramRunStatusUpload.programName.text(),
+ "Fen": ProgramRunStatusUpload.fen.currentIndex()
+ }).text)["Error"])
+ except:
+ traceback.print_exc()
+ QtWidgets.QMessageBox.critical(None, QtCore.QCoreApplication.translate("U", "错误"), QtCore.QCoreApplication.translate("U", "数据上传失败!"))
+
+class ProgramRunStatusShow():
+ msgWindow = None
+ def ShowWindow():
+ global lists
+ # 获取选中项
+ try:
+ choose = ui.searchList.selectionModel().selectedIndexes()[0].data()
+ except:
+ QtWidgets.QMessageBox.critical(window, "错误", "您未选择任何配置文件")
+ return
+ fileName = ""
+ for i in lists:
+ print(i)
+ if i[0] == choose:
+ fileName = i[1]
+ break
+ try:
+ fenlists = requests.get(f"http://120.25.153.144/spark-deepin-wine-runner/bashapp/{fileName}/all.json").json()
+ #r = requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9hcHAv").decode("utf-8") + sha + base64.b64decode("L3RpdGxlLnR4dA==").decode("utf-8"))
+ #r.encoding = "utf-8"
+ #title = r.text
+ tipsInfo = ""
+ except:
+ #traceback.print_exc()
+ fenlists = [0, 0, 0, 0, 0]
+ tipsInfo = "暂时无人提交此脚本运行情况,是否立即提交?"
+
+ maxHead = fenlists.index(max(fenlists))
+ ProgramRunStatusShow.msgWindow = QtWidgets.QMainWindow()
+ msgWidget = QtWidgets.QWidget()
+ msgWidgetLayout = QtWidgets.QGridLayout()
+ starLayout = QtWidgets.QHBoxLayout()
+ uploadButton = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "点此上传运行情况"))
+ uploadButton.clicked.connect(lambda: ProgramRunStatusUpload.ShowWindow(fileName, fileName))
+ msgWidgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "综合评价:")), 0, 0)
+ msgWidgetLayout.addLayout(starLayout, 0, 1)
+ msgWidgetLayout.addWidget(QtWidgets.QLabel(tipsInfo), 1, 0, 1, 2)
+ #msgWidgetLayout.addWidget(QtWidgets.QLabel("" if dateVersion == "" else f"数据版本:{dateVersion}"), 2, 0, 1, 2)
+ msgWidgetLayout.addWidget(uploadButton, 3, 0, 1, 2)
+ end = 5
+ if maxHead > 5:
+ for i in range(end):
+ starLayout.addWidget(QtWidgets.QLabel(f""))
+ else:
+ for i in range(maxHead):
+ starLayout.addWidget(QtWidgets.QLabel(f""))
+ head = maxHead
+ for i in range(head, end):
+ starLayout.addWidget(QtWidgets.QLabel(f""))
+ msgWidget.setLayout(msgWidgetLayout)
+ ProgramRunStatusShow.msgWindow.setCentralWidget(msgWidget)
+ ProgramRunStatusShow.msgWindow.setWindowIcon(QtGui.QIcon(iconPath))
+ #ProgramRunStatusShow.msgWindow.setWindowTitle(f"应用“{title}”的运行情况")
+ ProgramRunStatusShow.msgWindow.show()
class Connect:
def SearchBotton_Clicked():
@@ -119,12 +245,14 @@ if __name__ == "__main__":
ui.setupUi(window)
window.setWindowTitle(f"Wine 运行器 {version}——容器自动配置部署脚本")
window.setWindowIcon(QtGui.QIcon(f"{programPath}/deepin-wine-runner.svg"))
+ iconPath = "{}/deepin-wine-runner.svg".format(programPath)
window.show()
# 连接信号和槽
ui.saerchBotton.clicked.connect(Connect.SearchBotton_Clicked)
ui.runBotton.clicked.connect(Connect.RunBotton_Clicked)
ui.openFile.triggered.connect(Connect.OpenFile_Triggered)
ui.exitProgram.triggered.connect(window.close)
+ ui.getFen.clicked.connect(ProgramRunStatusShow.ShowWindow)
# 解析云列表
try:
# 获取列表
@@ -137,4 +265,5 @@ if __name__ == "__main__":
except:
traceback.print_exc()
QtWidgets.QMessageBox.critical(window, "提示", "无法连接服务器")
+
app.exec_()
\ No newline at end of file
diff --git a/UI/AutoConfig.py b/UI/AutoConfig.py
index 1418666..159b556 100644
--- a/UI/AutoConfig.py
+++ b/UI/AutoConfig.py
@@ -35,13 +35,19 @@ class Ui_MainWindow(object):
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
+ self.getFen = QtWidgets.QPushButton(self.centralwidget)
+ self.getFen.setObjectName("getFen")
+ self.horizontalLayout_2.addWidget(self.getFen)
+ self.uploadFen = QtWidgets.QPushButton(self.centralwidget)
+ self.uploadFen.setObjectName("uploadFen")
+ self.horizontalLayout_2.addWidget(self.uploadFen)
self.runBotton = QtWidgets.QPushButton(self.centralwidget)
self.runBotton.setObjectName("runBotton")
self.horizontalLayout_2.addWidget(self.runBotton)
self.verticalLayout_3.addLayout(self.horizontalLayout_2)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
- self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 36))
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 33))
self.menubar.setObjectName("menubar")
self.menu = QtWidgets.QMenu(self.menubar)
self.menu.setObjectName("menu")
@@ -67,6 +73,8 @@ class Ui_MainWindow(object):
MainWindow.setWindowTitle(_translate("MainWindow", "自动部署脚本"))
self.searchTips.setText(_translate("MainWindow", "搜索内容(为空代表显示所有内容):"))
self.saerchBotton.setText(_translate("MainWindow", "搜索"))
+ self.getFen.setText(_translate("MainWindow", "获取选中项的评分"))
+ self.uploadFen.setText(_translate("MainWindow", "提交选中项的评分"))
self.runBotton.setText(_translate("MainWindow", "部署此方案"))
self.menu.setTitle(_translate("MainWindow", "程序"))
self.about.setText(_translate("MainWindow", "关于"))
diff --git a/UI/AutoConfig.ui b/UI/AutoConfig.ui
index 7b0ae10..f92ff37 100644
--- a/UI/AutoConfig.ui
+++ b/UI/AutoConfig.ui
@@ -54,6 +54,20 @@
+ -
+
+
+ 获取选中项的评分
+
+
+
+ -
+
+
+ 提交选中项的评分
+
+
+
-
@@ -71,7 +85,7 @@
0
0
800
- 36
+ 33