diff --git a/工具v4/Ui_排序材料内难度.py b/工具v4/Ui_排序材料内难度.py new file mode 100644 index 00000000..4e0d224c --- /dev/null +++ b/工具v4/Ui_排序材料内难度.py @@ -0,0 +1,62 @@ +# -*- 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, QTextBrowser, QWidget) + +class Ui_Form(object): + def setupUi(self, Form): + if not Form.objectName(): + Form.setObjectName(u"Form") + Form.resize(758, 479) + self.pushButton_selectfilepath = QPushButton(Form) + self.pushButton_selectfilepath.setObjectName(u"pushButton_selectfilepath") + self.pushButton_selectfilepath.setGeometry(QRect(20, 20, 91, 24)) + self.lineEdit_filepath = QLineEdit(Form) + self.lineEdit_filepath.setObjectName(u"lineEdit_filepath") + self.lineEdit_filepath.setGeometry(QRect(20, 50, 341, 20)) + self.textBrowser_result = QTextBrowser(Form) + self.textBrowser_result.setObjectName(u"textBrowser_result") + self.textBrowser_result.setGeometry(QRect(380, 80, 361, 381)) + self.pushButton_exec = QPushButton(Form) + self.pushButton_exec.setObjectName(u"pushButton_exec") + self.pushButton_exec.setGeometry(QRect(510, 20, 231, 51)) + font = QFont() + font.setBold(True) + self.pushButton_exec.setFont(font) + self.label = QLabel(Form) + self.label.setObjectName(u"label") + self.label.setGeometry(QRect(380, 30, 141, 16)) + self.lineEdit_classregex = QLineEdit(Form) + self.lineEdit_classregex.setObjectName(u"lineEdit_classregex") + self.lineEdit_classregex.setGeometry(QRect(380, 50, 113, 20)) + self.plainTextEdit_idexp = QPlainTextEdit(Form) + self.plainTextEdit_idexp.setObjectName(u"plainTextEdit_idexp") + self.plainTextEdit_idexp.setGeometry(QRect(20, 80, 341, 381)) + + self.retranslateUi(Form) + + QMetaObject.connectSlotsByName(Form) + # setupUi + + def retranslateUi(self, Form): + Form.setWindowTitle(QCoreApplication.translate("Form", u"\u6392\u5e8f\u6750\u6599\u5185\u96be\u5ea6", None)) + self.pushButton_selectfilepath.setText(QCoreApplication.translate("Form", u"TeX\u6587\u4ef6\u8def\u5f84", None)) + self.pushButton_exec.setText(QCoreApplication.translate("Form", u"\u6392\u5e8f\u96be\u5ea6\u6570\u636e", None)) + self.label.setText(QCoreApplication.translate("Form", u"\u5c4a\u522b(\u73ed\u7ea7)regex", None)) + # retranslateUi + diff --git a/工具v4/排序材料内难度.py b/工具v4/排序材料内难度.py new file mode 100644 index 00000000..ead8eb55 --- /dev/null +++ b/工具v4/排序材料内难度.py @@ -0,0 +1,89 @@ +from PySide6.QtWidgets import QWidget, QApplication, QFileDialog +from Ui_排序材料内难度 import Ui_Form +from database_tools_2 import * + +class MyWindow_pxnd(QWidget,Ui_Form): + def __init__(self,database_name): + super().__init__() + self.database_name = database_name + self.setupUi(self) + self.bind() + + def setdbname(self,string): + self.database_name = string + # print(self.database_name) + + def bind(self): + self.pushButton_selectfilepath.clicked.connect(self.choosefile) + self.pushButton_exec.clicked.connect(self.exec) + self.lineEdit_filepath.setText(r"C:\Users\wangweiye\Documents\wwy sync\26届\高一第二学期\周末卷\W20260207高一下学期周末卷07.tex") # to remove + self.lineEdit_classregex.setText(r"2026届高一1\d班") # to remove + + + def choosefile(self): + self.texfile = QFileDialog.getOpenFileName(self,"选择.tex文件",os.getcwd(),".tex文件(*.tex);;所有文件(*)")[0] + self.lineEdit_filepath.setText(self.texfile) + + + + + def exec(self): + # self.latex_data = ReadTextFile(self.lineEdit_filepath.text()) + self.raw_idlist = ExportIDList(self.lineEdit_filepath.text()) + self.raw_parts_and_idlist = ExtractIDList(self.lineEdit_filepath.text()) + self.raw_idparts = {} + part_ind = 0 + for index,id in self.raw_parts_and_idlist: + if index == 1: + part_ind += 1 + self.raw_idparts[f"第{part_ind}部分"] = {} + self.raw_idparts[f"第{part_ind}部分"][index] = id + print(self.raw_idparts) + outputleft = f"原来材料各板块的题号:\n{self.raw_idlist}" + + mydb = connect(hostname = db_host, port = db_port, username = db_user, pwd = db_pwd, db = self.database_name) + mycursor = mydb.cursor() + pro_dict,obj_dict,bn_dict,unit_obj_dict = generateDictsfromMariaDB(mycursor) + mydb.close() + classregex = self.lineEdit_classregex.text() + for id in tqdm.tqdm(pro_dict, desc = "筛选有效使用记录中:"): + pro_dict[id]["usages"] = [u for u in pro_dict[id]["usages"] if re.findall(classregex,u) != []] + diff_dict = generate_diff_dict(pro_dict) + outputright = "各题难度中位数(-1表示无记录):\n" + for part in self.raw_idparts: + outputright += f" {part}:\n" + tk_dict = {} + xz_dict = {} + jd_dict = {} + count = 0 + for ind in self.raw_idparts[part]: + count += 1 + id = self.raw_idparts[part][ind] + outputright += f" {count} {id} ({pro_dict[id]['genre']}): {diff_dict[id]['median']:.3f}\n" + if pro_dict[id]["genre"] == "填空题": + tk_dict[id] = diff_dict[id] + elif pro_dict[id]["genre"] == "选择题": + xz_dict[id] = diff_dict[id] + elif pro_dict[id]["genre"] == "解答题": + jd_dict[id] = diff_dict[id] + # print(tk_list,xz_list,jd_list) + self.textBrowser_result.setText(outputright) + + self.plainTextEdit_idexp.setPlainText(outputleft) + + + + + + + + + + + +if __name__ == '__main__': + app = QApplication([]) + windows = MyWindow_pxnd("tikutest") + windows.show() + app.exec() + diff --git a/工具v4/排序材料内难度.ui b/工具v4/排序材料内难度.ui new file mode 100644 index 00000000..edc5e9ad --- /dev/null +++ b/工具v4/排序材料内难度.ui @@ -0,0 +1,103 @@ + + + Form + + + + 0 + 0 + 758 + 479 + + + + 排序材料内难度 + + + + + 20 + 20 + 91 + 24 + + + + TeX文件路径 + + + + + + 20 + 50 + 341 + 20 + + + + + + + 380 + 80 + 361 + 381 + + + + + + + 510 + 20 + 231 + 51 + + + + + true + + + + 排序难度数据 + + + + + + 380 + 30 + 141 + 16 + + + + 届别(班级)regex + + + + + + 380 + 50 + 113 + 20 + + + + + + + 20 + 80 + 341 + 381 + + + + + + +