完成根据正确率选择题号面板
This commit is contained in:
parent
c548e4a2c2
commit
3d262909c3
|
|
@ -0,0 +1,148 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
################################################################################
|
||||
## Form generated from reading UI file '根据正确率选择题号.ui'
|
||||
##
|
||||
## Created by: Qt User Interface Compiler version 6.6.2
|
||||
##
|
||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
################################################################################
|
||||
|
||||
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
|
||||
QMetaObject, QObject, QPoint, QRect,
|
||||
QSize, QTime, QUrl, Qt)
|
||||
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
||||
QFont, QFontDatabase, QGradient, QIcon,
|
||||
QImage, QKeySequence, QLinearGradient, QPainter,
|
||||
QPalette, QPixmap, QRadialGradient, QTransform)
|
||||
from PySide6.QtWidgets import (QApplication, QLabel, QLineEdit, QPlainTextEdit,
|
||||
QPushButton, QSizePolicy, QVBoxLayout, QWidget)
|
||||
|
||||
class Ui_widget(object):
|
||||
def setupUi(self, widget):
|
||||
if not widget.objectName():
|
||||
widget.setObjectName(u"widget")
|
||||
widget.resize(411, 507)
|
||||
self.verticalLayoutWidget = QWidget(widget)
|
||||
self.verticalLayoutWidget.setObjectName(u"verticalLayoutWidget")
|
||||
self.verticalLayoutWidget.setGeometry(QRect(10, 20, 91, 92))
|
||||
self.verticalLayout = QVBoxLayout(self.verticalLayoutWidget)
|
||||
self.verticalLayout.setObjectName(u"verticalLayout")
|
||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.label = QLabel(self.verticalLayoutWidget)
|
||||
self.label.setObjectName(u"label")
|
||||
|
||||
self.verticalLayout.addWidget(self.label)
|
||||
|
||||
self.lineEdit_startdate = QLineEdit(self.verticalLayoutWidget)
|
||||
self.lineEdit_startdate.setObjectName(u"lineEdit_startdate")
|
||||
|
||||
self.verticalLayout.addWidget(self.lineEdit_startdate)
|
||||
|
||||
self.label_2 = QLabel(self.verticalLayoutWidget)
|
||||
self.label_2.setObjectName(u"label_2")
|
||||
|
||||
self.verticalLayout.addWidget(self.label_2)
|
||||
|
||||
self.lineEdit_enddate = QLineEdit(self.verticalLayoutWidget)
|
||||
self.lineEdit_enddate.setObjectName(u"lineEdit_enddate")
|
||||
|
||||
self.verticalLayout.addWidget(self.lineEdit_enddate)
|
||||
|
||||
self.verticalLayoutWidget_2 = QWidget(widget)
|
||||
self.verticalLayoutWidget_2.setObjectName(u"verticalLayoutWidget_2")
|
||||
self.verticalLayoutWidget_2.setGeometry(QRect(110, 20, 91, 92))
|
||||
self.verticalLayout_2 = QVBoxLayout(self.verticalLayoutWidget_2)
|
||||
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
|
||||
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.label_3 = QLabel(self.verticalLayoutWidget_2)
|
||||
self.label_3.setObjectName(u"label_3")
|
||||
|
||||
self.verticalLayout_2.addWidget(self.label_3)
|
||||
|
||||
self.lineEdit_lowerbound = QLineEdit(self.verticalLayoutWidget_2)
|
||||
self.lineEdit_lowerbound.setObjectName(u"lineEdit_lowerbound")
|
||||
|
||||
self.verticalLayout_2.addWidget(self.lineEdit_lowerbound)
|
||||
|
||||
self.label_4 = QLabel(self.verticalLayoutWidget_2)
|
||||
self.label_4.setObjectName(u"label_4")
|
||||
|
||||
self.verticalLayout_2.addWidget(self.label_4)
|
||||
|
||||
self.lineEdit_upperbound = QLineEdit(self.verticalLayoutWidget_2)
|
||||
self.lineEdit_upperbound.setObjectName(u"lineEdit_upperbound")
|
||||
|
||||
self.verticalLayout_2.addWidget(self.lineEdit_upperbound)
|
||||
|
||||
self.verticalLayoutWidget_3 = QWidget(widget)
|
||||
self.verticalLayoutWidget_3.setObjectName(u"verticalLayoutWidget_3")
|
||||
self.verticalLayoutWidget_3.setGeometry(QRect(210, 20, 91, 92))
|
||||
self.verticalLayout_3 = QVBoxLayout(self.verticalLayoutWidget_3)
|
||||
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
|
||||
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||
self.label_5 = QLabel(self.verticalLayoutWidget_3)
|
||||
self.label_5.setObjectName(u"label_5")
|
||||
self.label_5.setMaximumSize(QSize(16777215, 20))
|
||||
|
||||
self.verticalLayout_3.addWidget(self.label_5)
|
||||
|
||||
self.lineEdit_classregex = QLineEdit(self.verticalLayoutWidget_3)
|
||||
self.lineEdit_classregex.setObjectName(u"lineEdit_classregex")
|
||||
|
||||
self.verticalLayout_3.addWidget(self.lineEdit_classregex)
|
||||
|
||||
self.pushButton_exec = QPushButton(widget)
|
||||
self.pushButton_exec.setObjectName(u"pushButton_exec")
|
||||
self.pushButton_exec.setGeometry(QRect(310, 20, 91, 91))
|
||||
font = QFont()
|
||||
font.setBold(True)
|
||||
self.pushButton_exec.setFont(font)
|
||||
self.label_6 = QLabel(widget)
|
||||
self.label_6.setObjectName(u"label_6")
|
||||
self.label_6.setGeometry(QRect(10, 120, 54, 16))
|
||||
self.plainTextEdit_ids = QPlainTextEdit(widget)
|
||||
self.plainTextEdit_ids.setObjectName(u"plainTextEdit_ids")
|
||||
self.plainTextEdit_ids.setGeometry(QRect(10, 140, 391, 81))
|
||||
self.plainTextEdit_ids.setReadOnly(True)
|
||||
self.label_7 = QLabel(widget)
|
||||
self.label_7.setObjectName(u"label_7")
|
||||
self.label_7.setGeometry(QRect(10, 230, 141, 16))
|
||||
self.plainTextEdit_cautionids = QPlainTextEdit(widget)
|
||||
self.plainTextEdit_cautionids.setObjectName(u"plainTextEdit_cautionids")
|
||||
self.plainTextEdit_cautionids.setGeometry(QRect(10, 250, 391, 81))
|
||||
self.plainTextEdit_cautionids.setReadOnly(True)
|
||||
self.label_8 = QLabel(widget)
|
||||
self.label_8.setObjectName(u"label_8")
|
||||
self.label_8.setGeometry(QRect(10, 340, 54, 16))
|
||||
self.plainTextEdit_subproblems = QPlainTextEdit(widget)
|
||||
self.plainTextEdit_subproblems.setObjectName(u"plainTextEdit_subproblems")
|
||||
self.plainTextEdit_subproblems.setGeometry(QRect(10, 360, 391, 131))
|
||||
self.plainTextEdit_subproblems.setReadOnly(True)
|
||||
|
||||
self.retranslateUi(widget)
|
||||
|
||||
QMetaObject.connectSlotsByName(widget)
|
||||
# setupUi
|
||||
|
||||
def retranslateUi(self, widget):
|
||||
widget.setWindowTitle(QCoreApplication.translate("widget", u"\u6839\u636e\u6b63\u786e\u7387\u9009\u62e9\u9898\u53f7", None))
|
||||
self.label.setText(QCoreApplication.translate("widget", u"\u8d77\u59cb\u65e5\u671f", None))
|
||||
self.lineEdit_startdate.setPlaceholderText(QCoreApplication.translate("widget", u"yyyymmdd", None))
|
||||
self.label_2.setText(QCoreApplication.translate("widget", u"\u7ec8\u6b62\u65e5\u671f", None))
|
||||
self.lineEdit_enddate.setText("")
|
||||
self.lineEdit_enddate.setPlaceholderText(QCoreApplication.translate("widget", u"yyyymmdd", None))
|
||||
self.label_3.setText(QCoreApplication.translate("widget", u"\u6b63\u786e\u7387\u4e0b\u754c", None))
|
||||
self.lineEdit_lowerbound.setPlaceholderText(QCoreApplication.translate("widget", u"\u5982: 0.5", None))
|
||||
self.label_4.setText(QCoreApplication.translate("widget", u"\u6b63\u786e\u7387\u4e0a\u754c", None))
|
||||
self.lineEdit_upperbound.setText("")
|
||||
self.lineEdit_upperbound.setPlaceholderText(QCoreApplication.translate("widget", u"\u5982: 0.73", None))
|
||||
self.label_5.setText(QCoreApplication.translate("widget", u"\u73ed\u7ea7\u6b63\u5219\u8868\u8fbe\u5f0f", None))
|
||||
self.lineEdit_classregex.setText("")
|
||||
self.lineEdit_classregex.setPlaceholderText(QCoreApplication.translate("widget", u"\u5982: 2026", None))
|
||||
self.pushButton_exec.setText(QCoreApplication.translate("widget", u"\u751f\u6210\u5217\u8868", None))
|
||||
self.label_6.setText(QCoreApplication.translate("widget", u"\u9898\u53f7", None))
|
||||
self.label_7.setText(QCoreApplication.translate("widget", u"\u4f7f\u7528\u8bb0\u5f55\u957f\u5ea6\u4e0d\u4e00\u81f4\u9898\u53f7", None))
|
||||
self.label_8.setText(QCoreApplication.translate("widget", u"\u5173\u6ce8\u5c0f\u9898", None))
|
||||
# retranslateUi
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
from PySide6.QtWidgets import QWidget, QApplication, QFileDialog
|
||||
from Ui_根据正确率选择题号 import Ui_widget
|
||||
from database_tools import *
|
||||
|
||||
class MyWindow(QWidget,Ui_widget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
self.bind()
|
||||
|
||||
def bind(self):
|
||||
self.pro_dict = load_dict("../题库0.3/Problems.json")
|
||||
self.pushButton_exec.clicked.connect(self.exec)
|
||||
|
||||
|
||||
def exec(self):
|
||||
startdate = self.lineEdit_startdate.text()
|
||||
enddate = self.lineEdit_enddate.text()
|
||||
interval = [float(self.lineEdit_lowerbound.text()),float(self.lineEdit_upperbound.text())]
|
||||
classregex = self.lineEdit_classregex.text()
|
||||
chosendict,cautionlist,usedlist = ChooseIDsByUsageInterval(startdate,enddate,interval,classregex,self.pro_dict)
|
||||
self.plainTextEdit_ids.setPlainText(generate_exp(list(chosendict.keys())))
|
||||
self.plainTextEdit_cautionids.setPlainText(generate_exp(cautionlist))
|
||||
subp_output = ""
|
||||
for id in chosendict.keys():
|
||||
if chosendict[id] != []:
|
||||
subp_output += f"题号 {id}: "
|
||||
for s in chosendict[id]:
|
||||
subp_output += f"第 ({s}) 小题 "
|
||||
subp_output += "\n"
|
||||
self.plainTextEdit_subproblems.setPlainText(subp_output)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication([])
|
||||
windows = MyWindow()
|
||||
windows.show()
|
||||
app.exec()
|
||||
|
||||
|
|
@ -0,0 +1,236 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>widget</class>
|
||||
<widget class="QWidget" name="widget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>411</width>
|
||||
<height>507</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>根据正确率选择题号</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="verticalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>91</width>
|
||||
<height>92</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>起始日期</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_startdate">
|
||||
<property name="placeholderText">
|
||||
<string>yyyymmdd</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>终止日期</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_enddate">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>yyyymmdd</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="verticalLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>20</y>
|
||||
<width>91</width>
|
||||
<height>92</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>正确率下界</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_lowerbound">
|
||||
<property name="placeholderText">
|
||||
<string>如: 0.5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>正确率上界</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_upperbound">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>如: 0.73</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="verticalLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>20</y>
|
||||
<width>91</width>
|
||||
<height>92</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>班级正则表达式</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_classregex">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>如: 2026</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_exec">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>20</y>
|
||||
<width>91</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>生成列表</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>120</y>
|
||||
<width>54</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>题号</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit_ids">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>391</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>230</y>
|
||||
<width>141</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>使用记录长度不一致题号</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit_cautionids">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>250</y>
|
||||
<width>391</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>340</y>
|
||||
<width>54</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>关注小题</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit_subproblems">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>360</y>
|
||||
<width>391</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue