diff --git a/main.py b/main.py index c38d38c..79daf89 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,6 @@ import sys import webbrowser -from pyperclip import copy +import pyperclip from PySide6 import QtWidgets from PySide6.QtWidgets import * @@ -21,6 +21,8 @@ def __init__(self, parent = None) : self.ui.dx_jd.clicked.connect(self.dx_jd) self.ui.dx_gs.clicked.connect(self.dx_gs) self.ui.about.clicked.connect(self.about) + self.ui.copy_1.clicked.connect(self.copy_1) + self.ui.copy_2.clicked.connect(self.copy_2) self.ui.copy_tp.clicked.connect(self.copy_tp) @@ -50,7 +52,15 @@ def about(self): def copy_tp(self): global tp - copy(tp) + pyperclip.copy(tp) + + def copy_1(self): + self.ui.xyt_1.setText(pyperclip.paste()) + + def copy_2(self): + self.ui.xyt_2.setText(pyperclip.paste()) + + diff --git a/qtgui.ui b/qtgui.ui index 02c1696..22a7580 100644 --- a/qtgui.ui +++ b/qtgui.ui @@ -52,9 +52,6 @@ - - - @@ -124,16 +121,6 @@ li.checked::marker { content: "\2612"; } - - - - - 200 - 0 - - - - @@ -165,6 +152,40 @@ li.checked::marker { content: "\2612"; } + + + + + 200 + 0 + + + + + + + + + 200 + 0 + + + + + + + + 读取剪贴板 + + + + + + + 读取剪贴板 + + + print_out label @@ -178,6 +199,8 @@ li.checked::marker { content: "\2612"; } about label_4 copy_tp + copy_1 + copy_2 diff --git a/qtgui_ui.py b/qtgui_ui.py index c0554c9..be82cf9 100644 --- a/qtgui_ui.py +++ b/qtgui_ui.py @@ -50,11 +50,6 @@ def setupUi(self, MainWindow): self.gridLayout.addWidget(self.label_3, 2, 0, 1, 2) - self.xyt_1 = QLineEdit(self.centralwidget) - self.xyt_1.setObjectName(u"xyt_1") - - self.gridLayout.addWidget(self.xyt_1, 1, 2, 1, 2) - self.dx_gs = QPushButton(self.centralwidget) self.dx_gs.setObjectName(u"dx_gs") self.dx_gs.setEnabled(True) @@ -87,12 +82,6 @@ def setupUi(self, MainWindow): self.gridLayout.addWidget(self.print_out, 1, 4, 3, 2) - self.xyt_2 = QLineEdit(self.centralwidget) - self.xyt_2.setObjectName(u"xyt_2") - self.xyt_2.setMinimumSize(QSize(200, 0)) - - self.gridLayout.addWidget(self.xyt_2, 2, 2, 1, 2) - self.label_2 = QLabel(self.centralwidget) self.label_2.setObjectName(u"label_2") self.label_2.setFont(font1) @@ -106,6 +95,28 @@ def setupUi(self, MainWindow): self.gridLayout.addWidget(self.copy_tp, 4, 3, 1, 2) + self.xyt_1 = QLineEdit(self.centralwidget) + self.xyt_1.setObjectName(u"xyt_1") + self.xyt_1.setMinimumSize(QSize(200, 0)) + + self.gridLayout.addWidget(self.xyt_1, 1, 2, 1, 1) + + self.xyt_2 = QLineEdit(self.centralwidget) + self.xyt_2.setObjectName(u"xyt_2") + self.xyt_2.setMinimumSize(QSize(200, 0)) + + self.gridLayout.addWidget(self.xyt_2, 2, 2, 1, 1) + + self.copy_1 = QPushButton(self.centralwidget) + self.copy_1.setObjectName(u"copy_1") + + self.gridLayout.addWidget(self.copy_1, 1, 3, 1, 1) + + self.copy_2 = QPushButton(self.centralwidget) + self.copy_2.setObjectName(u"copy_2") + + self.gridLayout.addWidget(self.copy_2, 2, 3, 1, 1) + MainWindow.setCentralWidget(self.centralwidget) self.print_out.raise_() self.label.raise_() @@ -119,6 +130,8 @@ def setupUi(self, MainWindow): self.about.raise_() self.label_4.raise_() self.copy_tp.raise_() + self.copy_1.raise_() + self.copy_2.raise_() self.retranslateUi(MainWindow) @@ -150,5 +163,7 @@ def retranslateUi(self, MainWindow): "\u884c\u4f30\u7b97

", None)) self.label_2.setText(QCoreApplication.translate("MainWindow", u"\u4f4d\u7f6e1\uff08\u59cb\u7ec8\u9700\u8981\uff09\uff1a", None)) self.copy_tp.setText(QCoreApplication.translate("MainWindow", u"\u590d\u5236TP\u6307\u4ee4", None)) + self.copy_1.setText(QCoreApplication.translate("MainWindow", u"\u8bfb\u53d6\u526a\u8d34\u677f", None)) + self.copy_2.setText(QCoreApplication.translate("MainWindow", u"\u8bfb\u53d6\u526a\u8d34\u677f", None)) # retranslateUi