From ab3c55e7b70c558e43f3dc8617d394db7eec116c Mon Sep 17 00:00:00 2001 From: bgArray <474037765@qq.com> Date: Thu, 5 Jan 2023 23:02:15 +0800 Subject: [PATCH] =?UTF-8?q?2023/1/5=20update-=E7=AA=97=E5=8F=A35=20?= =?UTF-8?q?=E8=BF=99=E4=B8=AA=E9=93=BE=E6=8E=A5-=E6=A7=BD=E5=A5=BD?= =?UTF-8?q?=E6=8A=BD=E8=B1=A1=EF=BC=8C=E6=98=8E=E5=A4=A9=E5=86=8D=E7=A0=94?= =?UTF-8?q?=E7=A9=B6=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mid_analyse.py | 153 ++++++++++++++++++++++++++++++++++++++++++ mid_analyse.ui | 101 ++++++++++++++++++++++++++++ trans_mid_analyse.bat | 1 + 3 files changed, 255 insertions(+) create mode 100644 mid_analyse.py create mode 100644 mid_analyse.ui create mode 100644 trans_mid_analyse.bat diff --git a/mid_analyse.py b/mid_analyse.py new file mode 100644 index 0000000..9542755 --- /dev/null +++ b/mid_analyse.py @@ -0,0 +1,153 @@ +# -*- coding: utf-8 -*- + +########################################################################## +# Form generated from reading UI file 'mid_analyse.ui' +## +# Created by: Qt User Interface Compiler version 6.4.1 +## +# 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, QGroupBox, QHBoxLayout, QLabel, +# QLineEdit, QPushButton, QSizePolicy, QWidget) + +import sys +from PySide6.QtWidgets import QApplication, QWidget, QGroupBox, QPushButton, \ + QLabel, QLineEdit, QHBoxLayout, QFileDialog +from PySide6.QtCore import QRect, QMetaObject, Slot + + +class Ui_Form(QWidget): + def __init__(self): + super().__init__() + self.groupBox = None + self.horizontalLayout = None + self.horizontalLayoutWidget = None + self.close_button = None + self.fileChoseButton = None + self.input_button = None + self.note_count_label = None + self.note_count_shower = None + self.output_button = None + + def setupUi(self, Form): + if not Form.objectName(): + Form.setObjectName(u"Form") + Form.resize(582, 355) + self.groupBox = QGroupBox(Form) + self.groupBox.setObjectName(u"groupBox") + self.groupBox.setGeometry(QRect(10, 0, 561, 311)) + self.fileChoseButton = QPushButton(self.groupBox) + self.fileChoseButton.setObjectName(u"file_chose_button") + self.fileChoseButton.setGeometry(QRect(10, 20, 75, 24)) + self.note_count_label = QLabel(self.groupBox) + self.note_count_label.setObjectName(u"note_count_label") + self.note_count_label.setGeometry(QRect(20, 50, 54, 16)) + self.note_count_shower = QLineEdit(self.groupBox) + self.note_count_shower.setObjectName(u"note_count_shower") + self.note_count_shower.setGeometry(QRect(70, 50, 113, 20)) + self.horizontalLayoutWidget = QWidget(Form) + self.horizontalLayoutWidget.setObjectName(u"horizontalLayoutWidget") + self.horizontalLayoutWidget.setGeometry(QRect(10, 310, 561, 41)) + self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget) + self.horizontalLayout.setObjectName(u"horizontalLayout") + self.horizontalLayout.setContentsMargins(0, 0, 0, 0) + self.input_button = QPushButton(self.horizontalLayoutWidget) + self.input_button.setObjectName(u"input_button") + + self.horizontalLayout.addWidget(self.input_button) + + self.output_button = QPushButton(self.horizontalLayoutWidget) + self.output_button.setObjectName(u"output_button") + + self.horizontalLayout.addWidget(self.output_button) + + self.close_button = QPushButton(self.horizontalLayoutWidget) + self.close_button.setObjectName(u"close_button") + + self.horizontalLayout.addWidget(self.close_button) + + Form.setWindowTitle("Mid解析器") + + self.groupBox.setTitle("mid信息") + self.fileChoseButton.setText("选择文件") + self.note_count_label.setText("音符数") + self.input_button.setText("导入") + self.output_button.setText("导出分析") + self.close_button.setText("关闭") + + QMetaObject.connectSlotsByName(Form) + + # self.ui.btnCalculate.clicked.connect(self.fileLoading) + + def fileLoading(self): + filePath, _ = QFileDialog.getOpenFileName( + self.groupBox, # 父窗口对象 + "选择文件", # 标题 + r"./", # 起始目录 + "mid类型 (*.mid *.midi)" # 选择类型过滤项,过滤内容在括号中 + ) + print(filePath) + + @Slot() + def on_fileChoseButton_clicked(self): + filePath, _ = QFileDialog.getOpenFileName( + self.groupBox, # 父窗口对象 + "选择文件", # 标题 + r"./", # 起始目录 + "mid类型 (*.mid *.midi)" # 选择类型过滤项,过滤内容在括号中 + ) + print(filePath) + + +class MidAnalyseGui(QWidget): + def __init__(self, parent=None): + super().__init__(parent) + self.ui = Ui_Form() + self.ui.setupUi(self) + self.ui.fileChoseButton.clicked.connect(self.fileLoading) + + def fileLoading(self): + filePath, _ = QFileDialog.getOpenFileName( + self.ui.groupBox, # 父窗口对象 + "选择文件", # 标题 + r"./", # 起始目录 + "mid类型 (*.mid *.midi)" # 选择类型过滤项,过滤内容在括号中 + ) + print(filePath) + + @Slot() + def on_fileChoseButton_clicked(self): + filePath, _ = QFileDialog.getOpenFileName( + self.ui.groupBox, # 父窗口对象 + "选择文件", # 标题 + r"./", # 起始目录 + "mid类型 (*.mid *.midi)" # 选择类型过滤项,过滤内容在括号中 + ) + print(filePath) + + +if __name__ == "__main__": + app = QApplication(sys.argv) # 创建一个QApplication,也就是你要开发的软件app + # MainWindow = QMainWindow() # 创建一个QMainWindow,用来装载你需要的各种组件、控件 + # MainWindow = QWidget() # 创建一个QMainWindow,用来装载你需要的各种组件、控件 + ui = MidAnalyseGui() # ui是你创建的ui类的实例化对象 + # ui.setupUi(MainWindow) # 执行类中的setupUi方法,方法的参数是第二步中创建的QMainWindow + ui.show() # 执行QMainWindow的show()方法,显示这个QMainWindow + sys.exit(app.exec()) # 使用exit()或者点击关闭按钮退出QApplication + + +if __name__ == '__main__': + app = QApplication(sys.argv) + MainWindow = QWidget() + ui = Ui_Form() + ui.setupUi(MainWindow) + ui.show() + sys.exit(app.exec()) diff --git a/mid_analyse.ui b/mid_analyse.ui new file mode 100644 index 0000000..64e0613 --- /dev/null +++ b/mid_analyse.ui @@ -0,0 +1,101 @@ + + + Form + + + + 0 + 0 + 582 + 355 + + + + Form + + + + + 10 + 0 + 561 + 311 + + + + mid信息 + + + + + 10 + 20 + 75 + 24 + + + + 选择文件 + + + + + + 20 + 50 + 54 + 16 + + + + 音符数 + + + + + + 70 + 50 + 113 + 20 + + + + + + + + 10 + 310 + 561 + 41 + + + + + + + 导入 + + + + + + + 导出分析 + + + + + + + 关闭 + + + + + + + + + diff --git a/trans_mid_analyse.bat b/trans_mid_analyse.bat new file mode 100644 index 0000000..9528f32 --- /dev/null +++ b/trans_mid_analyse.bat @@ -0,0 +1 @@ +pyside6-uic mid_analyse.ui -o mid_analyse.py \ No newline at end of file