单一题号转为图片功能现可自由输入前缀信息

This commit is contained in:
wangweiye7840 2024-03-12 18:12:45 +08:00
parent bee6b52377
commit 21ffb28195
3 changed files with 38 additions and 3 deletions

View File

@ -22,7 +22,7 @@ class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(278, 69)
Form.resize(278, 97)
self.label = QLabel(Form)
self.label.setObjectName(u"label")
self.label.setGeometry(QRect(10, 10, 31, 16))
@ -41,6 +41,12 @@ class Ui_Form(object):
self.pushButton_open = QPushButton(Form)
self.pushButton_open.setObjectName(u"pushButton_open")
self.pushButton_open.setGeometry(QRect(200, 10, 75, 51))
self.label_3 = QLabel(Form)
self.label_3.setObjectName(u"label_3")
self.label_3.setGeometry(QRect(10, 70, 51, 16))
self.lineEdit_message = QLineEdit(Form)
self.lineEdit_message.setObjectName(u"lineEdit_message")
self.lineEdit_message.setGeometry(QRect(70, 70, 201, 20))
self.retranslateUi(Form)
@ -53,5 +59,7 @@ class Ui_Form(object):
self.label_2.setText(QCoreApplication.translate("Form", u"DPI", None))
self.pushButton_convert.setText(QCoreApplication.translate("Form", u"\u8f6c\u6362", None))
self.pushButton_open.setText(QCoreApplication.translate("Form", u"\u6253\u5f00", None))
self.label_3.setText(QCoreApplication.translate("Form", u"\u9644\u52a0\u6587\u5b57", None))
self.lineEdit_message.setPlaceholderText(QCoreApplication.translate("Form", u"\u8f93\u5165\u9644\u52a0\u6587\u5b57, \u7559\u7a7a\u8868\u793a\u65e0\u9644\u52a0\u6587\u5b57", None))
# retranslateUi

View File

@ -21,7 +21,8 @@ class MyWindow(QWidget,Ui_Form):
self.id = self.lineEdit_ID.text()
self.dpi = self.lineEdit_dpi.text()
pro_dict = load_dict("../题库0.3/Problems.json")
content = pro_dict[self.id.zfill(6)]["content"]
prefix = self.lineEdit_message.text().strip()
content = f"{prefix} {pro_dict[self.id.zfill(6)]['content']}"
latex_raw = ReadTextFile("模板文件/独立文件模板.txt")
latexdata = StringSubstitute(r"<<待替换\d*>>",latex_raw,[content])
makedir("临时文件/pics")

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>278</width>
<height>69</height>
<height>97</height>
</rect>
</property>
<property name="windowTitle">
@ -85,6 +85,32 @@
<string>打开</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>51</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>附加文字</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_message">
<property name="geometry">
<rect>
<x>70</x>
<y>70</y>
<width>201</width>
<height>20</height>
</rect>
</property>
<property name="placeholderText">
<string>输入附加文字, 留空表示无附加文字</string>
</property>
</widget>
</widget>
<resources/>
<connections/>