개정판 35bbca8a
issue #503: add vendor item before data
Change-Id: I64714d8ad2df2f25a28b0cfe3606860d5720e557
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
211 | 211 |
self.actionViewLine.triggered.connect(self.onViewLine) |
212 | 212 |
self.actionViewUnknown.triggered.connect(self.onViewUnknown) |
213 | 213 |
self.actionViewInconsistency.triggered.connect(self.onViewInconsistency) |
214 |
self.actionViewVendor_Area.triggered.connect(self.onViewVendorArea) |
|
214 | 215 |
self.actionRotate.triggered.connect(self.onRotate) |
215 | 216 |
self.actionZoom.triggered.connect(self.onAreaZoom) |
216 | 217 |
self.actionVendor.triggered.connect(self.onVendor) |
... | ... | |
788 | 789 |
try: |
789 | 790 |
count = len(self.actionVendor.tag._polyline._vertices) |
790 | 791 |
if count > 2: |
792 |
qPoints = [] |
|
791 | 793 |
points = [] |
792 | 794 |
for point in self.actionVendor.tag._polyline._vertices: |
793 |
points.append(QPoint(round(point[0]), round(point[1]))) |
|
794 |
vendorArea = QPolygonF(points) |
|
795 |
vendorItem = QEngineeringVendorItem(vendorArea) |
|
795 |
points.append([round(point[0]), round(point[1])]) |
|
796 |
qPoints.append(QPoint(round(point[0]), round(point[1]))) |
|
797 |
vendorArea = QPolygonF(qPoints) |
|
798 |
vendorItem = QEngineeringVendorItem(vendorArea, points) |
|
799 |
vendorItem.transfer.onRemoved.connect(self.itemRemoved) |
|
796 | 800 |
self.graphicsView.scene.addItem(vendorItem) |
797 | 801 |
finally: |
798 | 802 |
self.graphicsView.scene.removeItem(self.actionVendor.tag._polyline) |
... | ... | |
1179 | 1183 |
self.actionViewLine.setChecked(checked) |
1180 | 1184 |
self.actionViewUnknown.setChecked(checked) |
1181 | 1185 |
self.actionViewInconsistency.setChecked(checked) |
1186 |
self.actionViewVendor_Area.setChecked(not checked) |
|
1182 | 1187 |
self.actionDrawing_Only.setChecked(not checked) |
1183 | 1188 |
if clear: |
1184 | 1189 |
self.tableWidgetInconsistency.clearContents() |
... | ... | |
1238 | 1243 |
|
1239 | 1244 |
def onViewInconsistency(self, isChecked): |
1240 | 1245 |
''' |
1241 |
@brief visible/invisible Inconsistency |
|
1242 |
@author euisung |
|
1243 |
@date 2019.04.03 |
|
1246 |
@brief visible/invisible Inconsistency
|
|
1247 |
@author euisung
|
|
1248 |
@date 2019.04.03
|
|
1244 | 1249 |
''' |
1245 | 1250 |
selected = [item for item in self.graphicsView.scene.items() if type(item) is QEngineeringErrorItem] |
1246 | 1251 |
for item in selected: |
... | ... | |
1256 | 1261 |
for item in selected: |
1257 | 1262 |
item.setVisible(isChecked) |
1258 | 1263 |
|
1264 |
def onViewVendorArea(self, isChecked): |
|
1265 |
''' |
|
1266 |
@brief visible/invisible Vendor Area |
|
1267 |
@author euisung |
|
1268 |
@date 2019.04.29 |
|
1269 |
''' |
|
1270 |
selected = [item for item in self.graphicsView.scene.items() if type(item) is QEngineeringVendorItem] |
|
1271 |
for item in selected: |
|
1272 |
item.setVisible(isChecked) |
|
1273 |
|
|
1274 |
|
|
1259 | 1275 |
''' |
1260 | 1276 |
@brief create a symbol |
1261 | 1277 |
@history 2018.05.02 Jeongwoo Change return value of QSymbolEditorDialog (Single variable → Tuple) |
... | ... | |
1438 | 1454 |
else: |
1439 | 1455 |
self.onViewInconsistency(True) |
1440 | 1456 |
self.actionViewInconsistency.setChecked(True) |
1457 |
elif event.key() == Qt.Key_7: |
|
1458 |
if self.actionViewVendor_Area.isChecked(): |
|
1459 |
self.onViewVendorArea(False) |
|
1460 |
self.actionViewVendor_Area.setChecked(False) |
|
1461 |
else: |
|
1462 |
self.onViewVendorArea(True) |
|
1463 |
self.actionViewVendor_Area.setChecked(True) |
|
1441 | 1464 |
elif event.key() == 96: # '`' key |
1442 | 1465 |
if self.actionDrawing_Only.isChecked(): |
1443 | 1466 |
self.onViewDrawingOnly(False) |
DTI_PID/DTI_PID/MainWindow_UI.py | ||
---|---|---|
429 | 429 |
icon14.addPixmap(QtGui.QPixmap(":/newPrefix/vendor.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
430 | 430 |
self.actionVendor.setIcon(icon14) |
431 | 431 |
self.actionVendor.setObjectName("actionVendor") |
432 |
self.actionViewVendor_Area = QtWidgets.QAction(MainWindow) |
|
433 |
self.actionViewVendor_Area.setCheckable(True) |
|
434 |
self.actionViewVendor_Area.setObjectName("actionViewVendor_Area") |
|
432 | 435 |
self.menu.addAction(self.actionOpen) |
433 | 436 |
self.menu.addAction(self.actionArea) |
434 | 437 |
self.menu.addAction(self.actionConfiguration) |
... | ... | |
450 | 453 |
self.menu_3.addSeparator() |
451 | 454 |
self.menu_3.addAction(self.actionViewUnknown) |
452 | 455 |
self.menu_3.addAction(self.actionViewInconsistency) |
456 |
self.menu_3.addAction(self.actionViewVendor_Area) |
|
453 | 457 |
self.menu_3.addSeparator() |
454 | 458 |
self.menu_3.addAction(self.actionDrawing_Only) |
455 | 459 |
self.menu_4.addAction(self.actionpdf_to_image) |
... | ... | |
560 | 564 |
self.actionDrawing_Only.setText(_translate("MainWindow", "Drawing Only ( ` )")) |
561 | 565 |
self.actionVendor.setText(_translate("MainWindow", "Vendor")) |
562 | 566 |
self.actionVendor.setToolTip(_translate("MainWindow", "Set Vendor Package")) |
567 |
self.actionViewVendor_Area.setText(_translate("MainWindow", "Vendor Area(7)")) |
|
563 | 568 |
|
564 | 569 |
import MainWindow_rc |
565 | 570 |
|
DTI_PID/DTI_PID/Shapes/EngineeringVendorItem.py | ||
---|---|---|
15 | 15 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
16 | 16 |
|
17 | 17 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
18 |
from EngineeringConnectorItem import QEngineeringConnectorItem |
|
18 | 19 |
|
19 | 20 |
class QEngineeringVendorItem(QGraphicsPolygonItem, QEngineeringAbstractItem): |
20 | 21 |
""" |
21 | 22 |
This is vendor package item |
22 | 23 |
""" |
23 |
def __init__(self, polygon, parent=None): |
|
24 |
ZVALUE = 100 |
|
25 |
def __init__(self, polygon, points, parent=None): |
|
24 | 26 |
import uuid |
25 | 27 |
|
26 | 28 |
QGraphicsPolygonItem.__init__(self, polygon, parent) |
27 | 29 |
QEngineeringAbstractItem.__init__(self) |
28 | 30 |
|
29 | 31 |
self.uid = uuid.uuid4() |
30 |
self.conns = []
|
|
32 |
self.points = points
|
|
31 | 33 |
|
32 | 34 |
self.setColor(self._color) |
33 | 35 |
self._savedColor = None |
34 | 36 |
|
37 |
self.setFlags(QGraphicsItem.ItemIsSelectable|QGraphicsItem.ItemIsFocusable) |
|
38 |
|
|
39 |
self.transfer = Transfer() |
|
40 |
|
|
41 |
for point in self.points: |
|
42 |
connector = QEngineeringConnectorItem(parent=self) |
|
43 |
connector.setPos((point[0], point[1])) |
|
44 |
connector.setParentItem(self) |
|
45 |
connector.setZValue(QEngineeringVendorItem.ZVALUE) |
|
46 |
connector.setFlags(QGraphicsItem.ItemIsSelectable|QGraphicsItem.ItemIsFocusable) |
|
47 |
connector.setAcceptTouchEvents(True) |
|
48 |
connector.transfer.onPosChanged.connect(self.onConnectorPosChaned) |
|
49 |
self.connectors.append(connector) |
|
50 |
|
|
35 | 51 |
def setColor(self, color): |
36 | 52 |
c = QColor() |
37 | 53 |
c.setNamedColor(color) |
38 | 54 |
_pen = self.pen() |
39 | 55 |
_pen.setColor(c) |
40 | 56 |
self.setPen(_pen) |
41 |
self.update() |
|
57 |
self.update() |
|
58 |
|
|
59 |
def onConnectorPosChaned(self, connector): |
|
60 |
found = -1 |
|
61 |
for i in range(len(self.connectors)): |
|
62 |
if self.connectors[i] is connector: |
|
63 |
found = i |
|
64 |
break |
|
65 |
|
|
66 |
if found != -1: |
|
67 |
self.points[found] = [self.connectors[found].center()[0], self.connectors[found].center()[1]] |
|
68 |
|
|
69 |
qPoints = [] |
|
70 |
for point in self.points: |
|
71 |
qPoints.append(QPoint(round(point[0]), round(point[1]))) |
|
72 |
vendorArea = QPolygonF(qPoints) |
|
73 |
|
|
74 |
self.setPolygon(vendorArea) |
|
75 |
|
|
76 |
class Transfer(QObject): |
|
77 |
onRemoved = pyqtSignal(QGraphicsItem) |
|
78 |
|
|
79 |
def __init__(self, parent = None): |
|
80 |
QObject.__init__(self, parent) |
DTI_PID/DTI_PID/UI/MainWindow.ui | ||
---|---|---|
85 | 85 |
<addaction name="separator"/> |
86 | 86 |
<addaction name="actionViewUnknown"/> |
87 | 87 |
<addaction name="actionViewInconsistency"/> |
88 |
<addaction name="actionViewVendor_Area"/> |
|
88 | 89 |
<addaction name="separator"/> |
89 | 90 |
<addaction name="actionDrawing_Only"/> |
90 | 91 |
</widget> |
... | ... | |
930 | 931 |
<string>Set Vendor Package</string> |
931 | 932 |
</property> |
932 | 933 |
</action> |
934 |
<action name="actionViewVendor_Area"> |
|
935 |
<property name="checkable"> |
|
936 |
<bool>true</bool> |
|
937 |
</property> |
|
938 |
<property name="text"> |
|
939 |
<string>Vendor Area(7)</string> |
|
940 |
</property> |
|
941 |
</action> |
|
933 | 942 |
</widget> |
934 | 943 |
<resources> |
935 | 944 |
<include location="../res/MainWindow.qrc"/> |
내보내기 Unified diff