讲义结构及内容录入修改中
This commit is contained in:
parent
e67e3e94d1
commit
2409413cf5
|
|
@ -23,21 +23,22 @@ class MyWindow_jglr(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()
|
||||||
if not len(self.lineEdit_structure.text()) == 1:
|
if not len(self.lineEdit_structure.text()) == 1:
|
||||||
print("首字母有误")
|
print("首字母有误")
|
||||||
else:
|
else:
|
||||||
self.label_next.setVisible(True)
|
self.label_next.setVisible(True)
|
||||||
self.repaint()
|
self.repaint()
|
||||||
self.prefix = self.lineEdit_structure.text().upper()+self.comboBox_grade.currentText()+self.comboBox_semester.currentText()
|
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_notes_dict_from_mariadb(mycursor)
|
||||||
notes_dict = load_dict(jsonfile)
|
structure_dict = load_structures_dict_from_mariadb(mycursor)
|
||||||
|
|
||||||
# print(len(notes_dict))
|
# print(len(notes_dict))
|
||||||
if not self.prefix[0] in notes_dict["structures"]:
|
if not self.prefix[0:5] in structure_dict:
|
||||||
AddNew = input("此类型不在列表中, 新增(A)/退出(Q):")
|
AddNew = input("此类型不在列表中, 新增(A)/退出([Q]):")
|
||||||
if AddNew[0].upper() == "A":
|
if AddNew[0].upper() == "A":
|
||||||
descr = input("类型描述:")
|
descr = input("类型描述:")
|
||||||
cn = input("编号是否连续(T/F):")
|
cn = input("编号是否连续(T/[F]):")
|
||||||
if cn[0].upper() == "T":
|
if cn[0].upper() == "T":
|
||||||
cn = True
|
cn = True
|
||||||
else:
|
else:
|
||||||
|
|
@ -51,7 +52,7 @@ class MyWindow_jglr(QWidget,Ui_Form):
|
||||||
for i in range(partscount):
|
for i in range(partscount):
|
||||||
partid = input(f"第 {i+1} 部分的代号:")
|
partid = input(f"第 {i+1} 部分的代号:")
|
||||||
partname = input(f"部分 {partid} 的名称:")
|
partname = input(f"部分 {partid} 的名称:")
|
||||||
spaceflag = input(f"部分 {partid}: {partname} 中是否要在题目后留空格(T/F):")
|
spaceflag = input(f"部分 {partid}: {partname} 中是否要在题目后留空格(T/[F]):")
|
||||||
if spaceflag[0].upper() == "T":
|
if spaceflag[0].upper() == "T":
|
||||||
spaceflag = True
|
spaceflag = True
|
||||||
else:
|
else:
|
||||||
|
|
@ -60,8 +61,9 @@ class MyWindow_jglr(QWidget,Ui_Form):
|
||||||
"name": partname,
|
"name": partname,
|
||||||
"spaceflag": spaceflag
|
"spaceflag": spaceflag
|
||||||
}
|
}
|
||||||
notes_dict["structures"][self.prefix[0]] = new_struct_dict.copy()
|
####20240616到这里
|
||||||
save_dict(notes_dict,jsonfile)
|
# notes_dict["structures"][self.prefix[0]] = new_struct_dict.copy()
|
||||||
|
# save_dict(notes_dict,jsonfile)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
@ -102,6 +104,7 @@ class MyWindow_jglr(QWidget,Ui_Form):
|
||||||
notes_dict["notes"] = SortDict(notes_dict["notes"])
|
notes_dict["notes"] = SortDict(notes_dict["notes"])
|
||||||
save_dict(notes_dict,jsonfile)
|
save_dict(notes_dict,jsonfile)
|
||||||
print("处理完成")
|
print("处理完成")
|
||||||
|
mydb.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Reference in New Issue