Compare commits

...

10 Commits

20 changed files with 464 additions and 24 deletions

1
.gitignore vendored
View File

@ -13,4 +13,5 @@
*.sh
*static
*.log
*/文本文件/*

View File

@ -180,6 +180,9 @@ class Ui_MainWindow(object):
self.tab_gxsy = QWidget()
self.tab_gxsy.setObjectName(u"tab_gxsy")
self.tabWidget_syjl.addTab(self.tab_gxsy, "")
self.tab_grdr = QWidget()
self.tab_grdr.setObjectName(u"tab_grdr")
self.tabWidget_syjl.addTab(self.tab_grdr, "")
self.tabWidget_main.addTab(self.tab_syjl, "")
self.tab_notesandanswers = QWidget()
self.tab_notesandanswers.setObjectName(u"tab_notesandanswers")
@ -226,14 +229,14 @@ class Ui_MainWindow(object):
self.retranslateUi(MainWindow)
self.tabWidget_main.setCurrentIndex(7)
self.tabWidget_main.setCurrentIndex(3)
self.tabWidget_luru.setCurrentIndex(0)
self.tabWidget_weihu.setCurrentIndex(0)
self.tabWidget_shiyong.setCurrentIndex(5)
self.tabWidget_beikezu.setCurrentIndex(0)
self.tabWidget_latex.setCurrentIndex(0)
self.tabWidget_mubiaojichu.setCurrentIndex(1)
self.tabWidget_syjl.setCurrentIndex(0)
self.tabWidget_syjl.setCurrentIndex(6)
self.tabWidget_notesandanswers.setCurrentIndex(2)
@ -278,6 +281,7 @@ class Ui_MainWindow(object):
self.tabWidget_syjl.setTabText(self.tabWidget_syjl.indexOf(self.tab_xxxz), QCoreApplication.translate("MainWindow", u"\u5c0f\u95f2\u4e0b\u8f7d", None))
self.tabWidget_syjl.setTabText(self.tabWidget_syjl.indexOf(self.tab_scjl), QCoreApplication.translate("MainWindow", u"\u5220\u9664\u4f7f\u7528\u8bb0\u5f55", None))
self.tabWidget_syjl.setTabText(self.tabWidget_syjl.indexOf(self.tab_gxsy), QCoreApplication.translate("MainWindow", u"\u5171\u4eab\u4f7f\u7528\u8bb0\u5f55", None))
self.tabWidget_syjl.setTabText(self.tabWidget_syjl.indexOf(self.tab_grdr), QCoreApplication.translate("MainWindow", u"\u4e2a\u4eba\u4f7f\u7528\u8bb0\u5f55\u5bfc\u5165", None))
self.tabWidget_main.setTabText(self.tabWidget_main.indexOf(self.tab_syjl), QCoreApplication.translate("MainWindow", u"\u4f7f\u7528\u8bb0\u5f55", None))
self.tabWidget_notesandanswers.setTabText(self.tabWidget_notesandanswers.indexOf(self.tab_jglr), QCoreApplication.translate("MainWindow", u"\u8bb2\u4e49\u7ed3\u6784\u4e0e\u5185\u5bb9\u5f55\u5165", None))
self.tabWidget_notesandanswers.setTabText(self.tabWidget_notesandanswers.indexOf(self.tab_dtlr), QCoreApplication.translate("MainWindow", u"\u7b54\u9898\u7eb8\u5bf9\u5e94\u5f55\u5165", None))

View File

@ -0,0 +1,92 @@
# -*- 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, QHeaderView, QLineEdit, QPushButton,
QSizePolicy, QTableWidget, QTableWidgetItem, QWidget)
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(760, 490)
self.pushButton_fileselect = QPushButton(Form)
self.pushButton_fileselect.setObjectName(u"pushButton_fileselect")
self.pushButton_fileselect.setGeometry(QRect(20, 20, 75, 24))
self.pushButton_dirselect = QPushButton(Form)
self.pushButton_dirselect.setObjectName(u"pushButton_dirselect")
self.pushButton_dirselect.setGeometry(QRect(20, 60, 75, 24))
self.lineEdit_filepath = QLineEdit(Form)
self.lineEdit_filepath.setObjectName(u"lineEdit_filepath")
self.lineEdit_filepath.setGeometry(QRect(110, 20, 631, 20))
self.lineEdit_filepath.setReadOnly(True)
self.lineEdit_dirpath = QLineEdit(Form)
self.lineEdit_dirpath.setObjectName(u"lineEdit_dirpath")
self.lineEdit_dirpath.setGeometry(QRect(110, 60, 631, 20))
font = QFont()
font.setWeight(QFont.ExtraLight)
self.lineEdit_dirpath.setFont(font)
self.lineEdit_dirpath.setReadOnly(True)
self.tableWidget_filelist = QTableWidget(Form)
if (self.tableWidget_filelist.columnCount() < 1):
self.tableWidget_filelist.setColumnCount(1)
__qtablewidgetitem = QTableWidgetItem()
self.tableWidget_filelist.setHorizontalHeaderItem(0, __qtablewidgetitem)
self.tableWidget_filelist.setObjectName(u"tableWidget_filelist")
self.tableWidget_filelist.setGeometry(QRect(20, 100, 271, 371))
self.pushButton_exec = QPushButton(Form)
self.pushButton_exec.setObjectName(u"pushButton_exec")
self.pushButton_exec.setGeometry(QRect(300, 180, 111, 91))
font1 = QFont()
font1.setBold(True)
self.pushButton_exec.setFont(font1)
self.tableWidget_result = QTableWidget(Form)
if (self.tableWidget_result.columnCount() < 4):
self.tableWidget_result.setColumnCount(4)
__qtablewidgetitem1 = QTableWidgetItem()
self.tableWidget_result.setHorizontalHeaderItem(0, __qtablewidgetitem1)
__qtablewidgetitem2 = QTableWidgetItem()
self.tableWidget_result.setHorizontalHeaderItem(1, __qtablewidgetitem2)
__qtablewidgetitem3 = QTableWidgetItem()
self.tableWidget_result.setHorizontalHeaderItem(2, __qtablewidgetitem3)
__qtablewidgetitem4 = QTableWidgetItem()
self.tableWidget_result.setHorizontalHeaderItem(3, __qtablewidgetitem4)
self.tableWidget_result.setObjectName(u"tableWidget_result")
self.tableWidget_result.setGeometry(QRect(420, 100, 321, 371))
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"\u4e2a\u4eba\u4f7f\u7528\u8bb0\u5f55\u5bfc\u5165", None))
self.pushButton_fileselect.setText(QCoreApplication.translate("Form", u"\u9009\u62e9\u6587\u4ef6", None))
self.pushButton_dirselect.setText(QCoreApplication.translate("Form", u"\u9009\u62e9\u6587\u4ef6\u5939", None))
___qtablewidgetitem = self.tableWidget_filelist.horizontalHeaderItem(0)
___qtablewidgetitem.setText(QCoreApplication.translate("Form", u"\u6587\u4ef6\u5217\u8868", None));
self.pushButton_exec.setText(QCoreApplication.translate("Form", u"\u6536\u5f55\u4e2a\u4eba\u7b54\u9898\u60c5\u51b5\n"
"\u81f3\u6570\u636e\u5e93", None))
___qtablewidgetitem1 = self.tableWidget_result.horizontalHeaderItem(0)
___qtablewidgetitem1.setText(QCoreApplication.translate("Form", u"\u6587\u4ef6\u540d", None));
___qtablewidgetitem2 = self.tableWidget_result.horizontalHeaderItem(1)
___qtablewidgetitem2.setText(QCoreApplication.translate("Form", u"\u5df2\u6709", None));
___qtablewidgetitem3 = self.tableWidget_result.horizontalHeaderItem(2)
___qtablewidgetitem3.setText(QCoreApplication.translate("Form", u"\u4fee\u6539", None));
___qtablewidgetitem4 = self.tableWidget_result.horizontalHeaderItem(3)
___qtablewidgetitem4.setText(QCoreApplication.translate("Form", u"\u65b0\u589e", None));
# retranslateUi

View File

@ -45,7 +45,7 @@ class Ui_Form(object):
self.pushButton_convert.setFont(font)
self.layoutWidget = QWidget(Form)
self.layoutWidget.setObjectName(u"layoutWidget")
self.layoutWidget.setGeometry(QRect(330, 100, 97, 126))
self.layoutWidget.setGeometry(QRect(330, 90, 97, 152))
self.verticalLayout = QVBoxLayout(self.layoutWidget)
self.verticalLayout.setObjectName(u"verticalLayout")
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
@ -74,6 +74,11 @@ class Ui_Form(object):
self.verticalLayout.addWidget(self.radioButton_answers)
self.radioButton_template = QRadioButton(self.layoutWidget)
self.radioButton_template.setObjectName(u"radioButton_template")
self.verticalLayout.addWidget(self.radioButton_template)
self.retranslateUi(Form)
@ -92,5 +97,6 @@ class Ui_Form(object):
self.radioButton_multiple.setText(QCoreApplication.translate("Form", u"\u591a\u9009\u8f6c\u586b\u7a7a", None))
self.radioButton_puctuations.setText(QCoreApplication.translate("Form", u"\u6807\u70b9\u8f6c\u534a\u89d2", None))
self.radioButton_answers.setText(QCoreApplication.translate("Form", u"\u5df2\u6709\u7b54\u6848\u6807\u7ea2", None))
self.radioButton_template.setText(QCoreApplication.translate("Form", u"LaTeX\u6a21\u677f", None))
# retranslateUi

View File

@ -30,6 +30,8 @@ db_port = "13306"
db_host = "wwylss.synology.me"
currentsemester = "2023"
statsfilename = "小题分_按学号数学.xlsx"
def getgrade(currentsemester,gradeindex):
gradelist = {1: "高三", 2:"高二", 3:"高一"}
@ -1338,7 +1340,7 @@ def SortUsages(prodict): #对使用记录按字符串进行排序
def SortUsagesbyAverage(theusages): #根据使用记录每一条的平均值进行排序, 越高的在越前面
glossdifflist = []
for i in range(len(theusages)):
glossdiff = np.mean([float(d) for d in theusages[i][2]])
glossdiff = parseUsage(theusages[i])['glossdiff']
if glossdiff <= 0.999: #去除全对的使用记录
glossdifflist = glossdifflist + [(i,glossdiff)]
sortedglossdifflist = sorted(glossdifflist, key = lambda x:x[1], reverse = True)
@ -2481,7 +2483,7 @@ def SubstringOccurence(regex,string): #生成regex在string中出现的所有位
poslist = [item.start() for item in re.finditer(regex,string)]
return poslist
def select_grade_from_pro_dict(prodict,grades):
def select_grade_from_pro_dict(prodict,grades): #grades是一个list
if len(grades) == 0:
return prodict
else:

View File

@ -34,6 +34,7 @@ from 赋能卷生成 import MyWindow_fnsc
from 排序材料内难度 import MyWindow_pxnd
from 单人讲义生成 import MyWindow_drsc
from 讲义与答题纸信息查询 import MyWindow_jycx
from 个人使用记录导入 import MyWindow_grdr
from database_tools_2 import *
class MyWindow(QMainWindow,Ui_MainWindow):
@ -49,6 +50,11 @@ class MyWindow(QMainWindow,Ui_MainWindow):
self.pushButton_tiku.clicked.connect(self.SelectTIKU)
self.pushButton_tikutest.clicked.connect(self.SelectTIKUTEST) #以上为设置当前数据库的两个按钮
makedir("./临时文件")
makedir("./static")
makedir("./临时文件/pics")
makedir("./临时文件/zips")
self.layout_kxth = QVBoxLayout(self.tab_kxth)
self.kxth = MyWindow_kxth(self.database)
self.layout_kxth.addWidget(self.kxth) #以上三行为初始化“空闲题号”tab
@ -182,6 +188,10 @@ class MyWindow(QMainWindow,Ui_MainWindow):
self.jycx = MyWindow_jycx(self.database)
self.layout_jycx.addWidget(self.jycx) #以上三行为初始化"讲义答题纸查询"tab
self.layout_grdr = QVBoxLayout(self.tab_grdr)
self.grdr = MyWindow_grdr(self.database)
self.layout_grdr.addWidget(self.grdr) #以上三行为初始化"讲义答题纸查询"tab
@ -212,7 +222,8 @@ class MyWindow(QMainWindow,Ui_MainWindow):
self.jglr.setdbname,
self.dtlr.setdbname,
self.drsc.setdbname,
self.jycx.setdbname
self.jycx.setdbname,
self.grdr.setdbname
]: #在列表中的tab里传送数据库名的连接
self.sendDBname.connect(func)
def sendValue(self):

View File

@ -27,7 +27,7 @@
<enum>QTabWidget::Triangular</enum>
</property>
<property name="currentIndex">
<number>7</number>
<number>3</number>
</property>
<widget class="QWidget" name="tab_luru">
<attribute name="title">
@ -319,7 +319,7 @@
<enum>QTabWidget::Triangular</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>6</number>
</property>
<widget class="QWidget" name="tab_xxdr">
<attribute name="title">
@ -351,6 +351,11 @@
<string>共享使用记录</string>
</attribute>
</widget>
<widget class="QWidget" name="tab_grdr">
<attribute name="title">
<string>个人使用记录导入</string>
</attribute>
</widget>
</widget>
</widget>
<widget class="QWidget" name="tab_notesandanswers">

View File

@ -0,0 +1,168 @@
from PySide6.QtWidgets import QWidget, QApplication, QFileDialog, QTableWidgetItem
from PySide6.QtGui import QColor
from Ui_个人使用记录导入 import Ui_Form
from database_tools_2 import *
def getFilename(string):
filename = re.findall(r"\d{21}_([\s\S]*?)_高[一二三]_数学",string)[0]
return filename
def getFiledate(string):
date = re.findall(r"\((\d{8})\).zip",string)
if len(date) > 0:
return date[0]
else:
return ""
class MyWindow_grdr(QWidget,Ui_Form):
def __init__(self,database_name):
super().__init__()
self.setupUi(self)
self.database_name = database_name
self.bind()
def setdbname(self,string):
self.database_name = string
# print(self.database_name)
def bind(self):
self.tableWidget_filelist.setColumnWidth(0,270)
self.tableWidget_result.setColumnWidth(0,195)
for i in range(1,4):
self.tableWidget_result.setColumnWidth(i,40)
self.pushButton_dirselect.clicked.connect(self.select_dir)
self.pushButton_fileselect.clicked.connect(self.select_file)
self.pushButton_exec.clicked.connect(self.exec)
def select_dir(self):
self.lineEdit_filepath.setText("未选择单一文件.")
dirpath = QFileDialog.getExistingDirectory(self,"选择文件夹")
self.lineEdit_dirpath.setText(dirpath)
self.filelist = [os.path.join(dirpath,f) for f in os.listdir(dirpath)]
self.tableWidget_filelist.setRowCount(len(self.filelist))
for i in range(len(self.filelist)):
self.tableWidget_filelist.setItem(i,0,QTableWidgetItem(f"{getFilename(self.filelist[i])} {getFiledate(self.filelist[i])}"))
def select_file(self):
self.lineEdit_dirpath.setText("未选择文件夹.")
self.tableWidget_filelist.setRowCount(1)
pathlist = QFileDialog.getOpenFileName(self,"选择文件",".","zip文件(*.zip);;所有文件(*)")
self.lineEdit_filepath.setText(pathlist[0])
self.filelist = [pathlist[0]]
for i in range(len(self.filelist)):
self.tableWidget_filelist.setItem(i,0,QTableWidgetItem(f"{getFilename(self.filelist[i])} {getFiledate(self.filelist[i])}"))
def exec(self):
tempdir = "临时文件/zips"
self.tableWidget_result.clearContents()
self.tableWidget_result.setRowCount(0)
mydb = connect(hostname = db_host, port = db_port, username=db_user, pwd=db_pwd, db = self.database_name)
mycursor = mydb.cursor()
for zf in tqdm.tqdm(self.filelist,desc = "文件处理进度 "):
legalflag = True
if re.findall(r"\(\d{8}\)",zf) == []:
legalflag = False
else:
#如果文件名中有日期信息
udlist = []
filedate = getFiledate(zf)
ud = generateUsagedetail(zipfilepath=zf,tempdir=tempdir,cursor=mycursor,statsfilename=statsfilename,threshold=0.20,date=filedate)
if not ud == 1:
udlist += ud.copy()
else:
udlist = []
legalflag = False
#以下生成三个种类的使用记录
id_used_list = []
for u in udlist:
if not u["ID"] in id_used_list:
id_used_list.append(u["ID"])
if len(id_used_list) >= 1:
sql = "SELECT ID,date,studentid,studentname,diff,answersheet FROM usagedetail WHERE NOT obsolete AND ID in "
id_used_set = "("
for id in id_used_list:
id_used_set += ('"'+id+'",')
id_used_set = id_used_set[:-1] + ")"
mycursor.execute(sql+id_used_set+";")
used_info = mycursor.fetchall()
else:
used_info = []
used_info_short = [(u[0],u[2],u[4],u[5]) for u in used_info]
used_info_id_and_as = [(u[0],u[2],u[5]) for u in used_info]
repeat_list = []
to_flush_list = []
unused_list = []
for u in tqdm.tqdm(udlist):
datum = (u["ID"],u["date"],u["studentid"],u["studentname"],json.dumps(u["diff"]),u["answersheet"])
if datum in used_info:
repeat_list.append(datum)
else:
datum_short = (datum[0],datum[2],datum[4],datum[5])
datum_id_and_ans = (datum[0],datum[2],datum[5])
if datum_short in used_info_short:
repeat_list.append(datum)
elif datum_id_and_ans in used_info_id_and_as:
to_flush_list.append(datum)
else:
unused_list.append(datum)
current_row_count = self.tableWidget_result.rowCount()
self.tableWidget_result.insertRow(current_row_count)
self.tableWidget_result.setItem(current_row_count,0,QTableWidgetItem(getFilename(zf)))
if legalflag:
#修改部分批改情况改过的已有记录
for item in tqdm.tqdm(to_flush_list):
sql = "UPDATE usagedetail SET diff = %s WHERE ID = %s AND studentid = %s AND answersheet = %s AND NOT obsolete;"
val = (item[4],item[0],item[2],item[5])
mycursor.execute(sql,val)
sql = "INSERT INTO logs (DATE,TIME,username,action,id,db_content) VALUE (%s,%s,%s,%s,%s,%s);"
val = (GetDate(),GetTime(),get_git_username(),"修改个人答题情况",item[0],json.dumps(item,ensure_ascii = False))
mycursor.execute(sql,val)
mydb.commit()
#导入新使用记录
templist = unused_list.copy()
pieceslist = []
while len(templist) > 5000:
pieceslist.append((5000,templist[:5000].copy()))
templist = templist[5000:]
pieceslist.append((len(templist),templist))
if len(unused_list) >= 1:
for piece in tqdm.tqdm(pieceslist):
inssql = "INSERT INTO usagedetail (ID,date,studentid,studentname,diff,answersheet) VALUES "+",".join(["(%s,%s,%s,%s,%s,%s)"]*piece[0])+";"
insval = []
for item in piece[1]:
insval += list(item)
mycursor.execute(inssql,insval)
logsql = "INSERT INTO logs (DATE,TIME,username,action,db_content) VALUE (%s,%s,%s,%s,%s);"
log_content = f"答题纸: {set([u[-1] for u in unused_list])} 题目: {set([u[0] for u in unused_list])}, 学生账号: {set([u[2] for u in unused_list])}"
logval = (GetDate(),GetTime(),get_git_username(),"新增个人答题情况",log_content)
mycursor.execute(logsql,logval)
mydb.commit()
#正常讲义不染色
self.tableWidget_result.setItem(current_row_count,1,QTableWidgetItem(str(len(repeat_list))))
self.tableWidget_result.setItem(current_row_count,2,QTableWidgetItem(str(len(to_flush_list))))
self.tableWidget_result.setItem(current_row_count,3,QTableWidgetItem(str(len(unused_list))))
# print(len(repeat_list),len(to_flush_list),len(unused_list))
else:
#非正常讲义染色
self.tableWidget_result.item(current_row_count,0).setBackground(QColor("red"))
for i in range(1,4):
self.tableWidget_result.setItem(current_row_count,i,QTableWidgetItem(""))
self.tableWidget_result.item(current_row_count,i).setBackground(QColor("red"))
mydb.close()
if __name__ == '__main__':
app = QApplication([])
windows = MyWindow_grdr("tikutest")
windows.show()
app.exec()

View File

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<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="QPushButton" name="pushButton_fileselect">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>75</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>选择文件</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_dirselect">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>75</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>选择文件夹</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_filepath">
<property name="geometry">
<rect>
<x>110</x>
<y>20</y>
<width>631</width>
<height>20</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_dirpath">
<property name="geometry">
<rect>
<x>110</x>
<y>60</y>
<width>631</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<fontweight>ExtraLight</fontweight>
</font>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QTableWidget" name="tableWidget_filelist">
<property name="geometry">
<rect>
<x>20</x>
<y>100</y>
<width>271</width>
<height>371</height>
</rect>
</property>
<column>
<property name="text">
<string>文件列表</string>
</property>
</column>
</widget>
<widget class="QPushButton" name="pushButton_exec">
<property name="geometry">
<rect>
<x>300</x>
<y>180</y>
<width>111</width>
<height>91</height>
</rect>
</property>
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>收录个人答题情况
至数据库</string>
</property>
</widget>
<widget class="QTableWidget" name="tableWidget_result">
<property name="geometry">
<rect>
<x>420</x>
<y>100</y>
<width>321</width>
<height>371</height>
</rect>
</property>
<column>
<property name="text">
<string>文件名</string>
</property>
</column>
<column>
<property name="text">
<string>已有</string>
</property>
</column>
<column>
<property name="text">
<string>修改</string>
</property>
</column>
<column>
<property name="text">
<string>新增</string>
</property>
</column>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -17,7 +17,7 @@ class MyWindow_tjzd(QWidget,Ui_Form):
def bind(self):
self.metadatafilepath = "文本文件/metadata.txt"
self.metadatafilepath = "./临时文件/metadata.txt"
self.pushButton_exec.clicked.connect(self.exec)
self.pushButton_open.clicked.connect(self.openmeta)
self.pushButton_exec.setEnabled(False)

View File

@ -74,7 +74,8 @@ class MyWindow_drsc(QWidget,Ui_Form):
structures_dict = load_structures_dict_from_mariadb(mycursor)
raw_pro_dict,obj_dict,bn_dict,unit_obj_dict = generateDictsfromMariaDB(mycursor)
if self.radioButton_teacher.isChecked() and self.checkBox_usages.isChecked() and not self.lineEdit_class.text().strip() == "":
grades = self.lineEdit_class.text().strip().split(",")
grades = RefinePunctuations(self.lineEdit_class.text().strip()).split(",")
grades = [g.strip() for g in grades]
else:
grades = []
pro_dict = select_grade_from_pro_dict(raw_pro_dict,grades)

View File

@ -38,8 +38,8 @@ class MyWindow_dygg(QWidget,Ui_Form):
print("处理失败.")
elif self.radioButton_phase2.isChecked():
output = UnitRectoMetadataText(ReadTextFile("临时文件/单元对应.txt"))
SaveTextFile(output,"文本文件/metadata.txt")
os.system("code 文本文件/metadata.txt")
SaveTextFile(output,"./临时文件/metadata.txt")
os.system("code 临时文件/metadata.txt")

View File

@ -11,7 +11,7 @@ class MyWindow_sddr(QWidget,Ui_Form):
self.pushButton_exec.clicked.connect(self.exec)
def exec(self):
handmadeusagedatafilepath = r"临时文件/手动统计结果.txt" #手动统计文件的位置
metadatafilepath = r"文本文件/metadata.txt" #输出的metadata文件的位置
metadatafilepath = r"./临时文件/metadata.txt" #输出的metadata文件的位置
raw_data = ReadTextFile(handmadeusagedatafilepath)
data_list = [d.strip() for d in re.findall(r"\[BEGIN\]([\s\S]*?)\[END\]",raw_data)]
output = "usages\n\n"

View File

@ -88,7 +88,7 @@ class MyWindow_bdsl(QWidget,Ui_Form):
Indexed = True
else:
Indexed = False
idlistpath = "文本文件/新题收录列表.txt"
idlistpath = "./临时文件/新题收录列表.txt"
problems = GenerateNewProblemDataFromString2024(data)
problem_count = len(problems)
# pro_dict = load_dict("../题库0.3/Problems.json")

View File

@ -34,6 +34,8 @@ class MyWindow_wbzh(QWidget,Ui_Form):
self.mycursor = self.mydb.cursor()
self.pro_dict = generateProDict(self.mycursor)
dest_string = PaintRedAnswers(raw_string,self.pro_dict)
elif self.radioButton_template.isChecked():
dest_string = ReadTextFile("./模板文件/题目编辑.txt")
self.plainTextEdit_dest.setPlainText(dest_string)
self.mydb.close()

View File

@ -93,9 +93,9 @@
<property name="geometry">
<rect>
<x>330</x>
<y>100</y>
<y>90</y>
<width>97</width>
<height>126</height>
<height>152</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -134,6 +134,13 @@
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_template">
<property name="text">
<string>LaTeX模板</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -85,7 +85,8 @@ class MyWindow_jysc(QWidget,Ui_Form):
structures_dict = load_structures_dict_from_mariadb(mycursor)
raw_pro_dict,obj_dict,bn_dict,unit_obj_dict = generateDictsfromMariaDB(mycursor)
if self.radioButton_teacher.isChecked() and self.checkBox_usages.isChecked() and not self.lineEdit_grades.text().strip() == "":
grades = self.lineEdit_grades.text().strip().split(",")
grades = RefinePunctuations(self.lineEdit_grades.text().strip()).split(",")
grades = [g.strip() for g in grades]
else:
grades = []
pro_dict = select_grade_from_pro_dict(raw_pro_dict,grades)

View File

@ -26,7 +26,7 @@ class MyWindow_tkdr(QWidget,Ui_Form):
date = self.lineEdit_date.text().strip() # 考试日期
grade = self.lineEdit_grade.text().strip() # 考试年级
max_classnum = int(self.lineEdit_classnum.text().strip()) # 年级参加考试的最大班级班号
outputfilepath = r"文本文件/metadata.txt" # 输出的用于导入的metadata.txt文件位置
outputfilepath = r"./临时文件/metadata.txt" # 输出的用于导入的metadata.txt文件位置
checkingfilepath = r"临时文件/手动统计结果.txt" # 用于检查结构的文件所在位置

View File

@ -93,7 +93,7 @@ def index():
# obj_dict = load_dict("../题库0.3/LessonObj.json")
# basicknowledge_dict = load_dict("../题库0.3/BasicKnowledge.json")
consecutivenumbering = structure_dict[papertype]["consecutivenumbering"]
texdata = GenerateSingleLessonNotefromMariaDB(mycursor,pid,structure_dict,notes_dict,"../工具v4/模板文件/讲义模板.txt",os.path.join(outputpath,filename),configjson,consecutivenumbering) #20240415版讲义生成
texdata = GenerateSingleLessonNotefromMariaDB(mycursor,pid,structure_dict,notes_dict,"./模板文件/讲义模板.txt",os.path.join(outputpath,filename),configjson,consecutivenumbering) #20240415版讲义生成
mydb.close()
return f'''
<h1>{pid} PDF 文件生成完毕</h1>
@ -122,7 +122,7 @@ def index():
for singleid in problems_list:
bodystring += generateLaTeXBodyContentfromMariaDB(mycursor,singleid,configjson) + "\n"
bodystring += "\\end{enumerate}\n\n"
templatepath = "../工具v4/模板文件/讲义模板.txt"
templatepath = "./模板文件/讲义模板.txt"
outputfilepath = os.path.join(outputpath,filename)
texdata = ReadTextFile(templatepath)
texdata = StringSubstitute(r"<<[\s\S]*?待替换[\s\S]*?>>",texdata,("选题编译",bodystring))

View File

@ -101,7 +101,7 @@ class MyWindow_xxdr(QWidget,Ui_Form):
def exec(self): #执行操作并将使用数据汇入metadata.txt
self.checkpathanddate()
if len(self.using_rows) >= 2:
SaveTextFile("","文本文件/metadata.txt")
SaveTextFile("","./临时文件/metadata.txt")
for row in self.using_rows:
date = self.tableWidget.item(row,2).text()
threshold = float(self.lineEdit_threshold.text())
@ -118,10 +118,10 @@ class MyWindow_xxdr(QWidget,Ui_Form):
self.tableWidget.item(row,i).setBackground(QColor("green"))
print(f"{self.tableWidget.item(row,1).text()} 使用数据生成成功")
if not self.checkBox.isChecked() and len(self.using_rows) == 1:
SaveTextFile(output,"文本文件/metadata.txt")
SaveTextFile(output,"./临时文件/metadata.txt")
else:
AppendTextFile(output,"文本文件/metadata.txt")
os.system("code 文本文件/metadata.txt")
AppendTextFile(output,"./临时文件/metadata.txt")
os.system("code 临时文件/metadata.txt")