프로젝트

일반

사용자정보

개정판 bceea84f

IDbceea84f90fde26301c54c1cbae2fe7c0b10e364
상위 462a3fdb
하위 f46260ea

함의성이(가) 5년 이상 전에 추가함

issue #538: symbol display fix

Change-Id: Ic4f73bd1337e32dff48f3bdf3b3bb692dee177b3

차이점 보기:

DTI_PID/DTI_PID/QSymbolDisplayDialog.py
3 3
from PyQt5.QtWidgets import *
4 4
from PyQt5.QtGui import *
5 5
from QtImageViewer import QtImageViewer
6
import UI_SymbolDisplay
6
import SymbolDisplay_UI
7 7

  
8 8
class QSymbolDisplayDialog(QDialog):
9
    def __init__(self, image):
9
    def __init__(self, image, image2=None):
10 10
        QDialog.__init__(self)
11 11
        self.image = image
12
        self.ui = UI_SymbolDisplay.Ui_Dialog()
12
        self.image2 = image2
13
        self.ui = SymbolDisplay_UI.Ui_Dialog()
13 14
        self.ui.setupUi(self)
14 15
        self.setupImageViewer()
15 16

  
......
20 21
        width = self.frameGeometry().width()
21 22
        height = self.frameGeometry().height()
22 23
        self.ui.imageView = QtImageViewer()
23
        self.ui.imageView.setGeometry(QtCore.QRect(0, 0, height, height))
24
        self.ui.imageView.setGeometry(QtCore.QRect(0, 0, width, height))
24 25
        self.ui.imageView.aspectRatioMode = QtCore.Qt.KeepAspectRatio
25 26
        self.ui.imageView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
26 27
        self.ui.imageView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
......
31 32
        self.imgH = image.height()
32 33
        image = image.scaled(self.imgW, self.imgH)
33 34
        self.ui.imageView.setImage(image)
34
        self.ui.verticalLayout_2.addWidget(self.ui.imageView)
35
        self.ui.horizontalLayout.addWidget(self.ui.imageView)
36

  
37
        if self.image2:
38
            self.ui.imageView2 = QtImageViewer()
39
            self.ui.imageView2.setGeometry(QtCore.QRect(0, 0, height, height))
40
            self.ui.imageView2.aspectRatioMode = QtCore.Qt.KeepAspectRatio
41
            self.ui.imageView2.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
42
            self.ui.imageView2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
43
            self.ui.imageView2.canZoom = True
44
            self.ui.imageView2.canPan = True
45
            image2 = self.image2.copy()
46
            self.imgW2 = image2.width()
47
            self.imgH2 = image2.height()
48
            image2 = image2.scaled(self.imgW2, self.imgH2)
49
            self.ui.imageView2.setImage(image2)
50
            self.ui.horizontalLayout.addWidget(self.ui.imageView2)
35 51
        
36 52
    '''
37 53
        @brief  Display this QDialog
DTI_PID/DTI_PID/SymbolDisplay_UI.py
1
# -*- coding: utf-8 -*-
2

  
3
# Form implementation generated from reading ui file './UI/SymbolDisplay.ui'
4
#
5
# Created by: PyQt5 UI code generator 5.11.3
6
#
7
# WARNING! All changes made in this file will be lost!
8

  
9
from PyQt5 import QtCore, QtGui, QtWidgets
10

  
11
class Ui_Dialog(object):
12
    def setupUi(self, Dialog):
13
        Dialog.setObjectName("Dialog")
14
        Dialog.resize(720, 720)
15
        Dialog.setMinimumSize(QtCore.QSize(720, 720))
16
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog)
17
        self.verticalLayout_2.setObjectName("verticalLayout_2")
18
        self.horizontalLayout = QtWidgets.QHBoxLayout()
19
        self.horizontalLayout.setObjectName("horizontalLayout")
20
        self.verticalLayout_2.addLayout(self.horizontalLayout)
21

  
22
        self.retranslateUi(Dialog)
23
        QtCore.QMetaObject.connectSlotsByName(Dialog)
24

  
25
    def retranslateUi(self, Dialog):
26
        _translate = QtCore.QCoreApplication.translate
27
        Dialog.setWindowTitle(_translate("Dialog", "Symbol"))
28

  
29

  
30
if __name__ == "__main__":
31
    import sys
32
    app = QtWidgets.QApplication(sys.argv)
33
    Dialog = QtWidgets.QDialog()
34
    ui = Ui_Dialog()
35
    ui.setupUi(Dialog)
36
    Dialog.show()
37
    sys.exit(app.exec_())
38

  
DTI_PID/DTI_PID/SymbolTreeWidget.py
108 108
        try:
109 109
            sym = self.getSymbolByItemName(item, columnNo)
110 110
            if sym is not None:
111
                # origin symbol image
111 112
                path = sym.getPath()
112 113
                image = QImage(path, "PNG")
113
                dialog = QSymbolDisplayDialog.QSymbolDisplayDialog(image)
114
                # symbol image for display
115
                path = os.path.splitext(path)
116
                path = path[0] + '_display' + path[1]
117
                image2 = QImage(path, "PNG") if os.path.exists(path) else None
118
                dialog = QSymbolDisplayDialog.QSymbolDisplayDialog(image, image2)
114 119
                dialog.showDialog()
115 120
            else:
116 121
                QMessageBox.about(self, self.tr('Error'), self.tr('Error occurs during loading symbol data.'))
DTI_PID/DTI_PID/UI/SymbolDisplay.ui
17 17
   </size>
18 18
  </property>
19 19
  <property name="windowTitle">
20
   <string>Dialog</string>
20
   <string>Symbol</string>
21 21
  </property>
22
  <layout class="QVBoxLayout" name="verticalLayout_2"/>
22
  <layout class="QVBoxLayout" name="verticalLayout_2">
23
   <item>
24
    <layout class="QHBoxLayout" name="horizontalLayout"/>
25
   </item>
26
  </layout>
23 27
 </widget>
24 28
 <resources/>
25 29
 <connections/>
DTI_PID/DTI_PID/UI_SymbolDisplay.py
1
# -*- coding: utf-8 -*-
2

  
3
# Form implementation generated from reading ui file 'SymbolDisplay.ui'
4
#
5
# Created by: PyQt5 UI code generator 5.6
6
#
7
# WARNING! All changes made in this file will be lost!
8

  
9
from PyQt5 import QtCore, QtGui, QtWidgets
10

  
11
class Ui_Dialog(object):
12
    def setupUi(self, Dialog):
13
        Dialog.setObjectName("Dialog")
14
        Dialog.resize(720, 720)
15
        Dialog.setMinimumSize(QtCore.QSize(720, 720))
16
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog)
17
        self.verticalLayout_2.setObjectName("verticalLayout_2")
18

  
19
        self.retranslateUi(Dialog)
20
        QtCore.QMetaObject.connectSlotsByName(Dialog)
21

  
22
    def retranslateUi(self, Dialog):
23
        _translate = QtCore.QCoreApplication.translate
24
        Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
25

  
26

  
27
if __name__ == "__main__":
28
    import sys
29
    app = QtWidgets.QApplication(sys.argv)
30
    Dialog = QtWidgets.QDialog()
31
    ui = Ui_Dialog()
32
    ui.setupUi(Dialog)
33
    Dialog.show()
34
    sys.exit(app.exec_())
35

  

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)