讲义结构及内容录入修改中

This commit is contained in:
weiye.wang 2024-06-16 23:57:21 +08:00
parent e67e3e94d1
commit 2409413cf5
1 changed files with 12 additions and 9 deletions

View File

@ -23,21 +23,22 @@ class MyWindow_jglr(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()
if not len(self.lineEdit_structure.text()) == 1:
print("首字母有误")
else:
self.label_next.setVisible(True)
self.repaint()
self.prefix = self.lineEdit_structure.text().upper()+self.comboBox_grade.currentText()+self.comboBox_semester.currentText()
jsonfile = f"../备课组/{self.prefix[3:5]}届/校本材料.json"
notes_dict = load_dict(jsonfile)
notes_dict = load_notes_dict_from_mariadb(mycursor)
structure_dict = load_structures_dict_from_mariadb(mycursor)
# print(len(notes_dict))
if not self.prefix[0] in notes_dict["structures"]:
AddNew = input("此类型不在列表中, 新增(A)/退出(Q):")
if not self.prefix[0:5] in structure_dict:
AddNew = input("此类型不在列表中, 新增(A)/退出([Q]):")
if AddNew[0].upper() == "A":
descr = input("类型描述:")
cn = input("编号是否连续(T/F):")
cn = input("编号是否连续(T/[F]):")
if cn[0].upper() == "T":
cn = True
else:
@ -51,7 +52,7 @@ class MyWindow_jglr(QWidget,Ui_Form):
for i in range(partscount):
partid = input(f"{i+1} 部分的代号:")
partname = input(f"部分 {partid} 的名称:")
spaceflag = input(f"部分 {partid}: {partname} 中是否要在题目后留空格(T/F):")
spaceflag = input(f"部分 {partid}: {partname} 中是否要在题目后留空格(T/[F]):")
if spaceflag[0].upper() == "T":
spaceflag = True
else:
@ -60,8 +61,9 @@ class MyWindow_jglr(QWidget,Ui_Form):
"name": partname,
"spaceflag": spaceflag
}
notes_dict["structures"][self.prefix[0]] = new_struct_dict.copy()
save_dict(notes_dict,jsonfile)
####20240616到这里
# notes_dict["structures"][self.prefix[0]] = new_struct_dict.copy()
# save_dict(notes_dict,jsonfile)
else:
pass
else:
@ -102,6 +104,7 @@ class MyWindow_jglr(QWidget,Ui_Form):
notes_dict["notes"] = SortDict(notes_dict["notes"])
save_dict(notes_dict,jsonfile)
print("处理完成")
mydb.close()