프로젝트

일반

사용자정보

개정판 94092f45

ID94092f45e465807f2b50d73fffce295cdb0fec23
상위 bcee5244
하위 7997a014, e0ed625f

백흠경이(가) 6년 이상 전에 추가함

fixed issue #477:
- Original Point 생성 시 오류 발생 수정

차이점 보기:

DTI_PID/DTI_PID/Commands/OriginalPointCommand.py
1 1
import os.path
2
"""
3
    This is OriginalPointCommand module
4
"""
5

  
6
import sys
2 7
import AbstractCommand
3 8
try:
4
    from PyQt5.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR
9
    from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal
5 10
    from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QColor, QPen, QBrush, QTransform, QCursor
6 11
    from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QMessageBox, QGraphicsEllipseItem
7 12
except ImportError:
8 13
    try:
9 14
        from PyQt4.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR
10
        from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QColor, QPen, QBrush, QCursor
11
        from PyQt4.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QMessageBox, QGraphicsEllipseItem
15
        from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap
16
        from PyQt4.QtGui import QPainterPath, QFileDialog, QColor, QPen, QBrush, QCursor
17
        from PyQt4.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog
18
        from PyQt4.QtWidgets import QMessageBox, QGraphicsEllipseItem
12 19
    except ImportError:
13 20
        raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.")
14 21

  
15
import sys
16

  
17 22
class OriginalPointCommand(AbstractCommand.AbstractCommand):
23
    """
24
    OriginalPointCommand class
25
    """
18 26
    onSuccess = pyqtSignal()
19 27

  
20 28
    '''
......
22 30
    '''
23 31
    def __init__(self, imageViewer, originalPointLineEdit):
24 32
        super(OriginalPointCommand, self).__init__(imageViewer)
25
        self.name = 'OriginalPoint' 
33
        self.name = 'OriginalPoint'
26 34
        self.originalPointLineEdit = originalPointLineEdit
27 35
        self.isSelected = False
28 36
        self.imageViewer.setCursor(QCursor(Qt.CrossCursor))
......
51 59
            if event.button() == Qt.LeftButton:
52 60
                if not self.isSelected:                    
53 61
                    if self.isOnImage(newScenePos.x(), newScenePos.y()):
54
                        OriginalPointCommand.drawCircle(self.imageViewer, newScenePos.x(), newScenePos.y())
62
                        origin = OriginalPointCommand.drawCircle(self.imageViewer, newScenePos.x(), newScenePos.y())
55 63
                        self.isSelected = True
56 64
                        self.originalPointLineEdit.setText("{},{}".format(newScenePos.x(), newScenePos.y()))
57 65
                        self.imageViewer.isOriginalPointSelected = True
58
                        self.onSuccess.emit()
66
                        self.onSuccess.emit(origin)
59 67
                    else:
60 68
                        QMessageBox.about(self.imageViewer, "알림", "심볼 내부를 선택해주세요.")
61 69

  
......
74 82
        @history    2018.06.11  Jeongwoo    Shorten method to add Ellipse
75 83
                    2018.06.12  Jeongwoo    Modify RectF's coords
76 84
                    humkyung 2018.08.28 draw guide lines for origin point
85
                    humkyung 2018.10.02 return origin point
77 86
    '''
78 87
    @staticmethod
79 88
    def drawCircle(imageViewer, x, y):
......
96 105

  
97 106
        imageViewer.scene.addItem(origin)
98 107

  
108
        return origin
109

  
99 110
    '''
100 111
        @history    2018.06.12  Jeongwoo    Add conditions for selecting ellipse item
101 112
    '''
DTI_PID/DTI_PID/MainWindow.py
1149 1149
                    if type(svg) is QEngineeringEquipmentItem:
1150 1150
                        svg.saveEquipData()
1151 1151

  
1152
                    # Equipment Item 경우 저장
1152
                    # Instrument Item 경우 저장
1153 1153
                    if type(svg) is QEngineeringInstrumentItem:
1154 1154
                        svg.saveInstData()
1155 1155
                else:
DTI_PID/DTI_PID/QtImageViewer.py
575 575
        connPts = None
576 576
        strConnPts = symbol.getConnectionPoint()
577 577
        if strConnPts is not None:
578
            connPts = [(float(x.split(',')[0]), float(x.split(',')[1])) for x in strConnPts.split('/')]
578
            connPts = [(float(x.split(',')[0]), float(x.split(',')[1])) if len(x.split(',')) == 2 else (x.split(',')[0], float(x.split(',')[1]), float(x.split(',')[2])) \
579
            for x in strConnPts.split('/')]
579 580

  
580 581
        svg.buildItem(svgFileName, symbol.getType(), 0, None, None, [float(x) for x in symbol.getOriginalPoint().split(',')], connPts, symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getHasInstrumentLabel())
581 582
        
DTI_PID/DTI_PID/Shapes/QEngineeringEquipmentItem.py
95 95
            docData = AppDocData.instance()
96 96
            docData.setEquipmentDataList([self.getEquipmentDataList()])
97 97
        except Exception as ex:
98
            return str(self.uid)
99 98
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
99
            return str(self.uid)
100 100

  
101 101
    '''
102 102
        @brief      return equip Data List

내보내기 Unified diff

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