答题纸对应与讲义结构内容录入 修改中
This commit is contained in:
parent
eacf0380a0
commit
e67e3e94d1
|
|
@ -2,17 +2,16 @@ from PySide6.QtWidgets import QWidget, QApplication, QFileDialog
|
|||
from Ui_答题纸对应 import Ui_Form
|
||||
from database_tools_2 import *
|
||||
|
||||
def getindices(string):
|
||||
def getindices(string,cursor):#根据前七个字符获取以其为首的讲义的后两位
|
||||
sql = "SELECT nid FROM notes WHERE NOT obsolete;"
|
||||
cursor.execute(sql)
|
||||
ret = cursor.fetchall()
|
||||
indices_list = []
|
||||
notesjsonpath = f"../备课组/{string[3:5]}届/校本材料.json"
|
||||
try:
|
||||
notesjson = load_dict(notesjsonpath)
|
||||
for id in notesjson["notes"]:
|
||||
if id.startswith(string):
|
||||
indices_list.append(id[-2:])
|
||||
return indices_list
|
||||
except:
|
||||
return []
|
||||
for item in ret:
|
||||
if item[0].startswith(string):
|
||||
indices_list.append(item[0][-2:])
|
||||
return indices_list.copy()
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -52,14 +51,16 @@ class MyWindow_dtlr(QWidget,Ui_Form):
|
|||
def unvisible(self):
|
||||
self.label_next.setVisible(False)
|
||||
def exec(self):
|
||||
mydb = connect(hostname = db_host, port = db_port, username=db_user, pwd=db_pwd, db = self.database_name)
|
||||
mycursor = mydb.cursor()
|
||||
nid = f"{self.structure}{self.grade}{self.semester}{self.comboBox_index.currentText()}"
|
||||
answersheetjson = f"../备课组/{self.grade[-2:]}届/答题纸对应.json"
|
||||
notesjson = f"../备课组/{self.grade[-2:]}届/校本材料.json"
|
||||
# answersheetjson = f"../备课组/{self.grade[-2:]}届/答题纸对应.json"
|
||||
# notesjson = f"../备课组/{self.grade[-2:]}届/校本材料.json"
|
||||
marks_list = re.findall(r"(?:(?:^)|(?:\n))(\d+)分",self.plainTextEdit_marks.toPlainText())
|
||||
marks_list = [int(mark) for mark in marks_list]
|
||||
|
||||
answersheet_dict = load_dict(answersheetjson)
|
||||
notes_dict = load_dict(notesjson)
|
||||
answersheet_dict = load_answersheets_dict_from_mariadb(mycursor)
|
||||
notes_dict = load_notes_dict_from_mariadb(mycursor)
|
||||
|
||||
new_dict = {}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class MyWindow_jglr(QWidget,Ui_Form):
|
|||
pid = self.prefix + input("请输入新材料编号(两位数):")
|
||||
name = input("请输入材料名称:")
|
||||
filenameraw = input("生成的文件名和材料名称是否一致?([Y]/如果不一致请输入文件名):")
|
||||
if filenameraw.upper() == "Y":
|
||||
if filenameraw.upper() == "Y" or len(filenameraw.strip()) == 0:
|
||||
filename = name
|
||||
else:
|
||||
filename = filenameraw
|
||||
|
|
|
|||
Reference in New Issue