更新答题纸对应的赋分功能, 原赋分功能不变, 也可以从小闲平台上复制下来后直接获取

This commit is contained in:
weiye.wang 2024-03-03 21:11:28 +08:00
parent dfb2478045
commit c74464ee12
3 changed files with 72 additions and 34 deletions

View File

@ -16,62 +16,63 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QComboBox, QHBoxLayout, QLabel,
QLineEdit, QPushButton, QSizePolicy, QWidget)
QLineEdit, QPlainTextEdit, QPushButton, QSizePolicy,
QWidget)
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(399, 145)
Form.resize(399, 302)
self.label_2 = QLabel(Form)
self.label_2.setObjectName(u"label_2")
self.label_2.setGeometry(QRect(10, 50, 81, 16))
self.pushButton_exec = QPushButton(Form)
self.pushButton_exec.setObjectName(u"pushButton_exec")
self.pushButton_exec.setEnabled(False)
self.pushButton_exec.setGeometry(QRect(270, 100, 111, 24))
self.pushButton_exec.setGeometry(QRect(270, 100, 111, 191))
font = QFont()
font.setBold(True)
self.pushButton_exec.setFont(font)
self.widget = QWidget(Form)
self.widget.setObjectName(u"widget")
self.widget.setGeometry(QRect(10, 20, 371, 22))
self.horizontalLayout = QHBoxLayout(self.widget)
self.layoutWidget = QWidget(Form)
self.layoutWidget.setObjectName(u"layoutWidget")
self.layoutWidget.setGeometry(QRect(10, 20, 371, 22))
self.horizontalLayout = QHBoxLayout(self.layoutWidget)
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.label = QLabel(self.widget)
self.label = QLabel(self.layoutWidget)
self.label.setObjectName(u"label")
self.horizontalLayout.addWidget(self.label)
self.lineEdit_xiaoxianid = QLineEdit(self.widget)
self.lineEdit_xiaoxianid = QLineEdit(self.layoutWidget)
self.lineEdit_xiaoxianid.setObjectName(u"lineEdit_xiaoxianid")
self.horizontalLayout.addWidget(self.lineEdit_xiaoxianid)
self.widget1 = QWidget(Form)
self.widget1.setObjectName(u"widget1")
self.widget1.setGeometry(QRect(10, 70, 371, 23))
self.horizontalLayout_2 = QHBoxLayout(self.widget1)
self.layoutWidget1 = QWidget(Form)
self.layoutWidget1.setObjectName(u"layoutWidget1")
self.layoutWidget1.setGeometry(QRect(10, 70, 371, 23))
self.horizontalLayout_2 = QHBoxLayout(self.layoutWidget1)
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.label_3 = QLabel(self.widget1)
self.label_3 = QLabel(self.layoutWidget1)
self.label_3.setObjectName(u"label_3")
self.horizontalLayout_2.addWidget(self.label_3)
self.lineEdit_structure = QLineEdit(self.widget1)
self.lineEdit_structure = QLineEdit(self.layoutWidget1)
self.lineEdit_structure.setObjectName(u"lineEdit_structure")
self.lineEdit_structure.setMaximumSize(QSize(20, 16777215))
self.horizontalLayout_2.addWidget(self.lineEdit_structure)
self.label_4 = QLabel(self.widget1)
self.label_4 = QLabel(self.layoutWidget1)
self.label_4.setObjectName(u"label_4")
self.horizontalLayout_2.addWidget(self.label_4)
self.comboBox_grade = QComboBox(self.widget1)
self.comboBox_grade = QComboBox(self.layoutWidget1)
self.comboBox_grade.addItem("")
self.comboBox_grade.addItem("")
self.comboBox_grade.addItem("")
@ -84,12 +85,12 @@ class Ui_Form(object):
self.horizontalLayout_2.addWidget(self.comboBox_grade)
self.label_5 = QLabel(self.widget1)
self.label_5 = QLabel(self.layoutWidget1)
self.label_5.setObjectName(u"label_5")
self.horizontalLayout_2.addWidget(self.label_5)
self.comboBox_semester = QComboBox(self.widget1)
self.comboBox_semester = QComboBox(self.layoutWidget1)
self.comboBox_semester.addItem("")
self.comboBox_semester.addItem("")
self.comboBox_semester.addItem("")
@ -101,16 +102,22 @@ class Ui_Form(object):
self.horizontalLayout_2.addWidget(self.comboBox_semester)
self.label_6 = QLabel(self.widget1)
self.label_6 = QLabel(self.layoutWidget1)
self.label_6.setObjectName(u"label_6")
self.horizontalLayout_2.addWidget(self.label_6)
self.comboBox_index = QComboBox(self.widget1)
self.comboBox_index = QComboBox(self.layoutWidget1)
self.comboBox_index.setObjectName(u"comboBox_index")
self.horizontalLayout_2.addWidget(self.comboBox_index)
self.plainTextEdit_marks = QPlainTextEdit(Form)
self.plainTextEdit_marks.setObjectName(u"plainTextEdit_marks")
self.plainTextEdit_marks.setGeometry(QRect(10, 120, 251, 171))
self.label_7 = QLabel(Form)
self.label_7.setObjectName(u"label_7")
self.label_7.setGeometry(QRect(10, 100, 111, 16))
self.retranslateUi(Form)
@ -143,5 +150,7 @@ class Ui_Form(object):
self.comboBox_semester.setItemText(6, QCoreApplication.translate("Form", u"06", None))
self.label_6.setText(QCoreApplication.translate("Form", u"\u5e8f\u53f7", None))
self.plainTextEdit_marks.setPlaceholderText(QCoreApplication.translate("Form", u"\u5c06\u5c0f\u95f2\u5e73\u53f0\u7b54\u9898\u7eb8 \u4fee\u6539 \u754c\u9762\u4e2d\u95f4\u9760\u53f3\u7684\u6240\u6709\u5206\u6570\u590d\u5236\u5230\u8be5\u6587\u672c\u6846, \u7559\u7a7a\u8868\u793a\u5747\u4e3a1\u5206", None))
self.label_7.setText(QCoreApplication.translate("Form", u"\u5c0f\u95f2\u5e73\u53f0\u5404\u9898\u6ee1\u5206", None))
# retranslateUi

View File

@ -47,6 +47,7 @@ class MyWindow(QWidget,Ui_Form):
pid = f"{self.structure}{self.grade}{self.semester}{self.comboBox_index.currentText()}"
answersheetjson = f"../备课组/{self.grade[-2:]}届/答题纸对应.json"
notesjson = f"../备课组/{self.grade[-2:]}届/校本材料.json"
marks_list = re.findall(r"(?:(?:^)|(?:\n))(\d+)分",self.plainTextEdit_marks.toPlainText())
answersheet_dict = load_dict(answersheetjson)
notes_dict = load_dict(notesjson)
@ -87,7 +88,7 @@ class MyWindow(QWidget,Ui_Form):
for i in parts_selected_index:
parts_selected.append(partslist[int(i)-1])
new_dict["parts"] = parts_selected.copy()
if marks_list == []:
marksflag = input("是否为每个结果赋分(Y/N):")
if marksflag[0].upper() == "Y":
new_dict["marks"] = []
@ -97,6 +98,8 @@ class MyWindow(QWidget,Ui_Form):
new_dict["marks"].append(int(mark))
count += 1
mark = input(f"依次输入分数, 非自然数作为结束(第 {count} 个位置):")
else:
new_dict["marks"] = marks_list.copy()
answersheet_dict[self.lineEdit_xiaoxianid.text()] = new_dict.copy()

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>399</width>
<height>145</height>
<height>302</height>
</rect>
</property>
<property name="windowTitle">
@ -35,7 +35,7 @@
<x>270</x>
<y>100</y>
<width>111</width>
<height>24</height>
<height>191</height>
</rect>
</property>
<property name="font">
@ -47,7 +47,7 @@
<string>添加答题纸对应</string>
</property>
</widget>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
@ -69,7 +69,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
@ -205,6 +205,32 @@
</item>
</layout>
</widget>
<widget class="QPlainTextEdit" name="plainTextEdit_marks">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>251</width>
<height>171</height>
</rect>
</property>
<property name="placeholderText">
<string>将小闲平台答题纸 修改 界面中间靠右的所有分数复制到该文本框, 留空表示均为1分</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>小闲平台各题满分</string>
</property>
</widget>
</widget>
<resources/>
<connections/>