答题纸对应与讲义结构内容录入 修改中
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 Ui_答题纸对应 import Ui_Form
|
||||||
from database_tools_2 import *
|
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 = []
|
indices_list = []
|
||||||
notesjsonpath = f"../备课组/{string[3:5]}届/校本材料.json"
|
for item in ret:
|
||||||
try:
|
if item[0].startswith(string):
|
||||||
notesjson = load_dict(notesjsonpath)
|
indices_list.append(item[0][-2:])
|
||||||
for id in notesjson["notes"]:
|
return indices_list.copy()
|
||||||
if id.startswith(string):
|
|
||||||
indices_list.append(id[-2:])
|
|
||||||
return indices_list
|
|
||||||
except:
|
|
||||||
return []
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -52,14 +51,16 @@ class MyWindow_dtlr(QWidget,Ui_Form):
|
||||||
def unvisible(self):
|
def unvisible(self):
|
||||||
self.label_next.setVisible(False)
|
self.label_next.setVisible(False)
|
||||||
def exec(self):
|
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()}"
|
nid = f"{self.structure}{self.grade}{self.semester}{self.comboBox_index.currentText()}"
|
||||||
answersheetjson = f"../备课组/{self.grade[-2:]}届/答题纸对应.json"
|
# answersheetjson = f"../备课组/{self.grade[-2:]}届/答题纸对应.json"
|
||||||
notesjson = f"../备课组/{self.grade[-2:]}届/校本材料.json"
|
# notesjson = f"../备课组/{self.grade[-2:]}届/校本材料.json"
|
||||||
marks_list = re.findall(r"(?:(?:^)|(?:\n))(\d+)分",self.plainTextEdit_marks.toPlainText())
|
marks_list = re.findall(r"(?:(?:^)|(?:\n))(\d+)分",self.plainTextEdit_marks.toPlainText())
|
||||||
marks_list = [int(mark) for mark in marks_list]
|
marks_list = [int(mark) for mark in marks_list]
|
||||||
|
|
||||||
answersheet_dict = load_dict(answersheetjson)
|
answersheet_dict = load_answersheets_dict_from_mariadb(mycursor)
|
||||||
notes_dict = load_dict(notesjson)
|
notes_dict = load_notes_dict_from_mariadb(mycursor)
|
||||||
|
|
||||||
new_dict = {}
|
new_dict = {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class MyWindow_jglr(QWidget,Ui_Form):
|
||||||
pid = self.prefix + input("请输入新材料编号(两位数):")
|
pid = self.prefix + input("请输入新材料编号(两位数):")
|
||||||
name = input("请输入材料名称:")
|
name = input("请输入材料名称:")
|
||||||
filenameraw = input("生成的文件名和材料名称是否一致?([Y]/如果不一致请输入文件名):")
|
filenameraw = input("生成的文件名和材料名称是否一致?([Y]/如果不一致请输入文件名):")
|
||||||
if filenameraw.upper() == "Y":
|
if filenameraw.upper() == "Y" or len(filenameraw.strip()) == 0:
|
||||||
filename = name
|
filename = name
|
||||||
else:
|
else:
|
||||||
filename = filenameraw
|
filename = filenameraw
|
||||||
|
|
|
||||||
Reference in New Issue