排序材料内难度功能完成
This commit is contained in:
parent
b379805e13
commit
c82b9a7f3c
|
|
@ -15,8 +15,8 @@ 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)
|
||||
from PySide6.QtWidgets import (QApplication, QLabel, QLineEdit, QPushButton,
|
||||
QSizePolicy, QTextBrowser, QWidget)
|
||||
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
|
|
@ -44,9 +44,9 @@ class Ui_Form(object):
|
|||
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.textBrowser_idexp = QTextBrowser(Form)
|
||||
self.textBrowser_idexp.setObjectName(u"textBrowser_idexp")
|
||||
self.textBrowser_idexp.setGeometry(QRect(20, 80, 341, 381))
|
||||
|
||||
self.retranslateUi(Form)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class MyWindow_pxnd(QWidget,Ui_Form):
|
|||
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_filepath.setText(r"C:\Users\weiye\Documents\wwy sync\26届\高一第二学期\学案\G20260216余弦定理(2).tex") # to remove
|
||||
self.lineEdit_classregex.setText(r"2026届高一1\d班") # to remove
|
||||
|
||||
|
||||
|
|
@ -40,6 +40,7 @@ class MyWindow_pxnd(QWidget,Ui_Form):
|
|||
self.raw_idparts[f"第{part_ind}部分"][index] = id
|
||||
print(self.raw_idparts)
|
||||
outputleft = f"原来材料各板块的题号:\n{self.raw_idlist}"
|
||||
outputleft += "\n\n---------------\n\n按类型及难度中位数排序后的题号:\n"
|
||||
|
||||
mydb = connect(hostname = db_host, port = db_port, username = db_user, pwd = db_pwd, db = self.database_name)
|
||||
mycursor = mydb.cursor()
|
||||
|
|
@ -51,25 +52,38 @@ class MyWindow_pxnd(QWidget,Ui_Form):
|
|||
diff_dict = generate_diff_dict(pro_dict)
|
||||
outputright = "各题难度中位数(-1表示无记录):\n"
|
||||
for part in self.raw_idparts:
|
||||
new_idlist = []
|
||||
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"
|
||||
outputright += f" {ind} {id} ({pro_dict[id]['genre']}): {diff_dict[id]['median']:.3f}\n"
|
||||
if pro_dict[id]["genre"] == "填空题":
|
||||
tk_dict[id] = diff_dict[id]
|
||||
tk_dict[id] = (ind,diff_dict[id]['median'])
|
||||
elif pro_dict[id]["genre"] == "选择题":
|
||||
xz_dict[id] = diff_dict[id]
|
||||
xz_dict[id] = (ind,diff_dict[id]['median'])
|
||||
elif pro_dict[id]["genre"] == "解答题":
|
||||
jd_dict[id] = diff_dict[id]
|
||||
jd_dict[id] = (ind,diff_dict[id]['median'])
|
||||
# print(tk_list,xz_list,jd_list)
|
||||
sorted_tk_dict = dict(sorted(tk_dict.items(), key=lambda x:x[1][1], reverse= True))
|
||||
# print(sorted_tk_dict)
|
||||
sorted_xz_dict = dict(sorted(xz_dict.items(), key=lambda x:x[1][1], reverse= True))
|
||||
sorted_jd_dict = dict(sorted(jd_dict.items(), key=lambda x:x[1][1], reverse= True))
|
||||
outputright += "***************\n"
|
||||
for currentdict in (sorted_tk_dict,sorted_xz_dict,sorted_jd_dict):
|
||||
for id in currentdict:
|
||||
new_idlist.append(id)
|
||||
ind = currentdict[id][0]
|
||||
diff = currentdict[id][1]
|
||||
outputright += f" {ind} {id} ({pro_dict[id]['genre']}): {diff:.3f}\n"
|
||||
outputright += "\n--------------------\n\n"
|
||||
outputleft += f"{','.join(new_idlist)}\n\n"
|
||||
self.textBrowser_idexp.setText(outputleft)
|
||||
self.textBrowser_result.setText(outputright)
|
||||
|
||||
self.plainTextEdit_idexp.setPlainText(outputleft)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit_idexp">
|
||||
<widget class="QTextBrowser" name="textBrowser_idexp">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
|
|
|
|||
Reference in New Issue