개정판 8fd1d96f
fixed issue #505:
- 드래그시 항목들을 선택하지 않도록 함
DTI_PID/DTI_PID/Commands/AreaZoomCommand.py | ||
---|---|---|
1 | 1 |
import os.path |
2 | 2 |
import AbstractCommand |
3 | 3 |
try: |
4 |
from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR
|
|
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QCursor
|
|
6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog
|
|
4 |
from PyQt5.QtCore import *
|
|
5 |
from PyQt5.QtGui import *
|
|
6 |
from PyQt5.QtWidgets import *
|
|
7 | 7 |
except ImportError: |
8 | 8 |
try: |
9 | 9 |
from PyQt4.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
... | ... | |
11 | 11 |
except ImportError: |
12 | 12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
13 | 13 | |
14 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
15 | ||
14 | 16 |
class AreaZoomCommand(AbstractCommand.AbstractCommand): |
15 | 17 |
onRejected = pyqtSignal(AbstractCommand.AbstractCommand) |
16 | 18 | |
... | ... | |
23 | 25 |
self.imageViewer.setCursor(QCursor(Qt.CrossCursor)) |
24 | 26 |
self.startPoint = None |
25 | 27 |
self.endPoint = None |
28 |
self._shape = None |
|
26 | 29 |
|
27 | 30 |
''' |
28 | 31 |
@brief pan image by left click and drag |
... | ... | |
36 | 39 |
if 'mousePressEvent' == param[0]: |
37 | 40 |
if self.imageViewer.canZoom: |
38 | 41 |
if event.button() == Qt.LeftButton: |
39 |
self.imageViewer.setDragMode(QGraphicsView.RubberBandDrag) |
|
42 |
self.startPoint = scenePos |
|
43 |
if self._shape is None: |
|
44 |
self._shape = QGraphicsBoundingBoxItem(scenePos.x(), scenePos.y(), 0, 0) |
|
45 |
pen = QPen(Qt.DotLine) |
|
46 |
pen.setColor(Qt.red) |
|
47 |
pen.setWidthF(1) |
|
48 |
hilightColor = QColor(255, 0, 0, 127) |
|
49 |
self._shape.setBrush(QBrush(hilightColor)) |
|
50 |
self._shape.setPen(pen) |
|
51 |
self._shape._vertices.append(scenePos) |
|
52 |
self._shape.setSelected(True) |
|
53 |
self.imageViewer.scene.addItem(self._shape) |
|
54 |
self._shape.update() |
|
55 |
|
|
40 | 56 |
self.imageViewer.leftMouseButtonPressed.emit(scenePos.x(), scenePos.y()) |
41 |
self.startPoint = scenePos |
|
57 |
elif 'mouseMoveEvent' == param[0] and event.buttons() == Qt.LeftButton and self._shape is not None: |
|
58 |
self._shape.process(param) |
|
42 | 59 |
elif 'mouseReleaseEvent' == param[0]: |
43 | 60 |
QGraphicsView.mouseReleaseEvent(self.imageViewer, event) |
44 | 61 |
try: |
45 | 62 |
if self.imageViewer.canZoom and event.button() == Qt.LeftButton: |
46 | 63 |
self.endPoint = scenePos |
47 |
viewBBox = self.imageViewer.zoomStack[-1] if len(self.imageViewer.zoomStack) else self.imageViewer.sceneRect() |
|
48 |
selectionBBox = self.imageViewer.scene.selectionArea().boundingRect().intersected(viewBBox) |
|
49 |
self.imageViewer.scene.setSelectionArea(QPainterPath()) # Clear current selection area. |
|
50 |
if selectionBBox.isValid() and (selectionBBox != viewBBox): |
|
64 |
minX = min(self.startPoint.x(), self.endPoint.x()) |
|
65 |
minY = min(self.startPoint.y(), self.endPoint.y()) |
|
66 |
maxX = max(self.startPoint.x(), self.endPoint.x()) |
|
67 |
maxY = max(self.startPoint.y(), self.endPoint.y()) |
|
68 |
selectionBBox = QRectF(minX, minY, maxX - minX, maxY - minY) |
|
69 | ||
70 |
if selectionBBox.isValid(): |
|
51 | 71 |
self.imageViewer.zoomStack.append(selectionBBox) |
52 | 72 |
self.imageViewer.updateViewer() |
53 |
else: |
|
54 |
self.imageViewer.zoomStack.append(QRectF(self.startPoint.x(), self.startPoint.y(), |
|
55 |
self.endPoint.x() - self.startPoint.x(), |
|
56 |
self.endPoint.y() - self.startPoint.y())) |
|
57 |
self.imageViewer.updateViewer() |
|
58 | 73 |
elif event.button() == Qt.RightButton: |
59 | 74 |
self.onRejected.emit(self) |
60 | 75 |
finally: |
61 |
self.imageViewer.setDragMode(QGraphicsView.NoDrag)
|
|
62 |
pass
|
|
76 |
self.imageViewer.scene.removeItem(self._shape)
|
|
77 |
self._shape = None
|
|
63 | 78 | |
64 | 79 |
def undo(self): |
65 | 80 |
pass |
DTI_PID/DTI_PID/ConfigurationAreaDialog.py | ||
---|---|---|
17 | 17 |
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\Shapes') |
18 | 18 |
import EngineeringPolylineItem |
19 | 19 |
from EngineeringLineItem import QEngineeringLineItem |
20 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
20 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
21 | 21 |
import Configuration_Area_UI |
22 | 22 | |
23 | 23 |
class QConfigurationAreaDialog(QDialog): |
DTI_PID/DTI_PID/ConnectAttrDialog.py | ||
---|---|---|
14 | 14 |
from QEngineeringFlowArrowItem import QEngineeringFlowArrowItem |
15 | 15 |
from SymbolSvgItem import SymbolSvgItem |
16 | 16 |
from EngineeringTextItem import QEngineeringTextItem |
17 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
17 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
18 | 18 | |
19 | 19 |
''' |
20 | 20 |
''' |
DTI_PID/DTI_PID/HMBDialog.py | ||
---|---|---|
17 | 17 |
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\Shapes') |
18 | 18 |
import EngineeringPolylineItem |
19 | 19 |
from EngineeringLineItem import QEngineeringLineItem |
20 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
20 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
21 | 21 |
import Configuration_Area_UI |
22 | 22 | |
23 | 23 |
class Worker(QObject): |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
30 | 30 |
from EngineeringPolylineItem import QEngineeringPolylineItem |
31 | 31 |
from EngineeringLineItem import QEngineeringLineItem |
32 | 32 |
from SymbolSvgItem import SymbolSvgItem |
33 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
33 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
34 | 34 |
from EngineeringTextItem import QEngineeringTextItem |
35 | 35 |
from QEngineeringLineNoTextItem import QEngineeringLineNoTextItem |
36 | 36 |
from QEngineeringNoteItem import QEngineeringNoteItem |
... | ... | |
933 | 933 |
history humkyung 2018.06.09 check length of original and connection point is 2 while parsing |
934 | 934 |
''' |
935 | 935 |
def drawDetectedSymbolItem(self, symbolList): |
936 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
936 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
937 | 937 |
from SymbolSvgItem import SymbolSvgItem |
938 | 938 |
import math |
939 | 939 |
DTI_PID/DTI_PID/QRecognitionDialog.py | ||
---|---|---|
17 | 17 |
from QEngineeringFlowArrowItem import QEngineeringFlowArrowItem |
18 | 18 |
from SymbolSvgItem import SymbolSvgItem |
19 | 19 |
from EngineeringTextItem import QEngineeringTextItem |
20 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
20 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
21 | 21 | |
22 | 22 |
from MainWindow import MainWindow |
23 | 23 |
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
17 | 17 | |
18 | 18 |
from QEngineeringAbstractItem import QEngineeringAbstractItem |
19 | 19 |
from EngineeringPolylineItem import QEngineeringPolylineItem |
20 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
20 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
21 | 21 |
import shapely |
22 | 22 | |
23 | 23 |
class QEngineeringLineItem(QGraphicsLineItem, QEngineeringAbstractItem): |
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
14 | 14 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
15 | 15 | |
16 | 16 |
from EngineeringPolylineItem import QEngineeringPolylineItem |
17 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
17 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
18 | 18 |
from OcrResultDialog import QOcrResultDialog |
19 | 19 |
from AppDocData import AppDocData |
20 | 20 |
from QEngineeringAbstractItem import QEngineeringAbstractItem |
DTI_PID/DTI_PID/Shapes/EngineeringUnknownItem.py | ||
---|---|---|
14 | 14 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
15 | 15 | |
16 | 16 |
from EngineeringPolylineItem import QEngineeringPolylineItem |
17 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
17 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
18 | 18 |
from AppDocData import * |
19 | 19 |
from QEngineeringAbstractItem import QEngineeringAbstractItem |
20 | 20 |
DTI_PID/DTI_PID/Shapes/GraphicsBoundingBoxItem.py | ||
---|---|---|
1 |
import os.path |
|
2 |
import copy |
|
3 |
try: |
|
4 |
from PyQt5.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR |
|
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QBrush, QPen |
|
6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QGraphicsItem, QAbstractGraphicsShapeItem, QGraphicsRectItem |
|
7 |
except ImportError: |
|
8 |
try: |
|
9 |
from PyQt4.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR |
|
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog |
|
11 |
except ImportError: |
|
12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
|
13 | ||
14 |
class QGraphicsBoundingBoxItem(QGraphicsRectItem): |
|
15 |
onRemoved = pyqtSignal(QGraphicsItem) |
|
16 | ||
17 |
def __init__(self, x, y, width, height): |
|
18 |
QGraphicsRectItem.__init__(self, x, y, width, height) |
|
19 |
self.setAcceptHoverEvents(True) |
|
20 |
self.setAcceptTouchEvents(True) |
|
21 |
self.isEntered = False |
|
22 |
self.center = self.rect().center() |
|
23 |
self.angle = 0 |
|
24 |
self.isSymbol = False |
|
25 |
self.isCreated = False |
|
26 |
self._vertices = [] |
|
27 | ||
28 |
''' |
|
29 |
@brief construct a bounding box item |
|
30 |
''' |
|
31 |
def process(self, param): |
|
32 |
if ('mouseMoveEvent' == param[0]): |
|
33 |
if len(self._vertices) == 1: |
|
34 |
self._vertices.append(param[2]) |
|
35 |
elif len(self._vertices) > 1: |
|
36 |
self._vertices[1] = param[2] |
|
37 | ||
38 |
if len(self._vertices) == 2: |
|
39 |
x = min(self._vertices[0].x(), self._vertices[1].x()) |
|
40 |
y = min(self._vertices[0].y(), self._vertices[1].y()) |
|
41 |
dx = abs(self._vertices[0].x() - self._vertices[1].x()) |
|
42 |
dy = abs(self._vertices[0].y() - self._vertices[1].y()) |
|
43 |
self.setRect(x, y, dx, dy) |
|
44 |
elif ('mouseReleaseEvent' == param[0]) and (param[1].button() == Qt.LeftButton): |
|
45 |
if len(self._vertices) == 0: |
|
46 |
self._vertices.append(param[2]) |
|
47 |
elif len(self._vertices) == 1: |
|
48 |
self._vertices.append(param[2]) |
|
49 |
elif len(self._vertices) == 2: |
|
50 |
x = min(self._vertices[0].x(), self._vertices[1].x()) |
|
51 |
y = min(self._vertices[0].y(), self._vertices[1].y()) |
|
52 |
dx = abs(self._vertices[0].x() - self._vertices[1].x()) |
|
53 |
dy = abs(self._vertices[0].y() - self._vertices[1].y()) |
|
54 |
self.setRect(x, y, dx, dy) |
|
55 |
self.isCreated = True |
|
56 |
''' |
|
57 |
@brief reshape while mouse drag |
|
58 |
@author humkyung |
|
59 |
@date 2018.08.18 |
|
60 |
''' |
|
61 |
def mouseMoveEvent(self, event): |
|
62 |
if event.button() == Qt.LeftButton: |
|
63 |
scenePos = event.scenePos() |
|
64 | ||
65 |
if len(self._vertices) == 1: |
|
66 |
self._vertices.append(scenePos) |
|
67 |
elif len(self._vertices) > 1: |
|
68 |
self._vertices[1] = scenePos |
|
69 | ||
70 |
if len(self._vertices) == 2: |
|
71 |
x = min(self._vertices[0].x(), self._vertices[1].x()) |
|
72 |
y = min(self._vertices[0].y(), self._vertices[1].y()) |
|
73 |
dx = abs(self._vertices[0].x() - self._vertices[1].x()) |
|
74 |
dy = abs(self._vertices[0].y() - self._vertices[1].y()) |
|
75 |
self.setRect(x, y, dx, dy) |
|
76 | ||
77 |
QGraphicsRectItem.mouseMoveEvent(self, event) |
|
78 | ||
79 |
''' |
|
80 |
@brief |
|
81 |
@author humkyung |
|
82 |
@date 2018.08.18 |
|
83 |
''' |
|
84 |
def mouseReleaseEvent(self, event): |
|
85 |
if event.button() == Qt.LeftButton: |
|
86 |
scenePos = event.scenePos() |
|
87 | ||
88 |
if len(self._vertices) == 0: |
|
89 |
self._vertices.append(scenePos) |
|
90 |
elif len(self._vertices) == 1: |
|
91 |
self._vertices.append(scenePos) |
|
92 |
elif len(self._vertices) == 2: |
|
93 |
x = min(self._vertices[0].x(), self._vertices[1].x()) |
|
94 |
y = min(self._vertices[0].y(), self._vertices[1].y()) |
|
95 |
dx = abs(self._vertices[0].x() - self._vertices[1].x()) |
|
96 |
dy = abs(self._vertices[0].y() - self._vertices[1].y()) |
|
97 |
self.setRect(x, y, dx, dy) |
|
98 |
self.isCreated = True |
|
99 |
|
|
100 |
QGraphicsRectItem.mouseReleaseEvent(self, event) |
|
101 | ||
102 |
''' |
|
103 |
@brief clone an object |
|
104 |
''' |
|
105 |
def clone(self): |
|
106 |
clone = QGraphicsBoundingBoxItem(self.rect().x(), self.rect().y(), self.rect().width(), self.rect().height()) |
|
107 |
clone.isCreated = True |
|
108 |
clone.center = self.center |
|
109 |
return clone |
|
110 | ||
111 |
''' |
|
112 |
@brief initialize |
|
113 |
''' |
|
114 |
def init(self): |
|
115 |
self._vertices = [] |
|
116 |
self.isCreated = False |
|
117 | ||
118 |
def hoverEnterEvent(self, event): |
|
119 |
self.isEntered = True |
|
120 |
self.update() |
|
121 | ||
122 |
def hoverLeaveEvent(self, event): |
|
123 |
self.isEntered = False |
|
124 |
self.update() |
|
125 | ||
126 |
''' |
|
127 |
@brief override paint |
|
128 |
''' |
|
129 |
def paint(self, painter, options=None, widget=None): |
|
130 |
QGraphicsRectItem.paint(self, painter, options, widget) |
|
131 | ||
132 |
if self.isEntered == True: |
|
133 |
painter.setPen(self.pen()) |
|
134 |
painter.drawEllipse(self.center, 5, 5) |
DTI_PID/DTI_PID/Shapes/QEngineeringLineNoTextItem.py | ||
---|---|---|
14 | 14 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
15 | 15 | |
16 | 16 |
from EngineeringPolylineItem import QEngineeringPolylineItem |
17 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
17 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
18 | 18 |
from OcrResultDialog import QOcrResultDialog |
19 | 19 |
from AppDocData import AppDocData |
20 | 20 |
from EngineeringTextItem import QEngineeringTextItem |
DTI_PID/DTI_PID/Shapes/QEngineeringNoteItem.py | ||
---|---|---|
13 | 13 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
14 | 14 | |
15 | 15 |
from EngineeringPolylineItem import QEngineeringPolylineItem |
16 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
16 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
17 | 17 |
import OcrResultDialog |
18 | 18 |
from AppDocData import AppDocData |
19 | 19 |
from EngineeringTextItem import QEngineeringTextItem |
DTI_PID/DTI_PID/Shapes/QEngineeringSizeTextItem.py | ||
---|---|---|
14 | 14 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
15 | 15 | |
16 | 16 |
from EngineeringPolylineItem import QEngineeringPolylineItem |
17 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
17 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
18 | 18 |
import OcrResultDialog |
19 | 19 |
from AppDocData import AppDocData |
20 | 20 |
from EngineeringTextItem import QEngineeringTextItem |
DTI_PID/DTI_PID/Shapes/QEngineeringTagNoTextItem.py | ||
---|---|---|
14 | 14 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
15 | 15 | |
16 | 16 |
from EngineeringPolylineItem import QEngineeringPolylineItem |
17 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
17 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
18 | 18 |
import OcrResultDialog |
19 | 19 |
from AppDocData import AppDocData |
20 | 20 |
from EngineeringTextItem import QEngineeringTextItem |
DTI_PID/DTI_PID/Shapes/QEngineeringTrimLineNoTextItem.py | ||
---|---|---|
14 | 14 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
15 | 15 | |
16 | 16 |
from EngineeringPolylineItem import QEngineeringPolylineItem |
17 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
|
17 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
18 | 18 |
import OcrResultDialog |
19 | 19 |
from AppDocData import AppDocData |
20 | 20 |
from QEngineeringLineNoTextItem import QEngineeringLineNoTextItem |
DTI_PID/DTI_PID/Shapes/QGraphicsBoundingBoxItem.py | ||
---|---|---|
1 |
import os.path |
|
2 |
import copy |
|
3 |
try: |
|
4 |
from PyQt5.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR |
|
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QBrush, QPen |
|
6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QGraphicsItem, QAbstractGraphicsShapeItem, QGraphicsRectItem |
|
7 |
except ImportError: |
|
8 |
try: |
|
9 |
from PyQt4.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR |
|
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog |
|
11 |
except ImportError: |
|
12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
|
13 | ||
14 |
class QGraphicsBoundingBoxItem(QGraphicsRectItem): |
|
15 |
onRemoved = pyqtSignal(QGraphicsItem) |
|
16 | ||
17 |
def __init__(self, x, y, width, height): |
|
18 |
QGraphicsRectItem.__init__(self, x, y, width, height) |
|
19 |
self.setAcceptHoverEvents(True) |
|
20 |
self.isEntered = False |
|
21 |
self.center = self.rect().center() |
|
22 |
self.angle = 0 |
|
23 |
self.isSymbol = False |
|
24 |
self.isCreated = False |
|
25 |
self._vertices = [] |
|
26 | ||
27 |
''' |
|
28 |
@brief construct a bounding box item |
|
29 |
''' |
|
30 |
def process(self, param): |
|
31 |
if ('mouseMoveEvent' == param[0]): |
|
32 |
if len(self._vertices) == 1: |
|
33 |
self._vertices.append(param[2]) |
|
34 |
elif len(self._vertices) > 1: |
|
35 |
self._vertices[1] = param[2] |
|
36 | ||
37 |
if len(self._vertices) == 2: |
|
38 |
x = min(self._vertices[0].x(), self._vertices[1].x()) |
|
39 |
y = min(self._vertices[0].y(), self._vertices[1].y()) |
|
40 |
dx = abs(self._vertices[0].x() - self._vertices[1].x()) |
|
41 |
dy = abs(self._vertices[0].y() - self._vertices[1].y()) |
|
42 |
self.setRect(x, y, dx, dy) |
|
43 |
elif ('mouseReleaseEvent' == param[0]) and (param[1].button() == Qt.LeftButton): |
|
44 |
if len(self._vertices) == 0: |
|
45 |
self._vertices.append(param[2]) |
|
46 |
elif len(self._vertices) == 1: |
|
47 |
self._vertices.append(param[2]) |
|
48 |
elif len(self._vertices) == 2: |
|
49 |
x = min(self._vertices[0].x(), self._vertices[1].x()) |
|
50 |
y = min(self._vertices[0].y(), self._vertices[1].y()) |
|
51 |
dx = abs(self._vertices[0].x() - self._vertices[1].x()) |
|
52 |
dy = abs(self._vertices[0].y() - self._vertices[1].y()) |
|
53 |
self.setRect(x, y, dx, dy) |
|
54 |
self.isCreated = True |
|
55 | ||
56 |
''' |
|
57 |
@brief clone an object |
|
58 |
''' |
|
59 |
def clone(self): |
|
60 |
clone = QGraphicsBoundingBoxItem(self.rect().x(), self.rect().y(), self.rect().width(), self.rect().height()) |
|
61 |
clone.isCreated = True |
|
62 |
clone.center = self.center |
|
63 |
return clone |
|
64 | ||
65 |
''' |
|
66 |
@brief initialize |
|
67 |
''' |
|
68 |
def init(self): |
|
69 |
self._vertices = [] |
|
70 |
self.isCreated = False |
|
71 | ||
72 |
def hoverEnterEvent(self, event): |
|
73 |
self.isEntered = True |
|
74 |
self.update() |
|
75 | ||
76 |
def hoverLeaveEvent(self, event): |
|
77 |
self.isEntered = False |
|
78 |
self.update() |
|
79 | ||
80 |
''' |
|
81 |
@brief override paint |
|
82 |
''' |
|
83 |
def paint(self, painter, options=None, widget=None): |
|
84 |
QGraphicsRectItem.paint(self, painter, options, widget) |
|
85 | ||
86 |
if self.isEntered == True: |
|
87 |
painter.setPen(self.pen()) |
|
88 |
painter.drawEllipse(self.center, 5, 5) |
DTI_PID/DTI_PID/SmartFEED.nsi | ||
---|---|---|
761 | 761 |
File "dist\SmartFEED\Shapes\QEngineeringTagNoTextItem.py" |
762 | 762 |
File "dist\SmartFEED\Shapes\EngineeringTextItem.py" |
763 | 763 |
File "dist\SmartFEED\Shapes\QEngineeringTrimLineNoTextItem.py" |
764 |
File "dist\SmartFEED\Shapes\QGraphicsBoundingBoxItem.py"
|
|
764 |
File "dist\SmartFEED\Shapes\GraphicsBoundingBoxItem.py" |
|
765 | 765 |
File "dist\SmartFEED\Shapes\SymbolSvgItem.py" |
766 | 766 |
File "dist\SmartFEED\Shapes\__init__.py" |
767 | 767 |
SetOutPath "$INSTDIR\Shapes\__pycache__" |
... | ... | |
788 | 788 |
File "dist\SmartFEED\Shapes\__pycache__\EngineeringTextItem.cpython-36.pyc" |
789 | 789 |
File "dist\SmartFEED\Shapes\__pycache__\QEngineeringTrimLineNoTextItem.cpython-36.pyc" |
790 | 790 |
File "dist\SmartFEED\Shapes\__pycache__\QEngineeringUnknownItem.cpython-36.pyc" |
791 |
File "dist\SmartFEED\Shapes\__pycache__\QGraphicsBoundingBoxItem.cpython-36.pyc"
|
|
791 |
File "dist\SmartFEED\Shapes\__pycache__\GraphicsBoundingBoxItem.cpython-36.pyc" |
|
792 | 792 |
File "dist\SmartFEED\Shapes\__pycache__\QGraphicsPolylineItem.cpython-36.pyc" |
793 | 793 |
File "dist\SmartFEED\Shapes\__pycache__\SymbolSvgItem.cpython-36.pyc" |
794 | 794 |
SetOutPath "$INSTDIR" |
... | ... | |
3000 | 3000 |
Delete "$INSTDIR\SingletonInstance.py" |
3001 | 3001 |
Delete "$INSTDIR\Shapes\__pycache__\SymbolSvgItem.cpython-36.pyc" |
3002 | 3002 |
Delete "$INSTDIR\Shapes\__pycache__\QGraphicsPolylineItem.cpython-36.pyc" |
3003 |
Delete "$INSTDIR\Shapes\__pycache__\QGraphicsBoundingBoxItem.cpython-36.pyc"
|
|
3003 |
Delete "$INSTDIR\Shapes\__pycache__\GraphicsBoundingBoxItem.cpython-36.pyc" |
|
3004 | 3004 |
Delete "$INSTDIR\Shapes\__pycache__\QEngineeringUnknownItem.cpython-36.pyc" |
3005 | 3005 |
Delete "$INSTDIR\Shapes\__pycache__\QEngineeringTrimLineNoTextItem.cpython-36.pyc" |
3006 | 3006 |
Delete "$INSTDIR\Shapes\__pycache__\EngineeringTextItem.cpython-36.pyc" |
... | ... | |
3026 | 3026 |
Delete "$INSTDIR\Shapes\__pycache__\EngineeringConnectorItem.cpython-36.pyc" |
3027 | 3027 |
Delete "$INSTDIR\Shapes\__init__.py" |
3028 | 3028 |
Delete "$INSTDIR\Shapes\SymbolSvgItem.py" |
3029 |
Delete "$INSTDIR\Shapes\QGraphicsBoundingBoxItem.py"
|
|
3029 |
Delete "$INSTDIR\Shapes\GraphicsBoundingBoxItem.py" |
|
3030 | 3030 |
Delete "$INSTDIR\Shapes\QEngineeringTrimLineNoTextItem.py" |
3031 | 3031 |
Delete "$INSTDIR\Shapes\EngineeringTextItem.py" |
3032 | 3032 |
Delete "$INSTDIR\Shapes\QEngineeringTagNoTextItem.py" |
내보내기 Unified diff