迁移 根据正确率选择题号

This commit is contained in:
weiye.wang 2024-04-25 20:41:50 +08:00
parent bf48ed8e1f
commit 9c4e38ed95
4 changed files with 439 additions and 1 deletions

View File

@ -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(760, 490)
self.verticalLayoutWidget = QWidget(widget)
self.verticalLayoutWidget.setObjectName(u"verticalLayoutWidget")
self.verticalLayoutWidget.setGeometry(QRect(180, 10, 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(280, 10, 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(380, 10, 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(480, 10, 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(180, 110, 54, 16))
self.plainTextEdit_ids = QPlainTextEdit(widget)
self.plainTextEdit_ids.setObjectName(u"plainTextEdit_ids")
self.plainTextEdit_ids.setGeometry(QRect(180, 130, 391, 81))
self.plainTextEdit_ids.setReadOnly(True)
self.label_7 = QLabel(widget)
self.label_7.setObjectName(u"label_7")
self.label_7.setGeometry(QRect(180, 220, 141, 16))
self.plainTextEdit_cautionids = QPlainTextEdit(widget)
self.plainTextEdit_cautionids.setObjectName(u"plainTextEdit_cautionids")
self.plainTextEdit_cautionids.setGeometry(QRect(180, 240, 391, 81))
self.plainTextEdit_cautionids.setReadOnly(True)
self.label_8 = QLabel(widget)
self.label_8.setObjectName(u"label_8")
self.label_8.setGeometry(QRect(180, 330, 54, 16))
self.plainTextEdit_subproblems = QPlainTextEdit(widget)
self.plainTextEdit_subproblems.setObjectName(u"plainTextEdit_subproblems")
self.plainTextEdit_subproblems.setGeometry(QRect(180, 350, 391, 111))
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

View File

@ -10,6 +10,7 @@ from 答题纸对应 import MyWindow_dtlr
from 获取题号 import MyWindow_hqth
from 单一题号转为图片 import MyWindow_sctp
from 指定题号编译pdf import MyWindow_xtby
from 根据正确率选择题号 import MyWindow_ndsx
from database_tools_2 import *
class MyWindow(QMainWindow,Ui_MainWindow):
@ -25,6 +26,10 @@ class MyWindow(QMainWindow,Ui_MainWindow):
self.pushButton_tiku.clicked.connect(self.SelectTIKU)
self.pushButton_tikutest.clicked.connect(self.SelectTIKUTEST) #以上为设置当前数据库的两个按钮
self.layout_ndsx = QVBoxLayout(self.tab_ndsx)
self.ndsx = MyWindow_ndsx(self.database)
self.layout_ndsx.addWidget(self.ndsx) #以上三行为初始化“选题编译”tab
self.layout_xtby = QVBoxLayout(self.tab_xtby)
self.xtby = MyWindow_xtby(self.database)
self.layout_xtby.addWidget(self.xtby) #以上三行为初始化“选题编译”tab
@ -67,7 +72,8 @@ class MyWindow(QMainWindow,Ui_MainWindow):
self.kxth.setdbname,
self.jysc.setdbname,
self.sctp.setdbname,
self.xtby.setdbname
self.xtby.setdbname,
self.ndsx.setdbname
]: #在列表中的tab里传送数据库名的连接
self.sendDBname.connect(func)
def sendValue(self):

View File

@ -0,0 +1,48 @@
from PySide6.QtWidgets import QWidget, QApplication, QFileDialog
from Ui_根据正确率选择题号 import Ui_widget
from database_tools_2 import *
class MyWindow_ndsx(QWidget,Ui_widget):
def __init__(self,database_name):
super().__init__()
self.database_name = database_name
self.setupUi(self)
self.bind()
def bind(self):
self.pushButton_exec.clicked.connect(self.exec)
def setdbname(self,string):
self.database_name = string
print(self.database_name)
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.database_name)
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()

View File

@ -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>760</width>
<height>490</height>
</rect>
</property>
<property name="windowTitle">
<string>根据正确率选择题号</string>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>180</x>
<y>10</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>280</x>
<y>10</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>380</x>
<y>10</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>480</x>
<y>10</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>180</x>
<y>110</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>180</x>
<y>130</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>180</x>
<y>220</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>180</x>
<y>240</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>180</x>
<y>330</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>180</x>
<y>350</y>
<width>391</width>
<height>111</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>