From ebeca8f6f42c8d6465f217730ca29ed214f5b8e6 Mon Sep 17 00:00:00 2001 From: halliday2023 Date: Sun, 11 Feb 2024 21:08:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=EF=BC=9A?= =?UTF-8?q?=201=E3=80=81=E4=BF=AE=E6=94=B9=E6=A0=B7=E5=BC=8F=202=E3=80=81?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=BE=93=E5=87=BA=E5=88=B0=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/GUIWindows.py | 29 ++++++++++++++++---- bin/main.py | 6 ++++- requirements.txt | 2 +- ui/ui_main.ui | 67 ++++++++++++++++++++++++++++++++++++++++++----- 4 files changed, 90 insertions(+), 14 deletions(-) diff --git a/bin/GUIWindows.py b/bin/GUIWindows.py index 79a0fd0..75b1e0f 100644 --- a/bin/GUIWindows.py +++ b/bin/GUIWindows.py @@ -1,13 +1,14 @@ # -*- coding:utf-8 -*- +import sys from pathlib import Path -from PySide6.QtWidgets import QApplication, QMessageBox from PySide6.QtUiTools import loadUiType +from PySide6 import QtWidgets,QtCore + # 定义公共路径 path = Path(__file__) -ui_dir = path.parent.parent / "ui" -ui_file_patch = ui_dir / "ui_main.ui" +ui_file_patch = path.parent.parent / "ui" / "ui_main.ui" # 从文件中加载UI定义 formType, baseType = loadUiType(str(ui_file_patch)) @@ -18,7 +19,25 @@ class Window(formType, baseType): super(Window, self).__init__() self.setupUi(self) + # 输出设置 + self.Log_Output.document().setMaximumBlockCount(100) + self.Log_Output.ensureCursorVisible() + + + @QtCore.Slot() + def start(self): + + self.Log_Output.append('点击了开始按钮') + + + @QtCore.Slot() + def stop(self): + self.Log_Output.append('点击了停止按钮') + + + + @QtCore.Slot() + def conntest(self): + self.Log_Output.append('点击了测试连接按钮') - def handleCalc(self): - pass diff --git a/bin/main.py b/bin/main.py index 95863b1..317a65e 100644 --- a/bin/main.py +++ b/bin/main.py @@ -4,10 +4,14 @@ import sys from GUIWindows import Window from PySide6.QtWidgets import QApplication - +from PySide6 import QtWidgets if __name__ == '__main__': app = QApplication([]) + app.setStyle("Fusion") + # 样式 + # print(QtWidgets.QStyleFactory.keys()) + # print(app.style().name()) win = Window() win.show() sys.exit(app.exec()) diff --git a/requirements.txt b/requirements.txt index 78c7513..1d11a79 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ faker==19.12.0 schedule==1.2.1 JPype1==1.4.1 JayDeBeApi==1.2.3 - +pyside6==6.6.1 diff --git a/ui/ui_main.ui b/ui/ui_main.ui index ba4c60b..f4a0736 100644 --- a/ui/ui_main.ui +++ b/ui/ui_main.ui @@ -24,7 +24,7 @@ - 0 + 1 @@ -50,7 +50,7 @@ 90 - 70 + 80 201 31 @@ -60,7 +60,7 @@ 90 - 110 + 130 201 31 @@ -83,8 +83,8 @@ 20 - 70 - 81 + 80 + 61 31 @@ -96,8 +96,8 @@ 20 - 110 - 81 + 130 + 61 31 @@ -589,5 +589,58 @@ + + startButton + clicked() + MainWindow + start() + + + 98 + 526 + + + 153 + 523 + + + + + stopButton + clicked() + MainWindow + stop() + + + 431 + 531 + + + 492 + 515 + + + + + conn_Button + clicked() + MainWindow + conntest() + + + 82 + 269 + + + 287 + 528 + + + + + start() + stop() + conntest() +