Skip to content

Commit

Permalink
v0.2.0 添加了本地查看功能,可以利用Windows自带的图片查看器查看图片
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimweaker committed Feb 28, 2024
1 parent f0e3991 commit 592a2c7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
9 changes: 9 additions & 0 deletions label.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import subprocess
from PySide6 import QtCore, QtWidgets
from PySide6.QtWidgets import QMessageBox
from PySide6.QtGui import QPixmap, QIcon
Expand All @@ -24,6 +25,7 @@ def __init__(self):
self.saveButton.clicked.connect(self.save)
self.restoreButton.clicked.connect(self.restore)
self.jumpButton.clicked.connect(self.jump)
self.openButton.clicked.connect(self.open)

self.scaled_ratio = 1.0

Expand Down Expand Up @@ -120,6 +122,13 @@ def wheelEvent(self, event):
self.scaled_ratio = 0.1
self.show_image()

def open(self):
try:
subprocess.Popen(['start', self.manager.image_path], shell=True)
except Exception as e:
print(e)



if __name__ == "__main__":
app = QApplication(sys.argv)
Expand Down
15 changes: 14 additions & 1 deletion mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>741</width>
<height>457</height>
<height>456</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -246,6 +246,19 @@
<string>跳转</string>
</property>
</widget>
<widget class="QPushButton" name="openButton">
<property name="geometry">
<rect>
<x>640</x>
<y>20</y>
<width>75</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>本地查看</string>
</property>
</widget>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
Expand Down
6 changes: 5 additions & 1 deletion ui_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Ui_MainWindow(object):
def setupUi(self, MainWindow):
if not MainWindow.objectName():
MainWindow.setObjectName(u"MainWindow")
MainWindow.resize(741, 457)
MainWindow.resize(741, 456)
self.centralwidget = QWidget(MainWindow)
self.centralwidget.setObjectName(u"centralwidget")
self.groupBox = QGroupBox(self.centralwidget)
Expand Down Expand Up @@ -83,6 +83,9 @@ def setupUi(self, MainWindow):
self.jumpButton = QPushButton(self.groupBox_3)
self.jumpButton.setObjectName(u"jumpButton")
self.jumpButton.setGeometry(QRect(580, 20, 51, 31))
self.openButton = QPushButton(self.groupBox_3)
self.openButton.setObjectName(u"openButton")
self.openButton.setGeometry(QRect(640, 20, 75, 31))
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(MainWindow)
self.menubar.setObjectName(u"menubar")
Expand Down Expand Up @@ -114,5 +117,6 @@ def retranslateUi(self, MainWindow):
self.jumptextLabel.setText(QCoreApplication.translate("MainWindow", u"\u8df3\u8f6c\u7f16\u53f7\uff1a", None))
self.lineEdit_2.setInputMask("")
self.jumpButton.setText(QCoreApplication.translate("MainWindow", u"\u8df3\u8f6c", None))
self.openButton.setText(QCoreApplication.translate("MainWindow", u"\u672c\u5730\u67e5\u770b", None))
# retranslateUi

0 comments on commit 592a2c7

Please sign in to comment.