개정판 2605a8f9
issue #481: line connection check on going
Change-Id: Ibef8425cb22d89f16b6b775464c967bc4426efd4
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
46 | 46 |
from EngineeringEquipmentItem import QEngineeringEquipmentItem |
47 | 47 |
from EngineeringInstrumentItem import QEngineeringInstrumentItem |
48 | 48 |
from EngineeringSpecBreakItem import QEngineeringSpecBreakItem |
49 |
from EngineeringErrorItem import QEngineeringErrorItem |
|
49 | 50 |
from AppDocData import * |
50 | 51 |
import SymbolTreeWidget, SymbolPropertyTableWidget |
51 | 52 |
import SymbolEditorDialog |
... | ... | |
156 | 157 |
self.actionGroup.addAction(self.actionZoom) |
157 | 158 |
self.actionGroup.addAction(self.actionFitWindow) |
158 | 159 |
self.actionGroup.addAction(self.actionSave) |
160 |
self.actionGroup.addAction(self.actionValidate) |
|
159 | 161 |
self.actionGroup.triggered.connect(self.actionGroupTriggered) |
160 | 162 |
|
161 | 163 |
# connect signals and slots |
... | ... | |
176 | 178 |
self.actionItem_Data_List.triggered.connect(self.showItemDataList) |
177 | 179 |
self.actionCodeTable.triggered.connect(self.onShowCodeTable) |
178 | 180 |
self.actionImage_Drawing.triggered.connect(self.onViewImageDrawing) |
181 |
self.actionValidate.triggered.connect(self.onValidation) |
|
179 | 182 |
self.actionViewText.triggered.connect(self.onViewText) |
180 | 183 |
self.actionViewSymbol.triggered.connect(self.onViewSymbol) |
181 | 184 |
self.actionViewLine.triggered.connect(self.onViewLine) |
... | ... | |
240 | 243 |
action.triggered.connect(partial(self.load_language, file)) |
241 | 244 |
# up to here |
242 | 245 |
|
246 |
def onValidation(self): |
|
247 |
""" |
|
248 |
@brief validation check |
|
249 |
@author euisung |
|
250 |
@date 2019.04.01 |
|
251 |
""" |
|
252 |
if not self.graphicsView.hasImage(): |
|
253 |
self.showImageSelectionMessageBox() |
|
254 |
return |
|
255 |
|
|
256 |
errors = [] |
|
257 |
|
|
258 |
for item in self.graphicsView.scene.items(): |
|
259 |
if type(item) is QEngineeringErrorItem: |
|
260 |
item.transfer.onRemoved.emit(item) |
|
261 |
if type(item) is QEngineeringLineItem: |
|
262 |
for error in item.validate(): |
|
263 |
errors.append(error) |
|
264 |
|
|
265 |
for error in errors: |
|
266 |
error.transfer.onRemoved.connect(self.itemRemoved) |
|
267 |
self.graphicsView.scene.addItem(error) |
|
268 |
|
|
269 |
|
|
243 | 270 |
def load_stylesheet(self, file): |
244 | 271 |
""" |
245 | 272 |
@brief load stylesheets |
DTI_PID/DTI_PID/Shapes/EngineeringErrorItem.py | ||
---|---|---|
1 |
# coding: utf-8 |
|
2 |
""" |
|
3 |
This is Engineering Error Item module |
|
4 |
""" |
|
5 |
|
|
6 |
import sys |
|
7 |
import os |
|
8 |
import math |
|
9 |
from PyQt5.QtGui import * |
|
10 |
from PyQt5.QtCore import * |
|
11 |
from PyQt5.QtSvg import * |
|
12 |
from PyQt5.QtWidgets import (QApplication, QGraphicsItem) |
|
13 |
|
|
14 |
from SymbolSvgItem import SymbolSvgItem |
|
15 |
from EngineeringConnectorItem import QEngineeringConnectorItem |
|
16 |
from EngineeringTextItem import QEngineeringTextItem |
|
17 |
from UserInputAttribute import UserInputAttribute |
|
18 |
|
|
19 |
class QEngineeringErrorItem(SymbolSvgItem): |
|
20 |
""" |
|
21 |
This is Engineering Error Item class |
|
22 |
""" |
|
23 |
clicked = pyqtSignal(QGraphicsSvgItem) |
|
24 |
|
|
25 |
''' |
|
26 |
''' |
|
27 |
ZVALUE = 20 |
|
28 |
def __init__(self, path, uid=None): |
|
29 |
SymbolSvgItem.__init__(self, path, uid) |
|
30 |
self.setZValue(QEngineeringErrorItem.ZVALUE) |
|
31 |
self.msg = None |
|
32 |
|
|
33 |
def setPosition(self, loc, origin): |
|
34 |
transform = QTransform() |
|
35 |
transform.translate(loc[0] - origin[0], loc[1] - origin[1]) |
|
36 |
self.setTransform(transform) |
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
4 | 4 |
""" |
5 | 5 |
import sys |
6 | 6 |
import cv2 |
7 |
import os |
|
7 | 8 |
|
8 | 9 |
try: |
9 | 10 |
from PyQt5.QtCore import * |
... | ... | |
828 | 829 |
#self.buildItem() |
829 | 830 |
self.update() |
830 | 831 |
|
832 |
def validate(self): |
|
833 |
from EngineeringErrorItem import QEngineeringErrorItem |
|
834 |
from SymbolSvgItem import SymbolSvgItem |
|
835 |
''' |
|
836 |
@brief validation check : connection, |
|
837 |
@author euisung |
|
838 |
@date 2019.04.01 |
|
839 |
''' |
|
840 |
errors = [] |
|
841 |
dataPath = os.path.join(os.getenv('ALLUSERSPROFILE'), 'Digital PID', 'Explode.svg') |
|
842 |
for connector in self.connectors: |
|
843 |
if connector.connectedItem is None: |
|
844 |
error = SymbolSvgItem.createItem('Error', dataPath) |
|
845 |
error.setPosition(connector.connectPoint, [51, 72]) |
|
846 |
error.parent = self |
|
847 |
error.setToolTip('disconnected') |
|
848 |
errors.append(error) |
|
849 |
|
|
850 |
return errors |
|
851 |
|
|
831 | 852 |
''' |
832 | 853 |
@brief update line type |
833 | 854 |
@author humkyung |
... | ... | |
1122 | 1143 |
def getColor(self): |
1123 | 1144 |
return self.pen().color().name() |
1124 | 1145 |
|
1146 |
|
|
1147 |
|
|
1125 | 1148 |
''' |
1126 | 1149 |
@brief reshape line |
1127 | 1150 |
@author humkyung |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
955 | 955 |
from EngineeringInstrumentItem import QEngineeringInstrumentItem |
956 | 956 |
from EngineeringNozzleItem import QEngineeringNozzleItem |
957 | 957 |
from EngineeringSpecBreakItem import QEngineeringSpecBreakItem |
958 |
from EngineeringErrorItem import QEngineeringErrorItem |
|
958 | 959 |
from AppDocData import AppDocData |
959 | 960 |
|
960 | 961 |
docData = AppDocData.instance() |
... | ... | |
971 | 972 |
item = QEngineeringNozzleItem(path, uid) |
972 | 973 |
elif type == 'Segment Breaks': |
973 | 974 |
item = QEngineeringSpecBreakItem(path, uid) |
975 |
elif type == 'Error': |
|
976 |
item = QEngineeringErrorItem(path, uid) |
|
974 | 977 |
else: |
975 | 978 |
item = SymbolSvgItem(path, uid) |
976 | 979 |
|
내보내기 Unified diff