hytos / DTI_PID / DTI_PID / QSymbolDisplayDialog.py @ b6406480
이력 | 보기 | 이력해설 | 다운로드 (1.46 KB)
1 |
# coding: utf-8
|
---|---|
2 |
from PyQt5 import QtCore, QtGui, QtWidgets |
3 |
from PyQt5.QtWidgets import * |
4 |
from PyQt5.QtGui import * |
5 |
from QtImageViewer import QtImageViewer |
6 |
import UI_SymbolDisplay |
7 |
|
8 |
class QSymbolDisplayDialog(QDialog): |
9 |
def __init__(self, image): |
10 |
QDialog.__init__(self)
|
11 |
self.image = image
|
12 |
self.ui = UI_SymbolDisplay.Ui_Dialog()
|
13 |
self.ui.setupUi(self) |
14 |
self.setupImageViewer()
|
15 |
|
16 |
'''
|
17 |
@brief Set up QtImageViewer and QImage
|
18 |
'''
|
19 |
def setupImageViewer(self): |
20 |
width = self.frameGeometry().width()
|
21 |
height = self.frameGeometry().height()
|
22 |
self.ui.imageView = QtImageViewer()
|
23 |
self.ui.imageView.setGeometry(QtCore.QRect(0, 0, height, height)) |
24 |
self.ui.imageView.aspectRatioMode = QtCore.Qt.KeepAspectRatio
|
25 |
self.ui.imageView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
|
26 |
self.ui.imageView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
|
27 |
self.ui.imageView.canZoom = True |
28 |
self.ui.imageView.canPan = True |
29 |
image = self.image.copy()
|
30 |
self.imgW = image.width()
|
31 |
self.imgH = image.height()
|
32 |
image = image.scaled(self.imgW, self.imgH) |
33 |
self.ui.imageView.setImage(image)
|
34 |
self.ui.verticalLayout_2.addWidget(self.ui.imageView) |
35 |
|
36 |
'''
|
37 |
@brief Display this QDialog
|
38 |
'''
|
39 |
def showDialog(self): |
40 |
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint) |
41 |
self.exec_()
|