指定题号编译pdf(原 多种题目编译)功能用Qt重写, 并加入工具面板 及 Qt面板
This commit is contained in:
parent
ada1168cbb
commit
77068d9df8
|
|
@ -39,7 +39,7 @@ class MyWindow(QMainWindow,Ui_MainWindow):
|
||||||
self.action_hbsy.triggered.connect(lambda: run_command("合并使用记录并排序",[]))#已完成
|
self.action_hbsy.triggered.connect(lambda: run_command("合并使用记录并排序",[]))#已完成
|
||||||
self.action_tjjc.triggered.connect(lambda: run_command("添加基础知识梳理",["添加基础知识梳理.py"]))
|
self.action_tjjc.triggered.connect(lambda: run_command("添加基础知识梳理",["添加基础知识梳理.py"]))
|
||||||
self.action_sxth.triggered.connect(lambda: run_command("关键字筛选题号",[]))#已完成
|
self.action_sxth.triggered.connect(lambda: run_command("关键字筛选题号",[]))#已完成
|
||||||
self.action_xtby.triggered.connect(lambda: run_command("多种题目生成",["多种题目生成.py"]))
|
self.action_xtby.triggered.connect(lambda: run_command("指定题号编译pdf",[]))#已完成
|
||||||
self.action_sctp.triggered.connect(lambda: run_command("单一题目转成图片文件",["单一题目转成图片文件.py"]))
|
self.action_sctp.triggered.connect(lambda: run_command("单一题目转成图片文件",["单一题目转成图片文件.py"]))
|
||||||
self.action_hqth.triggered.connect(lambda: run_command("在.tex或.pdf文件中获取题号",["在.tex或.pdf文件中获取题号.py"]))
|
self.action_hqth.triggered.connect(lambda: run_command("在.tex或.pdf文件中获取题号",["在.tex或.pdf文件中获取题号.py"]))
|
||||||
self.action_jglr.triggered.connect(lambda: run_command("讲义结构编号录入",["讲义结构编号录入.py"]))
|
self.action_jglr.triggered.connect(lambda: run_command("讲义结构编号录入",["讲义结构编号录入.py"]))
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,256 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
## Form generated from reading UI file '指定题号编译pdf.ui'
|
||||||
|
##
|
||||||
|
## Created by: Qt User Interface Compiler version 6.6.2
|
||||||
|
##
|
||||||
|
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
|
||||||
|
QMetaObject, QObject, QPoint, QRect,
|
||||||
|
QSize, QTime, QUrl, Qt)
|
||||||
|
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
||||||
|
QFont, QFontDatabase, QGradient, QIcon,
|
||||||
|
QImage, QKeySequence, QLinearGradient, QPainter,
|
||||||
|
QPalette, QPixmap, QRadialGradient, QTransform)
|
||||||
|
from PySide6.QtWidgets import (QApplication, QCheckBox, QHBoxLayout, QLabel,
|
||||||
|
QLineEdit, QPlainTextEdit, QPushButton, QRadioButton,
|
||||||
|
QSizePolicy, QVBoxLayout, QWidget)
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
if not Form.objectName():
|
||||||
|
Form.setObjectName(u"Form")
|
||||||
|
Form.resize(890, 361)
|
||||||
|
self.pushButton_exec = QPushButton(Form)
|
||||||
|
self.pushButton_exec.setObjectName(u"pushButton_exec")
|
||||||
|
self.pushButton_exec.setGeometry(QRect(660, 220, 221, 131))
|
||||||
|
font = QFont()
|
||||||
|
font.setBold(True)
|
||||||
|
self.pushButton_exec.setFont(font)
|
||||||
|
self.label_3 = QLabel(Form)
|
||||||
|
self.label_3.setObjectName(u"label_3")
|
||||||
|
self.label_3.setGeometry(QRect(390, 20, 61, 16))
|
||||||
|
self.lineEdit_path = QLineEdit(Form)
|
||||||
|
self.lineEdit_path.setObjectName(u"lineEdit_path")
|
||||||
|
self.lineEdit_path.setGeometry(QRect(390, 40, 491, 20))
|
||||||
|
self.pushButton_SelectPath = QPushButton(Form)
|
||||||
|
self.pushButton_SelectPath.setObjectName(u"pushButton_SelectPath")
|
||||||
|
self.pushButton_SelectPath.setGeometry(QRect(800, 10, 81, 24))
|
||||||
|
self.verticalLayoutWidget = QWidget(Form)
|
||||||
|
self.verticalLayoutWidget.setObjectName(u"verticalLayoutWidget")
|
||||||
|
self.verticalLayoutWidget.setGeometry(QRect(390, 80, 81, 271))
|
||||||
|
self.verticalLayout = QVBoxLayout(self.verticalLayoutWidget)
|
||||||
|
self.verticalLayout.setObjectName(u"verticalLayout")
|
||||||
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.label_4 = QLabel(self.verticalLayoutWidget)
|
||||||
|
self.label_4.setObjectName(u"label_4")
|
||||||
|
self.label_4.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignVCenter)
|
||||||
|
|
||||||
|
self.verticalLayout.addWidget(self.label_4)
|
||||||
|
|
||||||
|
self.radioButton_student = QRadioButton(self.verticalLayoutWidget)
|
||||||
|
self.radioButton_student.setObjectName(u"radioButton_student")
|
||||||
|
self.radioButton_student.setChecked(True)
|
||||||
|
|
||||||
|
self.verticalLayout.addWidget(self.radioButton_student)
|
||||||
|
|
||||||
|
self.radioButton_teacher = QRadioButton(self.verticalLayoutWidget)
|
||||||
|
self.radioButton_teacher.setObjectName(u"radioButton_teacher")
|
||||||
|
|
||||||
|
self.verticalLayout.addWidget(self.radioButton_teacher)
|
||||||
|
|
||||||
|
self.verticalLayoutWidget_2 = QWidget(Form)
|
||||||
|
self.verticalLayoutWidget_2.setObjectName(u"verticalLayoutWidget_2")
|
||||||
|
self.verticalLayoutWidget_2.setGeometry(QRect(490, 80, 151, 271))
|
||||||
|
self.verticalLayout_2 = QVBoxLayout(self.verticalLayoutWidget_2)
|
||||||
|
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
|
||||||
|
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.label_5 = QLabel(self.verticalLayoutWidget_2)
|
||||||
|
self.label_5.setObjectName(u"label_5")
|
||||||
|
|
||||||
|
self.verticalLayout_2.addWidget(self.label_5)
|
||||||
|
|
||||||
|
self.checkBox_space = QCheckBox(self.verticalLayoutWidget_2)
|
||||||
|
self.checkBox_space.setObjectName(u"checkBox_space")
|
||||||
|
|
||||||
|
self.verticalLayout_2.addWidget(self.checkBox_space)
|
||||||
|
|
||||||
|
self.checkBox_ans = QCheckBox(self.verticalLayoutWidget_2)
|
||||||
|
self.checkBox_ans.setObjectName(u"checkBox_ans")
|
||||||
|
|
||||||
|
self.verticalLayout_2.addWidget(self.checkBox_ans)
|
||||||
|
|
||||||
|
self.checkBox_objs = QCheckBox(self.verticalLayoutWidget_2)
|
||||||
|
self.checkBox_objs.setObjectName(u"checkBox_objs")
|
||||||
|
self.checkBox_objs.setCheckable(True)
|
||||||
|
self.checkBox_objs.setTristate(False)
|
||||||
|
|
||||||
|
self.verticalLayout_2.addWidget(self.checkBox_objs)
|
||||||
|
|
||||||
|
self.checkBox_tags = QCheckBox(self.verticalLayoutWidget_2)
|
||||||
|
self.checkBox_tags.setObjectName(u"checkBox_tags")
|
||||||
|
|
||||||
|
self.verticalLayout_2.addWidget(self.checkBox_tags)
|
||||||
|
|
||||||
|
self.checkBox_solution = QCheckBox(self.verticalLayoutWidget_2)
|
||||||
|
self.checkBox_solution.setObjectName(u"checkBox_solution")
|
||||||
|
|
||||||
|
self.verticalLayout_2.addWidget(self.checkBox_solution)
|
||||||
|
|
||||||
|
self.checkBox_usages = QCheckBox(self.verticalLayoutWidget_2)
|
||||||
|
self.checkBox_usages.setObjectName(u"checkBox_usages")
|
||||||
|
|
||||||
|
self.verticalLayout_2.addWidget(self.checkBox_usages)
|
||||||
|
|
||||||
|
self.checkBox_origin = QCheckBox(self.verticalLayoutWidget_2)
|
||||||
|
self.checkBox_origin.setObjectName(u"checkBox_origin")
|
||||||
|
|
||||||
|
self.verticalLayout_2.addWidget(self.checkBox_origin)
|
||||||
|
|
||||||
|
self.checkBox_remark = QCheckBox(self.verticalLayoutWidget_2)
|
||||||
|
self.checkBox_remark.setObjectName(u"checkBox_remark")
|
||||||
|
|
||||||
|
self.verticalLayout_2.addWidget(self.checkBox_remark)
|
||||||
|
|
||||||
|
self.verticalLayoutWidget_3 = QWidget(Form)
|
||||||
|
self.verticalLayoutWidget_3.setObjectName(u"verticalLayoutWidget_3")
|
||||||
|
self.verticalLayoutWidget_3.setGeometry(QRect(660, 80, 222, 121))
|
||||||
|
self.verticalLayout_usagepanel = QVBoxLayout(self.verticalLayoutWidget_3)
|
||||||
|
self.verticalLayout_usagepanel.setObjectName(u"verticalLayout_usagepanel")
|
||||||
|
self.verticalLayout_usagepanel.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.label_6 = QLabel(self.verticalLayoutWidget_3)
|
||||||
|
self.label_6.setObjectName(u"label_6")
|
||||||
|
|
||||||
|
self.verticalLayout_usagepanel.addWidget(self.label_6)
|
||||||
|
|
||||||
|
self.horizontalLayout = QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName(u"horizontalLayout")
|
||||||
|
self.label_9 = QLabel(self.verticalLayoutWidget_3)
|
||||||
|
self.label_9.setObjectName(u"label_9")
|
||||||
|
|
||||||
|
self.horizontalLayout.addWidget(self.label_9)
|
||||||
|
|
||||||
|
self.lineEdit_high = QLineEdit(self.verticalLayoutWidget_3)
|
||||||
|
self.lineEdit_high.setObjectName(u"lineEdit_high")
|
||||||
|
self.lineEdit_high.setEnabled(True)
|
||||||
|
|
||||||
|
self.horizontalLayout.addWidget(self.lineEdit_high)
|
||||||
|
|
||||||
|
self.label_10 = QLabel(self.verticalLayoutWidget_3)
|
||||||
|
self.label_10.setObjectName(u"label_10")
|
||||||
|
|
||||||
|
self.horizontalLayout.addWidget(self.label_10)
|
||||||
|
|
||||||
|
self.lineEdit_low = QLineEdit(self.verticalLayoutWidget_3)
|
||||||
|
self.lineEdit_low.setObjectName(u"lineEdit_low")
|
||||||
|
|
||||||
|
self.horizontalLayout.addWidget(self.lineEdit_low)
|
||||||
|
|
||||||
|
|
||||||
|
self.verticalLayout_usagepanel.addLayout(self.horizontalLayout)
|
||||||
|
|
||||||
|
self.label_7 = QLabel(self.verticalLayoutWidget_3)
|
||||||
|
self.label_7.setObjectName(u"label_7")
|
||||||
|
|
||||||
|
self.verticalLayout_usagepanel.addWidget(self.label_7)
|
||||||
|
|
||||||
|
self.lineEdit_grades = QLineEdit(self.verticalLayoutWidget_3)
|
||||||
|
self.lineEdit_grades.setObjectName(u"lineEdit_grades")
|
||||||
|
|
||||||
|
self.verticalLayout_usagepanel.addWidget(self.lineEdit_grades)
|
||||||
|
|
||||||
|
self.plainTextEdit_allitems = QPlainTextEdit(Form)
|
||||||
|
self.plainTextEdit_allitems.setObjectName(u"plainTextEdit_allitems")
|
||||||
|
self.plainTextEdit_allitems.setGeometry(QRect(10, 160, 371, 191))
|
||||||
|
self.label = QLabel(Form)
|
||||||
|
self.label.setObjectName(u"label")
|
||||||
|
self.label.setGeometry(QRect(10, 140, 54, 16))
|
||||||
|
self.label_2 = QLabel(Form)
|
||||||
|
self.label_2.setObjectName(u"label_2")
|
||||||
|
self.label_2.setGeometry(QRect(11, 11, 60, 16))
|
||||||
|
self.plainTextEdit_newitems = QPlainTextEdit(Form)
|
||||||
|
self.plainTextEdit_newitems.setObjectName(u"plainTextEdit_newitems")
|
||||||
|
self.plainTextEdit_newitems.setGeometry(QRect(10, 30, 371, 71))
|
||||||
|
self.widget = QWidget(Form)
|
||||||
|
self.widget.setObjectName(u"widget")
|
||||||
|
self.widget.setGeometry(QRect(90, 110, 241, 28))
|
||||||
|
self.horizontalLayout_4 = QHBoxLayout(self.widget)
|
||||||
|
self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
|
||||||
|
self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.pushButton_add = QPushButton(self.widget)
|
||||||
|
self.pushButton_add.setObjectName(u"pushButton_add")
|
||||||
|
|
||||||
|
self.horizontalLayout_4.addWidget(self.pushButton_add)
|
||||||
|
|
||||||
|
self.horizontalLayout_3 = QHBoxLayout()
|
||||||
|
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
|
||||||
|
self.pushButton_delete = QPushButton(self.widget)
|
||||||
|
self.pushButton_delete.setObjectName(u"pushButton_delete")
|
||||||
|
|
||||||
|
self.horizontalLayout_3.addWidget(self.pushButton_delete)
|
||||||
|
|
||||||
|
self.horizontalLayout_2 = QHBoxLayout()
|
||||||
|
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
|
||||||
|
self.label_11 = QLabel(self.widget)
|
||||||
|
self.label_11.setObjectName(u"label_11")
|
||||||
|
self.label_11.setMaximumSize(QSize(20, 16777215))
|
||||||
|
|
||||||
|
self.horizontalLayout_2.addWidget(self.label_11)
|
||||||
|
|
||||||
|
self.lineEdit_index = QLineEdit(self.widget)
|
||||||
|
self.lineEdit_index.setObjectName(u"lineEdit_index")
|
||||||
|
self.lineEdit_index.setMaximumSize(QSize(20, 16777215))
|
||||||
|
|
||||||
|
self.horizontalLayout_2.addWidget(self.lineEdit_index)
|
||||||
|
|
||||||
|
self.label_12 = QLabel(self.widget)
|
||||||
|
self.label_12.setObjectName(u"label_12")
|
||||||
|
self.label_12.setMaximumSize(QSize(20, 16777215))
|
||||||
|
|
||||||
|
self.horizontalLayout_2.addWidget(self.label_12)
|
||||||
|
|
||||||
|
|
||||||
|
self.horizontalLayout_3.addLayout(self.horizontalLayout_2)
|
||||||
|
|
||||||
|
|
||||||
|
self.horizontalLayout_4.addLayout(self.horizontalLayout_3)
|
||||||
|
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
|
||||||
|
QMetaObject.connectSlotsByName(Form)
|
||||||
|
# setupUi
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
Form.setWindowTitle(QCoreApplication.translate("Form", u"\u6307\u5b9a\u9898\u53f7\u7f16\u8bd1", None))
|
||||||
|
self.pushButton_exec.setText(QCoreApplication.translate("Form", u"\u5f00\u59cb\u751f\u6210\u4e0e\u7f16\u8bd1", None))
|
||||||
|
self.label_3.setText(QCoreApplication.translate("Form", u"\u6587\u4ef6\u8def\u5f84", None))
|
||||||
|
self.pushButton_SelectPath.setText(QCoreApplication.translate("Form", u"\u9009\u62e9\u8def\u5f84", None))
|
||||||
|
self.label_4.setText(QCoreApplication.translate("Form", u"\u7248\u5f0f\u9009\u62e9", None))
|
||||||
|
self.radioButton_student.setText(QCoreApplication.translate("Form", u"\u5b66\u751f\u7248", None))
|
||||||
|
self.radioButton_teacher.setText(QCoreApplication.translate("Form", u"\u6559\u5e08\u7248", None))
|
||||||
|
self.label_5.setText(QCoreApplication.translate("Form", u"\u5185\u5bb9\u9009\u9879", None))
|
||||||
|
self.checkBox_space.setText(QCoreApplication.translate("Form", u"\u9898\u540e\u7a7a\u95f4", None))
|
||||||
|
self.checkBox_ans.setText(QCoreApplication.translate("Form", u"\u7b54\u6848", None))
|
||||||
|
self.checkBox_objs.setText(QCoreApplication.translate("Form", u"\u8bfe\u65f6\u76ee\u6807", None))
|
||||||
|
self.checkBox_tags.setText(QCoreApplication.translate("Form", u"\u9898\u76ee\u6807\u7b7e", None))
|
||||||
|
self.checkBox_solution.setText(QCoreApplication.translate("Form", u"\u89e3\u7b54\u4e0e\u63d0\u793a", None))
|
||||||
|
self.checkBox_usages.setText(QCoreApplication.translate("Form", u"\u4f7f\u7528\u8bb0\u5f55", None))
|
||||||
|
self.checkBox_origin.setText(QCoreApplication.translate("Form", u"\u6765\u6e90", None))
|
||||||
|
self.checkBox_remark.setText(QCoreApplication.translate("Form", u"\u5907\u6ce8", None))
|
||||||
|
self.label_6.setText(QCoreApplication.translate("Form", u"\u4f7f\u7528\u8bb0\u5f55\u9009\u62e9(\u90fd\u7559\u7a7a\u4e3a\u5168\u663e\u793a)", None))
|
||||||
|
self.label_9.setText(QCoreApplication.translate("Form", u"\u9ad8", None))
|
||||||
|
self.label_10.setText(QCoreApplication.translate("Form", u"\u4f4e", None))
|
||||||
|
self.label_7.setText(QCoreApplication.translate("Form", u"\u5c4a\u522b\u9009\u62e9(\u7528 \",\" \u5206\u9694, \u7559\u7a7a\u4e3a\u5168\u663e\u793a)", None))
|
||||||
|
self.label.setText(QCoreApplication.translate("Form", u"\u9898\u53f7\u5217\u8868", None))
|
||||||
|
self.label_2.setText(QCoreApplication.translate("Form", u"\u6807\u9898\u4e0e\u9898\u53f7", None))
|
||||||
|
self.plainTextEdit_newitems.setPlaceholderText(QCoreApplication.translate("Form", u"\u5982: \u96c6\u5408: 2:30,32 \u6216 \"\u96c6\u5408\": \"2:30\", \"\u51fd\u6570\": \"5,60,71:75\"(\u53ef\u6709\u56de\u8f66)", None))
|
||||||
|
self.pushButton_add.setText(QCoreApplication.translate("Form", u"\u6dfb\u52a0\u4e00\u9879\u6216\u591a\u9879", None))
|
||||||
|
self.pushButton_delete.setText(QCoreApplication.translate("Form", u"\u5220\u53bb\u4e00\u9879", None))
|
||||||
|
self.label_11.setText(QCoreApplication.translate("Form", u"\u7b2c", None))
|
||||||
|
self.label_12.setText(QCoreApplication.translate("Form", u"\u9879", None))
|
||||||
|
# retranslateUi
|
||||||
|
|
||||||
|
|
@ -109,7 +109,7 @@ UseMenu.add_separator()
|
||||||
UseMenu.add_command(label = "学生讲义制作", command = lambda: SetButton("学生讲义制作",["学生讲义制作.py"]))
|
UseMenu.add_command(label = "学生讲义制作", command = lambda: SetButton("学生讲义制作",["学生讲义制作.py"]))
|
||||||
UseMenu.add_command(label = "教师讲义制作", command = lambda: SetButton("教师讲义制作",["教师讲义制作.py"]))
|
UseMenu.add_command(label = "教师讲义制作", command = lambda: SetButton("教师讲义制作",["教师讲义制作.py"]))
|
||||||
UseMenu.add_command(label = "批量讲义生成", command = lambda: SetButton("批量讲义生成",["批量讲义生成.py"]))
|
UseMenu.add_command(label = "批量讲义生成", command = lambda: SetButton("批量讲义生成",["批量讲义生成.py"]))
|
||||||
UseMenu.add_command(label = "多种题目生成", command = lambda: SetButton("多种题目生成",["多种题目生成.py"]))
|
UseMenu.add_command(label = "指定题号编译pdf", command = lambda: SetButton("指定题号编译pdf",[]))
|
||||||
UseMenu.add_separator()
|
UseMenu.add_separator()
|
||||||
UseMenu.add_command(label = "文件夹题号清点", command = lambda: SetButton("文件夹题号清点",["文件夹题号清点.py"]))
|
UseMenu.add_command(label = "文件夹题号清点", command = lambda: SetButton("文件夹题号清点",["文件夹题号清点.py"]))
|
||||||
UseMenu.add_command(label = "参考答案生成", command = lambda: SetButton("参考答案生成",["参考答案生成.py"]))
|
UseMenu.add_command(label = "参考答案生成", command = lambda: SetButton("参考答案生成",["参考答案生成.py"]))
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,161 @@
|
||||||
|
from PySide6.QtWidgets import QWidget, QApplication, QFileDialog
|
||||||
|
from Ui_指定题号编译pdf import Ui_Form
|
||||||
|
import os
|
||||||
|
from database_tools import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class MyWindow(QWidget,Ui_Form):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.setupUi(self)
|
||||||
|
self.bind()
|
||||||
|
def bind(self):
|
||||||
|
outputpath = os.path.join(os.getcwd(),"临时文件")
|
||||||
|
self.lineEdit_path.setText(outputpath)
|
||||||
|
self.TitleID_list = []
|
||||||
|
self.TeachersCheckBoxList = [self.checkBox_ans,self.checkBox_objs,self.checkBox_tags,self.checkBox_solution,self.checkBox_usages,self.checkBox_origin,self.checkBox_remark]
|
||||||
|
self.StudentsCheckBoxList = [self.checkBox_space,self.checkBox_ans]
|
||||||
|
self.ContnetCheckBoxList = [self.checkBox_ans,self.checkBox_objs,self.checkBox_tags,self.checkBox_solution,self.checkBox_usages,self.checkBox_origin,self.checkBox_remark,self.checkBox_space]
|
||||||
|
for widget in self.ContnetCheckBoxList:
|
||||||
|
widget.setDisabled(True)
|
||||||
|
self.studentlayout()
|
||||||
|
self.disableusagessetting()
|
||||||
|
self.pushButton_exec.clicked.connect(self.saveandbuild)
|
||||||
|
self.pushButton_add.clicked.connect(self.additems)
|
||||||
|
self.pushButton_delete.clicked.connect(self.deleteitem)
|
||||||
|
self.pushButton_SelectPath.clicked.connect(self.selectpath)
|
||||||
|
self.radioButton_teacher.clicked.connect(self.teacherlayout)
|
||||||
|
self.radioButton_student.clicked.connect(self.studentlayout)
|
||||||
|
self.checkBox_usages.clicked.connect(self.toggleusagessetting)
|
||||||
|
self.radioButton_student.clicked.connect(self.toggleusagessetting)
|
||||||
|
self.radioButton_teacher.clicked.connect(self.toggleusagessetting)
|
||||||
|
def selectpath(self):
|
||||||
|
outputpath = QFileDialog.getExistingDirectory(self,"选择文件夹")
|
||||||
|
self.lineEdit_path.setText(outputpath)
|
||||||
|
def additems(self):
|
||||||
|
toAddString = self.plainTextEdit_newitems.toPlainText()
|
||||||
|
try:
|
||||||
|
toAddList = TitleIDStringtoTupleList(toAddString)
|
||||||
|
self.TitleID_list += toAddList.copy()
|
||||||
|
except:
|
||||||
|
print("待添加字符串格式有误, 请检查")
|
||||||
|
self.plainTextEdit_allitems.setPlainText(TitleIDTupleListtoString(self.TitleID_list))
|
||||||
|
def deleteitem(self):
|
||||||
|
enum = int(self.lineEdit_index.text())-1
|
||||||
|
self.TitleID_list.pop(enum)
|
||||||
|
self.plainTextEdit_allitems.setPlainText(TitleIDTupleListtoString(self.TitleID_list))
|
||||||
|
|
||||||
|
def disableusagessetting(self):
|
||||||
|
self.lineEdit_high.setDisabled(True)
|
||||||
|
self.lineEdit_low.setDisabled(True)
|
||||||
|
self.lineEdit_grades.setDisabled(True)
|
||||||
|
def enableusagessetting(self):
|
||||||
|
self.lineEdit_high.setEnabled(True)
|
||||||
|
self.lineEdit_low.setEnabled(True)
|
||||||
|
self.lineEdit_grades.setEnabled(True)
|
||||||
|
def toggleusagessetting(self):
|
||||||
|
if self.checkBox_usages.isChecked() and self.radioButton_teacher.isChecked():
|
||||||
|
self.enableusagessetting()
|
||||||
|
else:
|
||||||
|
self.disableusagessetting()
|
||||||
|
def studentlayout(self):
|
||||||
|
for widget in self.TeachersCheckBoxList:
|
||||||
|
widget.setDisabled(True)
|
||||||
|
for widget in self.StudentsCheckBoxList:
|
||||||
|
widget.setEnabled(True)
|
||||||
|
|
||||||
|
def teacherlayout(self):
|
||||||
|
for widget in self.StudentsCheckBoxList:
|
||||||
|
widget.setDisabled(True)
|
||||||
|
for widget in self.TeachersCheckBoxList:
|
||||||
|
widget.setEnabled(True)
|
||||||
|
def generate_usages(self):
|
||||||
|
high = self.lineEdit_high.text().strip()
|
||||||
|
low = self.lineEdit_low.text().strip()
|
||||||
|
if self.checkBox_usages.isChecked() == False:
|
||||||
|
return [-2,-2]
|
||||||
|
elif self.checkBox_usages.isChecked() and high == "" and low == "":
|
||||||
|
return [-1,-1]
|
||||||
|
else:
|
||||||
|
if high == "":
|
||||||
|
high = "0"
|
||||||
|
if low == "":
|
||||||
|
low = "0"
|
||||||
|
return [int(high),int(low)]
|
||||||
|
def saveandbuild(self):
|
||||||
|
if self.radioButton_teacher.isChecked() and self.checkBox_usages.isChecked() and not self.lineEdit_grades.text().strip() == "":
|
||||||
|
grades = self.lineEdit_grades.text().strip().split(",")
|
||||||
|
else:
|
||||||
|
grades = []
|
||||||
|
prodictpath = "../题库0.3/problems.json"
|
||||||
|
objdictpath = "../题库0.3/lessonobj.json"
|
||||||
|
raw_pro_dict = load_dict(prodictpath)
|
||||||
|
pro_dict = select_grade_from_pro_dict(raw_pro_dict,grades)
|
||||||
|
obj_dict = load_dict(objdictpath)
|
||||||
|
configjson = {
|
||||||
|
"教师版": self.radioButton_teacher.isChecked(),
|
||||||
|
"字段显示设置": {
|
||||||
|
"题后空间": self.checkBox_space.isChecked(),
|
||||||
|
"课时目标": self.checkBox_objs.isChecked(),
|
||||||
|
"题目标签": self.checkBox_tags.isChecked(),
|
||||||
|
"答案": self.checkBox_ans.isChecked(),
|
||||||
|
"解答与提示": self.checkBox_solution.isChecked(),
|
||||||
|
"使用记录": self.generate_usages(),
|
||||||
|
"来源": self.checkBox_origin.isChecked(),
|
||||||
|
"备注": self.checkBox_remark.isChecked(),
|
||||||
|
"届别": grades
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
notetitle = "选题编译"
|
||||||
|
outputdir = self.lineEdit_path.text() #输出文件的目录
|
||||||
|
outputfilepath = os.path.join(outputdir,notetitle+".tex")
|
||||||
|
print("输出文件目录: %s\n输出文件名: %s"%(outputdir,notetitle+".tex"))
|
||||||
|
|
||||||
|
latex_raw = ReadTextFile("模板文件/讲义模板.txt")
|
||||||
|
if configjson["教师版"] == True:
|
||||||
|
latex_raw = latex_raw.replace(r"学号\blank{50} \ 姓名\blank{80}","上海市控江中学")
|
||||||
|
|
||||||
|
if sys.platform != "win32": #非win系统用默认字体
|
||||||
|
latex_raw = re.sub(r"fontset[\s]*=[\s]*none","fontset = fandol",latex_raw)
|
||||||
|
latex_raw = re.sub(r"\\setCJKmainfont",r"% \\setCJKmainfont",latex_raw)
|
||||||
|
|
||||||
|
bodystring = "\\tableofcontents\n\n\\newpage\n\n"
|
||||||
|
bodylist = []
|
||||||
|
# problems_dict = configjson["标题与题号"]
|
||||||
|
starttime = time.time()
|
||||||
|
|
||||||
|
for p,IDs in self.TitleID_list:
|
||||||
|
currentbodystring = f"\\section{{{p}}}\n\\begin{{enumerate}}\n\n"
|
||||||
|
for id in generate_number_set(IDs):
|
||||||
|
if id in pro_dict:
|
||||||
|
currentbodystring += generateLaTeXBodyContent(id,pro_dict,obj_dict,configjson)
|
||||||
|
currentbodystring += "\\end{enumerate}"
|
||||||
|
bodylist.append(currentbodystring)
|
||||||
|
bodystring += "\n\n\\newpage\n\n".join(bodylist)
|
||||||
|
|
||||||
|
midtime = time.time()
|
||||||
|
print(f"生成LaTeX文件所花时间: {midtime-starttime:.3f}秒")
|
||||||
|
|
||||||
|
latex_data = StringSubstitute(r"<<[\s\S]*?待替换[\s\S]*?>>",latex_raw,(notetitle,bodystring)) #替换标题和bodystring
|
||||||
|
SaveTextFile(latex_data,outputfilepath) #保存.tex文件
|
||||||
|
|
||||||
|
if XeLaTeXCompile(outputdir,notetitle+".tex"):
|
||||||
|
print("编译成功")
|
||||||
|
else:
|
||||||
|
print("编译失败")
|
||||||
|
|
||||||
|
endtime = time.time()
|
||||||
|
print(f"生成pdf文件所花时间: {endtime-midtime:.3f}秒")
|
||||||
|
self.close()
|
||||||
|
os.startfile(self.lineEdit_path.text())
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app = QApplication([])
|
||||||
|
windows = MyWindow()
|
||||||
|
windows.show()
|
||||||
|
app.exec()
|
||||||
|
|
||||||
|
|
@ -0,0 +1,369 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Form</class>
|
||||||
|
<widget class="QWidget" name="Form">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>890</width>
|
||||||
|
<height>361</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>指定题号编译</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QPushButton" name="pushButton_exec">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>660</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>221</width>
|
||||||
|
<height>131</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>开始生成与编译</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>390</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>61</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>文件路径</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_path">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>390</x>
|
||||||
|
<y>40</y>
|
||||||
|
<width>491</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="pushButton_SelectPath">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>800</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>81</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>选择路径</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="verticalLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>390</x>
|
||||||
|
<y>80</y>
|
||||||
|
<width>81</width>
|
||||||
|
<height>271</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>版式选择</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButton_student">
|
||||||
|
<property name="text">
|
||||||
|
<string>学生版</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButton_teacher">
|
||||||
|
<property name="text">
|
||||||
|
<string>教师版</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="verticalLayoutWidget_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>490</x>
|
||||||
|
<y>80</y>
|
||||||
|
<width>151</width>
|
||||||
|
<height>271</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>内容选项</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_space">
|
||||||
|
<property name="text">
|
||||||
|
<string>题后空间</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_ans">
|
||||||
|
<property name="text">
|
||||||
|
<string>答案</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_objs">
|
||||||
|
<property name="text">
|
||||||
|
<string>课时目标</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="tristate">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_tags">
|
||||||
|
<property name="text">
|
||||||
|
<string>题目标签</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_solution">
|
||||||
|
<property name="text">
|
||||||
|
<string>解答与提示</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_usages">
|
||||||
|
<property name="text">
|
||||||
|
<string>使用记录</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_origin">
|
||||||
|
<property name="text">
|
||||||
|
<string>来源</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_remark">
|
||||||
|
<property name="text">
|
||||||
|
<string>备注</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="verticalLayoutWidget_3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>660</x>
|
||||||
|
<y>80</y>
|
||||||
|
<width>222</width>
|
||||||
|
<height>121</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_usagepanel">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>使用记录选择(都留空为全显示)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>高</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_high">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="text">
|
||||||
|
<string>低</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_low"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>届别选择(用 "," 分隔, 留空为全显示)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_grades"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPlainTextEdit" name="plainTextEdit_allitems">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>160</y>
|
||||||
|
<width>371</width>
|
||||||
|
<height>191</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>140</y>
|
||||||
|
<width>54</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>题号列表</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>11</x>
|
||||||
|
<y>11</y>
|
||||||
|
<width>60</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>标题与题号</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPlainTextEdit" name="plainTextEdit_newitems">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>30</y>
|
||||||
|
<width>371</width>
|
||||||
|
<height>71</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>如: 集合: 2:30,32 或 "集合": "2:30", "函数": "5,60,71:75"(可有回车)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>90</x>
|
||||||
|
<y>110</y>
|
||||||
|
<width>241</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_add">
|
||||||
|
<property name="text">
|
||||||
|
<string>添加一项或多项</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_delete">
|
||||||
|
<property name="text">
|
||||||
|
<string>删去一项</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>第</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_index">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>项</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
Reference in New Issue