系列讲义生成中添加了讲义备注

This commit is contained in:
wangweiye7840 2024-06-17 11:12:45 +08:00
parent 62b7c75d4d
commit 85aa1a8d20
3 changed files with 5 additions and 3 deletions

View File

@ -3371,7 +3371,7 @@ def load_notes_dict_from_mariadb(cursor): #从mariadb获取讲义列表
notes_dict[nid] = {'id':nid,'name':name,'filename':filename} notes_dict[nid] = {'id':nid,'name':name,'filename':filename}
for key in temp_dict: for key in temp_dict:
notes_dict[nid][key] = temp_dict[key] notes_dict[nid][key] = temp_dict[key]
# notes_dict[nid]["remarks"] = "" if remarks is None else remarks notes_dict[nid]["remarks"] = "" if remarks is None else remarks
return notes_dict return notes_dict
def load_structures_dict_from_mariadb(cursor): # 从mariadb获取讲义结构列表 def load_structures_dict_from_mariadb(cursor): # 从mariadb获取讲义结构列表

View File

@ -110,7 +110,7 @@ class MyWindow_jysc(QWidget,Ui_Form):
} }
papernames = [] papernames = []
multitexdata = [] multitexdata = []
for lessonid in notes_dict: for lessonid in sorted(notes_dict.keys()):
coincideflag = False coincideflag = False
for lessonpattern in patterns: for lessonpattern in patterns:
if re.findall(lessonpattern,lessonid) != []: if re.findall(lessonpattern,lessonid) != []:
@ -122,6 +122,8 @@ class MyWindow_jysc(QWidget,Ui_Form):
papertype = lessonid[0:5] papertype = lessonid[0:5]
consecutivenumbering = structures_dict[papertype]["consecutivenumbering"] consecutivenumbering = structures_dict[papertype]["consecutivenumbering"]
texdata = GenerateSingleLessonTeXfromDict(id=lessonid, structuredict = structures_dict, notesdict=notes_dict, pro_dict=pro_dict, obj_dict=obj_dict,bn_dict=bn_dict,misc = configjson, consecutivenumbering= consecutivenumbering) texdata = GenerateSingleLessonTeXfromDict(id=lessonid, structuredict = structures_dict, notesdict=notes_dict, pro_dict=pro_dict, obj_dict=obj_dict,bn_dict=bn_dict,misc = configjson, consecutivenumbering= consecutivenumbering)
if notes_dict[lessonid]["remarks"] != "":
texdata += f"\n\n\\newpage\n\n\\section{{备注}}\n\n{notes_dict[lessonid]['remarks']}\n\n"
papernames.append(notes_dict[lessonid]["id"]+" \\ "+notes_dict[lessonid]["name"]) papernames.append(notes_dict[lessonid]["id"]+" \\ "+notes_dict[lessonid]["name"])
print(f"已生成 {papernames[-1]} 文件") print(f"已生成 {papernames[-1]} 文件")
multitexdata.append(texdata) multitexdata.append(texdata)

View File

@ -113,7 +113,7 @@ class MyWindow_jglr(QWidget,Ui_Form):
val = (nid,name,filename,json.dumps(temp_dict,ensure_ascii = False)) val = (nid,name,filename,json.dumps(temp_dict,ensure_ascii = False))
mycursor.execute(sql,val) mycursor.execute(sql,val)
sql = "INSERT INTO logs (DATE,TIME,username,action,db_content) VALUE (%s,%s,%s,%s,%s);" sql = "INSERT INTO logs (DATE,TIME,username,action,db_content) VALUE (%s,%s,%s,%s,%s);"
val = (GetDate(),GetTime(),get_git_username(),"添加新讲义内容",self.prefix) val = (GetDate(),GetTime(),get_git_username(),"添加新讲义内容",nid)
mycursor.execute(sql,val) mycursor.execute(sql,val)
mydb.commit() mydb.commit()
print("处理完成") print("处理完成")