新题收录分为两步, 预收录与提交
This commit is contained in:
parent
d9322e3f6a
commit
3e79200713
|
|
@ -44,7 +44,7 @@ class Ui_Form(object):
|
|||
self.plainTextEdit_compared.setGeometry(QRect(380, 30, 281, 301))
|
||||
self.pushButton_step2 = QPushButton(Form)
|
||||
self.pushButton_step2.setObjectName(u"pushButton_step2")
|
||||
self.pushButton_step2.setGeometry(QRect(670, 50, 70, 400))
|
||||
self.pushButton_step2.setGeometry(QRect(670, 50, 70, 191))
|
||||
self.pushButton_step2.setFont(font)
|
||||
self.splitter = QSplitter(Form)
|
||||
self.splitter.setObjectName(u"splitter")
|
||||
|
|
@ -122,6 +122,11 @@ class Ui_Form(object):
|
|||
self.horizontalLayout_4.addWidget(self.checkBox_suffix)
|
||||
|
||||
self.splitter.addWidget(self.layoutWidget_4)
|
||||
self.pushButton_commit = QPushButton(Form)
|
||||
self.pushButton_commit.setObjectName(u"pushButton_commit")
|
||||
self.pushButton_commit.setGeometry(QRect(670, 250, 70, 191))
|
||||
self.pushButton_commit.setFont(font)
|
||||
self.pushButton_commit.setStyleSheet(u"background-color: rgb(255, 255, 127);")
|
||||
|
||||
self.retranslateUi(Form)
|
||||
|
||||
|
|
@ -133,7 +138,7 @@ class Ui_Form(object):
|
|||
self.label.setText(QCoreApplication.translate("Form", u"\u8981\u5904\u7406\u7684\u9898\u76ee(\u6309 item \u5207\u5206, \u53ef\u4ee5\u5305\u542b\u6587\u4ef6\u5934)", None))
|
||||
self.pushButton_step1.setText(QCoreApplication.translate("Form", u"\u65b0\u9898\u6bd4\u5bf9", None))
|
||||
self.label_2.setText(QCoreApplication.translate("Form", u"\u542b\u6709\u76f8\u4f3c\u9898\u76ee\u7684LaTeX\u6e90\u4ee3\u7801, \u590d\u5236\u5230LaTeX\u7f16\u8f91\u5668\u4eba\u5de5\u6807\u6ce8", None))
|
||||
self.pushButton_step2.setText(QCoreApplication.translate("Form", u"\u6536\u5f55\u9898\u76ee", None))
|
||||
self.pushButton_step2.setText(QCoreApplication.translate("Form", u"\u9884\u6536\u5f55\u9898\u76ee", None))
|
||||
self.label_3.setText(QCoreApplication.translate("Form", u"\u8d77\u59cbID", None))
|
||||
self.lineEdit_startingid.setInputMask("")
|
||||
self.lineEdit_startingid.setPlaceholderText(QCoreApplication.translate("Form", u"\u6570\u5b57\u9898\u53f7(\u901a\u5e38\u662f10000n+1)", None))
|
||||
|
|
@ -146,5 +151,8 @@ class Ui_Form(object):
|
|||
self.lineEdit_suffix.setText(QCoreApplication.translate("Form", u"\u8bd5\u9898", None))
|
||||
self.lineEdit_suffix.setPlaceholderText(QCoreApplication.translate("Form", u"\u901a\u5e38\u4e3a \u8bd5\u9898", None))
|
||||
self.checkBox_suffix.setText(QCoreApplication.translate("Form", u"\u4f7f\u7528\u540e\u7f00", None))
|
||||
self.pushButton_commit.setText(QCoreApplication.translate("Form", u"\u786e\u8ba4\u63d0\u4ea4\n"
|
||||
"\u81f3\u6570\u636e\u5e93\n"
|
||||
"\u4e0d\u53ef\u9006!!!", None))
|
||||
# retranslateUi
|
||||
|
||||
|
|
|
|||
|
|
@ -538,9 +538,8 @@ def AddRelatedProblemToDB(id,content,oid,editor,database):
|
|||
mydb.close()
|
||||
return id
|
||||
|
||||
def AddProblemstoDict2024(startingid,raworigin,problems,editor,indexed,database): #将来自GenerateProblemListFromString的列表中的题目添加到thedict字典, 返回题号列表(包括用老题号替代的题目)
|
||||
mydb = connect(hostname = db_host, port = db_port, username=db_user, pwd=db_pwd, db = database)
|
||||
mycursor = mydb.cursor()
|
||||
def AddProblemstoDict2024nocommit(startingid,raworigin,problems,editor,indexed,cursor): #将来自GenerateProblemListFromString的列表中的题目添加到thedict字典, 返回题号列表(包括用老题号替代的题目)
|
||||
mycursor = cursor
|
||||
idlist = []
|
||||
id = int(startingid)
|
||||
currentsuffix = problems[0][1]
|
||||
|
|
@ -603,8 +602,6 @@ def AddProblemstoDict2024(startingid,raworigin,problems,editor,indexed,database)
|
|||
else:
|
||||
idlist.append(meta["rep"])
|
||||
print(f"该题 {idlist[-1]} {p} 已在题库中, 不必收录.")
|
||||
mydb.commit()
|
||||
mydb.close()
|
||||
return idlist
|
||||
|
||||
def CreateIDLinks(old_id_list,new_id_list): #建立已有id和新id之间的联系, thedict为可选, 选中的话即为当前字典, 会从new_id_list中排除当前字典中有的项
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class MyWindow_bdsl(QWidget,Ui_Form):
|
|||
self.checkBox_suffix.toggled.connect(self.togglesuffix)
|
||||
self.pushButton_step1.clicked.connect(self.execstep1)
|
||||
self.pushButton_step2.clicked.connect(self.execstep2)
|
||||
self.pushButton_commit.clicked.connect(self.commitchange)
|
||||
def togglesuffix(self):
|
||||
self.suffix_checked = self.checkBox_suffix.isChecked()
|
||||
if self.suffix_checked:
|
||||
|
|
@ -92,11 +93,18 @@ class MyWindow_bdsl(QWidget,Ui_Form):
|
|||
problems = GenerateProblemListFromString2024(data)
|
||||
# pro_dict = load_dict("../题库0.3/Problems.json")
|
||||
nextspareid = NextSpareID(starting_id,self.database_name)
|
||||
idlist = AddProblemstoDict2024(nextspareid,raworigin,problems,editor,Indexed,self.database_name)
|
||||
# save_dict(SortDict(pro_dict),r"../题库0.3/Problems.json")
|
||||
self.db = connect(hostname = db_host, port= db_port, username= db_user, pwd = db_pwd, db= self.database_name)
|
||||
self.cursor = self.db.cursor()
|
||||
idlist = AddProblemstoDict2024nocommit(nextspareid,raworigin,problems,editor,Indexed,self.cursor)
|
||||
AppendTextFile(f"{GetDate()}-{GetTime()}\n{generate_exp(idlist)}",idlistpath)
|
||||
os.system(f"code {idlistpath}")
|
||||
|
||||
def commitchange(self):
|
||||
self.db.commit()
|
||||
self.db.close()
|
||||
print("已提交至数据库")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
<x>670</x>
|
||||
<y>50</y>
|
||||
<width>70</width>
|
||||
<height>400</height>
|
||||
<height>191</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>收录题目</string>
|
||||
<string>预收录题目</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
|
|
@ -205,6 +205,29 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_commit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>670</x>
|
||||
<y>250</y>
|
||||
<width>70</width>
|
||||
<height>191</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 127);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确认提交
|
||||
至数据库
|
||||
不可逆!!!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
20240425-215540
|
||||
024789,000589,024790:024794
|
||||
|
||||
20240426-110335
|
||||
060159:060189,030985,060190,012616,031484,060191,009963,060192,009976,060193,015424,060194:060196,009969,060197,015233,060198,031344,060199:060201,012099,060202:060204,004037,016256,031344,060205:060208,000849,060209:060213,012109,060214:060224,017466:017471,031364,017477:017478,060225,014175,060226,015085,015000,012512,015002,015234,012688,060227:060229,004315,060230:060256,023072,060257,014513,060258:060259,015600,060260:060263,002713,060264,031334,060265,000539,060266:060275,000861,060276:060279,011475,060280,012165,060281:060285,021839,060286:060316
|
||||
|
||||
20240426-123025
|
||||
070001:070031,030985,070032,012616,031484,070033,009963,070034,009976,070035,015424,070036:070038,009969,070039,015233,070040,031344,070041:070043,012099,070044:070046,004037,016256,031344,070047:070050,000849,070051:070055,012109,070056:070066,017466:017471,031364,017477:017478,070067,014175,070068,015085,015000,012512,015002,015234,012688,070069:070071,004315,070072:070098,023072,070099,014513,070100:070101,015600,070102:070105,002713,070106,031334,070107,000539,070108:070117,000861,070118:070121,011475,070122,012165,070123:070127,021839,070128:070158
|
||||
|
||||
|
|
|
|||
Reference in New Issue