From 6ae64f025acc21efe12884eb48a1eb379dd15828 Mon Sep 17 00:00:00 2001 From: "weiye.wang" Date: Sun, 3 Mar 2024 17:21:25 +0800 Subject: [PATCH] =?UTF-8?q?Qt=E9=87=8D=E5=86=99=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=A2=98=E5=8F=B7(pdf=E6=88=96tex)=E5=8A=9F=E8=83=BD,=20?= =?UTF-8?q?=E5=B9=B6=E5=8A=A0=E5=85=A5Qt=E9=9D=A2=E6=9D=BF=20=E4=B8=8E=20?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v2/Qt面板.py | 2 +- 工具v2/Ui_获取题号.py | 62 +++++++++++++++++++++++++ 工具v2/工具面板.py | 2 +- 工具v2/获取题号.py | 33 ++++++++++++++ 工具v2/获取题号.ui | 102 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 199 insertions(+), 2 deletions(-) create mode 100644 工具v2/Ui_获取题号.py create mode 100644 工具v2/获取题号.py create mode 100644 工具v2/获取题号.ui diff --git a/工具v2/Qt面板.py b/工具v2/Qt面板.py index f0d34c09..198c0e23 100644 --- a/工具v2/Qt面板.py +++ b/工具v2/Qt面板.py @@ -41,7 +41,7 @@ class MyWindow(QMainWindow,Ui_MainWindow): self.action_sxth.triggered.connect(lambda: run_command("关键字筛选题号",[]))#已完成 self.action_xtby.triggered.connect(lambda: run_command("指定题号编译pdf",[]))#已完成 self.action_sctp.triggered.connect(lambda: run_command("单一题号转为图片",[]))#已完成 - self.action_hqth.triggered.connect(lambda: run_command("在.tex或.pdf文件中获取题号",["在.tex或.pdf文件中获取题号.py"])) + self.action_hqth.triggered.connect(lambda: run_command("获取题号",[]))#已完成 self.action_jglr.triggered.connect(lambda: run_command("讲义结构编号录入",["讲义结构编号录入.py"])) self.action_dtdy.triggered.connect(lambda: run_command("录入答题纸对应信息",["录入答题纸对应信息.py"])) self.action_jysc.triggered.connect(lambda: run_command("系列讲义生成",[]))#已完成 diff --git a/工具v2/Ui_获取题号.py b/工具v2/Ui_获取题号.py new file mode 100644 index 00000000..5454c656 --- /dev/null +++ b/工具v2/Ui_获取题号.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file '获取题号.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, QLabel, QLineEdit, QPlainTextEdit, + QPushButton, QSizePolicy, QWidget) + +class Ui_Form(object): + def setupUi(self, Form): + if not Form.objectName(): + Form.setObjectName(u"Form") + Form.resize(400, 300) + self.label = QLabel(Form) + self.label.setObjectName(u"label") + self.label.setGeometry(QRect(10, 10, 54, 16)) + self.pushButton_selectfilepath = QPushButton(Form) + self.pushButton_selectfilepath.setObjectName(u"pushButton_selectfilepath") + self.pushButton_selectfilepath.setGeometry(QRect(320, 10, 75, 24)) + self.plainTextEdit = QPlainTextEdit(Form) + self.plainTextEdit.setObjectName(u"plainTextEdit") + self.plainTextEdit.setGeometry(QRect(10, 100, 381, 191)) + self.plainTextEdit.setReadOnly(True) + self.lineEdit = QLineEdit(Form) + self.lineEdit.setObjectName(u"lineEdit") + self.lineEdit.setGeometry(QRect(10, 40, 381, 20)) + self.lineEdit.setReadOnly(True) + self.label_2 = QLabel(Form) + self.label_2.setObjectName(u"label_2") + self.label_2.setGeometry(QRect(10, 80, 54, 16)) + self.pushButton_exec = QPushButton(Form) + self.pushButton_exec.setObjectName(u"pushButton_exec") + self.pushButton_exec.setGeometry(QRect(320, 70, 75, 24)) + font = QFont() + font.setBold(True) + self.pushButton_exec.setFont(font) + + self.retranslateUi(Form) + + QMetaObject.connectSlotsByName(Form) + # setupUi + + def retranslateUi(self, Form): + Form.setWindowTitle(QCoreApplication.translate("Form", u"\u83b7\u53d6\u9898\u53f7", None)) + self.label.setText(QCoreApplication.translate("Form", u"\u6587\u4ef6\u8def\u5f84", None)) + self.pushButton_selectfilepath.setText(QCoreApplication.translate("Form", u"\u9009\u62e9\u6587\u4ef6", None)) + self.label_2.setText(QCoreApplication.translate("Form", u"\u9898\u53f7", None)) + self.pushButton_exec.setText(QCoreApplication.translate("Form", u"\u83b7\u53d6\u9898\u53f7", None)) + # retranslateUi + diff --git a/工具v2/工具面板.py b/工具v2/工具面板.py index 84700708..308276e1 100644 --- a/工具v2/工具面板.py +++ b/工具v2/工具面板.py @@ -127,7 +127,7 @@ menubar.add_cascade(label = "备课", menu = BKMenu) # BKMenu.add_command(label = "新课备课稿合集生成", command = lambda: SetButton("新课备课稿合集生成",["新课备课稿合集生成.py"])) # BKMenu.add_command(label = "单课备课稿生成", command = lambda: SetButton("单课备课稿生成",["单课备课稿生成.py"])) BKMenu.add_command(label = "讲义结构编号录入", command = lambda: SetButton("讲义结构编号录入",["讲义结构编号录入.py"])) -BKMenu.add_command(label = "在.tex或.pdf文件中获取题号", command = lambda: SetButton("在.tex或.pdf文件中获取题号",["在.tex或.pdf文件中获取题号.py"])) +BKMenu.add_command(label = "在.tex或.pdf文件中获取题号", command = lambda: SetButton("获取题号",[])) BKMenu.add_command(label = "录入答题纸对应信息", command = lambda: SetButton("录入答题纸对应信息",["录入答题纸对应信息.py"])) BKMenu.add_command(label = "讲义生成", command = lambda: SetButton("讲义生成",["讲义生成.py"])) BKMenu.add_command(label = "系列讲义生成", command = lambda: SetButton("系列讲义生成",[])) diff --git a/工具v2/获取题号.py b/工具v2/获取题号.py new file mode 100644 index 00000000..ef0d1776 --- /dev/null +++ b/工具v2/获取题号.py @@ -0,0 +1,33 @@ +from PySide6.QtWidgets import QWidget, QApplication, QFileDialog +from Ui_获取题号 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): + self.pushButton_exec.setDisabled(True) + self.pushButton_selectfilepath.clicked.connect(self.selectfilepath) + self.pushButton_exec.clicked.connect(self.exec) + def selectfilepath(self): + self.filepath = QFileDialog.getOpenFileName(self,"选择.tex文件或.pdf文件",os.getcwd(),"tex或pdf文件(*.tex *.pdf);;所有文件(*)")[0] + self.lineEdit.setText(self.filepath) + self.pushButton_exec.setEnabled(True) + def exec(self): + self.plainTextEdit.setPlainText(ExportIDList(self.filepath)) + + + + + + + +if __name__ == '__main__': + app = QApplication([]) + windows = MyWindow() + windows.show() + app.exec() + diff --git a/工具v2/获取题号.ui b/工具v2/获取题号.ui new file mode 100644 index 00000000..135e7854 --- /dev/null +++ b/工具v2/获取题号.ui @@ -0,0 +1,102 @@ + + + Form + + + + 0 + 0 + 400 + 300 + + + + 获取题号 + + + + + 10 + 10 + 54 + 16 + + + + 文件路径 + + + + + + 320 + 10 + 75 + 24 + + + + 选择文件 + + + + + + 10 + 100 + 381 + 191 + + + + true + + + + + + 10 + 40 + 381 + 20 + + + + true + + + + + + 10 + 80 + 54 + 16 + + + + 题号 + + + + + + 320 + 70 + 75 + 24 + + + + + true + + + + 获取题号 + + + + + +