개정판 990644d9
fixed issue #563: From,To가 설정된 라인은 설정한 From,To에서 라우팅을 실시한다
Change-Id: I459ed96c588af93e5cc86a2cd94891a80e49d6db
DTI_PID/DTI_PID/ConnectAttrDialog.py | ||
---|---|---|
75 | 75 |
self.ui.pushButtonStart.setEnabled(False) |
76 | 76 |
self.ui.progressBar.setValue(0) |
77 | 77 |
self.startThread() |
78 |
""" for DEBUG |
|
79 |
from LineNoTracer import connectAttrImpl |
|
80 |
connectAttrImpl(self) |
|
81 |
""" |
|
78 | 82 |
|
79 | 83 |
''' |
80 | 84 |
@brief QListWidget Row Inserted Listener |
DTI_PID/DTI_PID/ItemTreeWidget.py | ||
---|---|---|
131 | 131 |
itemPosition = self.mapTo(self, position) |
132 | 132 |
item = self.itemAt(itemPosition) |
133 | 133 |
if item is not None: |
134 |
data = item.data(0, self.TREE_DATA_ROLE) |
|
135 |
if len(indexes) > 0 and data is not None and issubclass(type(data), QEngineeringLineNoTextItem): |
|
136 |
index = indexes[0] |
|
134 |
if item is self.LineNoTreeItem: |
|
137 | 135 |
menu = QMenu() |
138 |
pickColorAction = QAction(self.tr("Select Line Color")) |
|
139 |
pickColorAction.triggered.connect(lambda : self.pickColorClickEvent(item)) |
|
140 |
menu.addAction(pickColorAction) |
|
141 | 136 |
explode_action = QAction(self.tr("Explode")) |
142 |
explode_action.triggered.connect(lambda : self.explode_line_no(item)) |
|
143 |
menu.addAction(explode_action) |
|
144 |
menu.exec_(self.viewport().mapToGlobal(position)) |
|
145 |
elif len(indexes) > 0 and data is not None and issubclass(type(data), QEngineeringRunItem): |
|
146 |
index = indexes[0] |
|
147 |
menu = QMenu() |
|
148 |
lineTypeAction = QAction(self.tr("Select Line Type")) |
|
149 |
lineTypeAction.triggered.connect(lambda : self.lineTypeClickEvent(item)) |
|
150 |
menu.addAction(lineTypeAction) |
|
151 |
explode_action = QAction(self.tr("Explode")) |
|
152 |
explode_action.triggered.connect(lambda : self.explode_line_run(item)) |
|
137 |
explode_action.triggered.connect(lambda : self.explode_all_line_nos(item)) |
|
153 | 138 |
menu.addAction(explode_action) |
154 | 139 |
menu.exec_(self.viewport().mapToGlobal(position)) |
140 |
else: |
|
141 |
data = item.data(0, self.TREE_DATA_ROLE) |
|
142 |
if len(indexes) > 0 and data is not None and issubclass(type(data), QEngineeringLineNoTextItem): |
|
143 |
index = indexes[0] |
|
144 |
menu = QMenu() |
|
145 |
pickColorAction = QAction(self.tr("Select Line Color")) |
|
146 |
pickColorAction.triggered.connect(lambda : self.pickColorClickEvent(item)) |
|
147 |
menu.addAction(pickColorAction) |
|
148 |
explode_action = QAction(self.tr("Explode")) |
|
149 |
explode_action.triggered.connect(lambda : self.explode_line_no(item)) |
|
150 |
menu.addAction(explode_action) |
|
151 |
menu.exec_(self.viewport().mapToGlobal(position)) |
|
152 |
elif len(indexes) > 0 and data is not None and issubclass(type(data), QEngineeringRunItem): |
|
153 |
index = indexes[0] |
|
154 |
menu = QMenu() |
|
155 |
lineTypeAction = QAction(self.tr("Select Line Type")) |
|
156 |
lineTypeAction.triggered.connect(lambda : self.lineTypeClickEvent(item)) |
|
157 |
menu.addAction(lineTypeAction) |
|
158 |
explode_action = QAction(self.tr("Explode")) |
|
159 |
explode_action.triggered.connect(lambda : self.explode_line_run(item)) |
|
160 |
menu.addAction(explode_action) |
|
161 |
menu.exec_(self.viewport().mapToGlobal(position)) |
|
155 | 162 |
|
156 | 163 |
''' |
157 | 164 |
@brief Pick Color for Line No |
... | ... | |
187 | 194 |
for i in reversed(range(tree_widget_item.childCount())): |
188 | 195 |
tree_widget_item.takeChild(i) |
189 | 196 |
|
190 |
line_no = tree_widget_item.parent().data(0, self.TREE_DATA_ROLE) |
|
191 |
line_no.runs.remove(line_run) |
|
192 |
|
|
193 | 197 |
line_run.explode() |
194 | 198 |
tree_widget_item.parent().takeChild(tree_widget_item.parent().indexOfChild(tree_widget_item)) |
195 | 199 |
finally: |
196 | 200 |
pass |
197 | 201 |
|
202 |
def explode_all_line_nos(self, tree_widget_item): |
|
203 |
""" explode all line nos """ |
|
204 |
|
|
205 |
try: |
|
206 |
for i in self.LineNoTreeItem.childCount(): |
|
207 |
self.explode_line_no(self.LineNoTreeItem.child(i)) |
|
208 |
finally: |
|
209 |
pass |
|
210 |
|
|
198 | 211 |
def explode_line_no(self, lineNoTreeWidgetItem): |
199 | 212 |
""" explode line no """ |
200 | 213 |
|
... | ... | |
248 | 261 |
self.root.setIcon(0, QIcon(':newPrefix/objects.png')) |
249 | 262 |
self.root.setData(0, self.TREE_DATA_ROLE, appDocData.activeDrawing) |
250 | 263 |
child = self.root.addChild(QTreeWidgetItem(['LINE NO'])) |
251 |
self.root.child(self.root.childCount() - 1).setFlags(self.root.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable) |
|
252 |
self.root.child(self.root.childCount() - 1).setCheckState(0, Qt.Checked) |
|
253 | 264 |
self.LineNoTreeItem = self.root.child(self.root.childCount() - 1) |
265 |
self.LineNoTreeItem.setFlags(self.root.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable) |
|
266 |
self.LineNoTreeItem.setCheckState(0, Qt.Checked) |
|
254 | 267 |
self.root.addChild(QTreeWidgetItem(['EQUIPMENTS'])) |
255 | 268 |
self.EqpTreeItem = self.root.child(self.root.childCount() - 1) |
256 | 269 |
self.root.addChild(QTreeWidgetItem(['SYMBOLS'])) |
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
31 | 31 |
def __init__(self, symbols, lines, lineNos, specBreak, lineIndicator, vendor): |
32 | 32 |
try: |
33 | 33 |
self._symbols = symbols |
34 |
#for symbol in self._symbols: symbol.owner = None |
|
35 | 34 |
self._lines = lines |
36 |
#for line in self._lines: line.owner = None |
|
37 | 35 |
self._lineNos = lineNos |
38 | 36 |
self._spec_breaks = specBreak |
39 |
#self._specBreakUID = [] |
|
40 | 37 |
self._lineIndicator = lineIndicator |
41 | 38 |
self._vendor = vendor |
42 | 39 |
|
... | ... | |
47 | 44 |
self._specBreakUID.append(attr[1]) |
48 | 45 |
""" |
49 | 46 |
except Exception as ex: |
50 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
47 |
from App import App |
|
48 |
|
|
49 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
50 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
51 | 51 |
|
52 | 52 |
''' |
53 | 53 |
@brief find primary lines connected to given line no |
54 | 54 |
@author humkyung |
55 | 55 |
''' |
56 |
def findPrimaryLines(self, lineno):
|
|
56 |
def find_primary_lines(self, lineno):
|
|
57 | 57 |
from EngineeringLineItem import QEngineeringLineItem |
58 | 58 |
from EngineeringRunItem import QEngineeringRunItem |
59 | 59 |
|
60 |
connectedItems = [] |
|
61 |
if 1 == len(lineno.conns): |
|
62 |
connectedItems = self.findConnectedObjects(lineno.conns[0], toler=10) |
|
63 |
for item in connectedItems: |
|
60 |
connected_items = [] |
|
61 |
|
|
62 |
_from = lineno.get_property('From') |
|
63 |
_to = lineno.get_property('To') |
|
64 |
if _from and _to and lineno.empty(): |
|
65 |
connected_items = self.find_connected_objects(_from, to=_to) |
|
66 |
elif (not _from or not _to) and (1 == len(lineno.conns)): |
|
67 |
connected_items = self.find_connected_objects(lineno.conns[0]) |
|
68 |
|
|
69 |
if connected_items: |
|
70 |
for item in connected_items: |
|
64 | 71 |
item.owner = lineno # set item's owner |
65 | 72 |
|
66 |
pipe_run = QEngineeringRunItem() |
|
67 |
pipe_run.items = connectedItems |
|
68 |
pipe_run.arrange_flow_direction() |
|
69 |
lineno.runs.append(pipe_run) |
|
73 |
line_run = QEngineeringRunItem() |
|
74 |
line_run.items = connected_items |
|
75 |
line_run.arrange_flow_direction() |
|
76 |
line_run.owner = lineno |
|
77 |
lineno.runs.append(line_run) |
|
70 | 78 |
|
71 |
lineno.set_property('From', connectedItems[0])
|
|
72 |
lineno.set_property('To', connectedItems[-1])
|
|
79 |
lineno.set_property('From', connected_items[0])
|
|
80 |
lineno.set_property('To', connected_items[-1])
|
|
73 | 81 |
|
74 |
return connectedItems
|
|
82 |
return connected_items
|
|
75 | 83 |
|
76 | 84 |
''' |
77 | 85 |
@brief find secondary lines |
78 | 86 |
@author humkyung |
79 | 87 |
''' |
80 |
def findSecondaryLines(self, lines):
|
|
88 |
def find_secondary_lines(self, lines):
|
|
81 | 89 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
82 | 90 |
from EngineeringLineItem import QEngineeringLineItem |
83 | 91 |
from EngineeringRunItem import QEngineeringRunItem |
... | ... | |
94 | 102 |
symbol_matches = [x for x in self._symbols if x.owner and line.is_connected(x)] |
95 | 103 |
if line_matches or symbol_matches: |
96 | 104 |
foundCount += 1 |
97 |
connectedItems = self.findConnectedObjects(line, toler=10)
|
|
105 |
connected_items = self.find_connected_objects(line)
|
|
98 | 106 |
|
99 |
for item in connectedItems: |
|
100 |
item.owner = line_matches[0].owner if line_matches else symbol_matches[0].owner # set item's owner |
|
101 |
|
|
102 |
pipe_run = QEngineeringRunItem() |
|
103 |
pipe_run.items = connectedItems |
|
104 |
pipe_run.arrange_flow_direction() |
|
105 |
if pipe_run.items is not None and len(pipe_run.items) > 0: |
|
106 |
line_matches[0].owner.runs.append(pipe_run) if line_matches else symbol_matches[0].owner.runs.append(pipe_run) |
|
107 |
owner = line_matches[0].owner if line_matches else symbol_matches[0].owner |
|
108 |
for item in connected_items: |
|
109 |
item.owner = owner # set item's owner |
|
110 |
|
|
111 |
line_run = QEngineeringRunItem() |
|
112 |
line_run.items = connected_items |
|
113 |
line_run.arrange_flow_direction() |
|
114 |
if line_run.items is not None and len(line_run.items) > 0: |
|
115 |
line_run.owner = owner |
|
116 |
owner.runs.append(line_run) |
|
107 | 117 |
else: |
108 | 118 |
notMatches.append(line) |
109 | 119 |
lines = notMatches |
... | ... | |
138 | 148 |
if 1 == len(configs): |
139 | 149 |
configs = docData.getConfigs('Line No', 'Configuration') |
140 | 150 |
|
141 |
docData.tracerLineNos.clear() |
|
142 |
|
|
143 |
docData.tracerLineNos = self._lineNos |
|
144 |
remainLineNos = [] |
|
145 |
for lineno in docData.tracerLineNos: |
|
146 |
## CONN은 유지 |
|
147 |
if lineno.conns: |
|
148 |
continue |
|
151 |
for lineno in self._lineNos: |
|
152 |
_from = lineno.get_property('From') |
|
153 |
_to = lineno.get_property('To') |
|
154 |
if _from and _to: continue |
|
149 | 155 |
|
156 |
lineno.conns.clear() |
|
150 | 157 |
minDist = None |
151 | 158 |
startLine = None |
152 | 159 |
for line in self._lines: |
... | ... | |
156 | 163 |
startLine = line |
157 | 164 |
if (startLine is not None) and (minDist < toler): |
158 | 165 |
lineno.conns.append(startLine) |
159 |
else: |
|
160 |
remainLineNos.append(lineno) |
|
166 |
startLine.owner = lineno |
|
161 | 167 |
|
162 | 168 |
""" |
163 | 169 |
## lineIndicator |
... | ... | |
255 | 261 |
## up to here |
256 | 262 |
""" |
257 | 263 |
|
258 |
# set start line's owner |
|
259 |
for lineno in docData.tracerLineNos: |
|
260 |
if lineno.conns: |
|
261 |
lineno.conns[0].owner = lineno |
|
262 |
lineno.conns[0].linkedItem = lineno |
|
263 |
|
|
264 | 264 |
maxValue = len(self._lineNos) + 1 ## line no's count + secondary line |
265 | 265 |
|
266 | 266 |
# find primary lines |
267 |
for lineno in docData.tracerLineNos:
|
|
268 |
displayMessage.emit('{} {}'.format(lineno.text(), 'Topology Construction')) |
|
269 |
self.findPrimaryLines(lineno)
|
|
270 |
updateProgress.emit(maxValue) |
|
267 |
for lineno in self._lineNos:
|
|
268 |
if displayMessage: displayMessage.emit('{} {}'.format(lineno.text(), 'Topology Construction'))
|
|
269 |
self.find_primary_lines(lineno)
|
|
270 |
if updateProgress: updateProgress.emit(maxValue)
|
|
271 | 271 |
|
272 | 272 |
# find secondary lines |
273 | 273 |
lines = self._lines |
274 |
self.findSecondaryLines(lines)
|
|
275 |
updateProgress.emit(maxValue) |
|
274 |
self.find_secondary_lines(lines)
|
|
275 |
if updateProgress: updateProgress.emit(maxValue)
|
|
276 | 276 |
|
277 | 277 |
### make trim lines |
278 | 278 |
""" |
... | ... | |
302 | 302 |
|
303 | 303 |
docData.tracerLineNos.append(trimLineNo) |
304 | 304 |
""" |
305 |
updateProgress.emit(maxValue) |
|
305 |
if updateProgress: updateProgress.emit(maxValue)
|
|
306 | 306 |
except Exception as ex: |
307 | 307 |
from App import App |
308 | 308 |
|
... | ... | |
318 | 318 |
humkyung 2018.05.17 try to connect both symbol and line |
319 | 319 |
humkyung 2018.06.22 order connected objects |
320 | 320 |
''' |
321 |
def findConnectedObjects(self, startLine, toler):
|
|
321 |
def find_connected_objects(self, start, to=None):
|
|
322 | 322 |
from EngineeringLineItem import QEngineeringLineItem |
323 | 323 |
from EngineeringEquipmentItem import QEngineeringEquipmentItem |
324 | 324 |
from SymbolSvgItem import SymbolSvgItem |
325 | 325 |
|
326 |
visited = [startLine]
|
|
326 |
visited = [start] |
|
327 | 327 |
|
328 | 328 |
try: |
329 | 329 |
pool = [] |
330 |
pool.append((0, startLine))
|
|
330 |
pool.append((0, start)) |
|
331 | 331 |
|
332 | 332 |
while len(pool) > 0: |
333 | 333 |
sign, obj = pool.pop() |
334 | 334 |
|
335 |
""" check startLine is upstream or downstream of spec break """
|
|
336 |
matches = [spec_break for spec_break in self._spec_breaks if spec_break.is_connected(startLine)]
|
|
335 |
""" check obj is upstream or downstream of spec break """
|
|
336 |
matches = [spec_break for spec_break in self._spec_breaks if spec_break.is_connected(obj)]
|
|
337 | 337 |
if matches or issubclass(type(obj), QEngineeringEquipmentItem): continue |
338 |
""" end loop if obj is to """ |
|
339 |
if obj is to: break |
|
338 | 340 |
|
339 | 341 |
if type(obj) is QEngineeringLineItem: |
340 | 342 |
symbolMatches = [x for x in self._symbols if (x.owner is None) and (x not in visited) and obj.is_connected(x)] |
... | ... | |
413 | 415 |
if type(item) is QEngineeringSpecBreakItem: |
414 | 416 |
specBreak.append(item) |
415 | 417 |
elif issubclass(type(item), SymbolSvgItem): |
416 |
item.owner = None |
|
417 | 418 |
symbols.append(item) |
418 | 419 |
elif type(item) is QEngineeringLineNoTextItem: |
419 |
item.owner = None |
|
420 |
item.runs.clear() |
|
421 |
isDupl = [line for line in lineNos if line.text() == item.text()] |
|
422 |
if not isDupl: |
|
423 |
lineNos.append(item) |
|
420 |
lineNos.append(item) |
|
424 | 421 |
elif type(item) is QEngineeringLineItem: |
425 |
item.owner = None |
|
426 | 422 |
lines.append(item) |
427 | 423 |
elif type(item) is QEngineeringUnknownItem and item.lineIndicator != 'False': |
428 | 424 |
lineIndicator.append(item) |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1632 | 1632 |
self.itemTreeWidget.InitLineNoItems() |
1633 | 1633 |
|
1634 | 1634 |
# construct line no item |
1635 |
docData = AppDocData.instance()
|
|
1636 |
for lineno in docData.tracerLineNos:
|
|
1637 |
item = self.itemTreeWidget.addTreeItem(self.itemTreeWidget.root, lineno) |
|
1638 |
connectedItems = lineno.getConnectedItems() |
|
1635 |
line_nos = [item for item in self.graphicsView.scene.items() if type(item) is QEngineeringLineNoTextItem]
|
|
1636 |
for line_no in line_nos:
|
|
1637 |
item = self.itemTreeWidget.addTreeItem(self.itemTreeWidget.root, line_no)
|
|
1638 |
connectedItems = line_no.getConnectedItems()
|
|
1639 | 1639 |
for connectedItem in connectedItems: |
1640 | 1640 |
if issubclass(type(connectedItem), SymbolSvgItem): |
1641 | 1641 |
self.itemTreeWidget.addTreeItem(item, connectedItem) |
... | ... | |
2282 | 2282 |
from QEngineeringTrimLineNoTextItem import QEngineeringTrimLineNoTextItem |
2283 | 2283 |
|
2284 | 2284 |
try: |
2285 |
self.blockSignals(True) |
|
2286 |
|
|
2285 | 2287 |
symbols = [] |
2286 | 2288 |
|
2287 | 2289 |
xml = parse(xmlPath) |
... | ... | |
2297 | 2299 |
maxValue = maxValue + len(list(root.iter('TRIM_LINE_NO'))) |
2298 | 2300 |
self.progress.setMaximum(maxValue) |
2299 | 2301 |
|
2302 |
""" parsing all symbols """ |
|
2300 | 2303 |
for symbol in root.find('SYMBOLS').iter('SYMBOL'): |
2301 | 2304 |
item = SymbolSvgItem.fromXml(symbol) |
2302 | 2305 |
if item[0] is not None: |
... | ... | |
2319 | 2322 |
# set symbol's owner |
2320 | 2323 |
childItems = [item for item in symbols if item[1] is not None] |
2321 | 2324 |
for item in childItems: |
2322 |
matches = [param for param in symbols if str(param[0].uid) == item[1]]
|
|
2325 |
matches = [param for param in symbols if str(param[0].uid) == str(item[1])]
|
|
2323 | 2326 |
if len(matches) == 1: |
2324 | 2327 |
item[0].owner = matches[0][0] |
2325 | 2328 |
# up to here |
2326 | 2329 |
|
2330 |
""" add item to scene and tree widget """ |
|
2327 | 2331 |
for item in symbols: |
2328 | 2332 |
self.addSvgItemToScene(item[0]) |
2329 | 2333 |
docData.symbols.append(item[0]) |
2334 |
self.itemTreeWidget.addTreeItem(self.itemTreeWidget.root, item[0]) |
|
2330 | 2335 |
|
2331 | 2336 |
# parse texts |
2332 | 2337 |
for text in root.find('TEXTINFOS').iter('ATTRIBUTE'): |
... | ... | |
2386 | 2391 |
|
2387 | 2392 |
QApplication.processEvents() |
2388 | 2393 |
|
2389 |
for line_no in root.find('LINENOS').iter('LINE_NO'): |
|
2390 |
item = QEngineeringLineNoTextItem.fromXml(line_no)
|
|
2391 |
if item is not None:
|
|
2392 |
item.transfer.onRemoved.connect(self.itemRemoved)
|
|
2393 |
self.addTextItemToScene(item)
|
|
2394 |
treeItem = self.itemTreeWidget.addTreeItem(self.itemTreeWidget.root, item)
|
|
2394 |
for line_no_node in root.find('LINENOS').iter('LINE_NO'):
|
|
2395 |
line_no = QEngineeringLineNoTextItem.fromXml(line_no_node)
|
|
2396 |
if line_no is not None:
|
|
2397 |
line_no.transfer.onRemoved.connect(self.itemRemoved)
|
|
2398 |
self.addTextItemToScene(line_no)
|
|
2399 |
treeItem = self.itemTreeWidget.addTreeItem(self.itemTreeWidget.root, line_no)
|
|
2395 | 2400 |
|
2401 |
""" |
|
2396 | 2402 |
connLine = line_no.find('CONNLINE') |
2397 | 2403 |
if connLine is not None: |
2398 | 2404 |
lineUID = connLine.text |
2399 | 2405 |
connLine = self.graphicsView.findItemByUid(lineUID) |
2400 | 2406 |
if connLine is not None: |
2401 | 2407 |
item.conns.append(connLine) |
2408 |
""" |
|
2402 | 2409 |
|
2403 |
runs = line_no.findall('RUN')
|
|
2404 |
if runs is not None: |
|
2405 |
for run in runs:
|
|
2410 |
runs_node = line_no_node.findall('RUN')
|
|
2411 |
if runs_node is not None:
|
|
2412 |
for run_node in runs_node:
|
|
2406 | 2413 |
line_run = QEngineeringRunItem() |
2407 |
for child in run:
|
|
2408 |
uidElement = child.find('UID') |
|
2414 |
for child_node in run_node:
|
|
2415 |
uidElement = child_node.find('UID')
|
|
2409 | 2416 |
if uidElement is not None: |
2410 | 2417 |
uid = uidElement.text |
2411 | 2418 |
run_item = self.graphicsView.findItemByUid(uid) |
2412 | 2419 |
if run_item is not None: |
2413 | 2420 |
run_item._owner = item |
2414 | 2421 |
line_run.items.append(run_item) |
2415 |
item.runs.append(line_run) |
|
2422 |
line_run.owner = line_no |
|
2423 |
line_no.runs.append(line_run) |
|
2416 | 2424 |
|
2417 | 2425 |
for connectedItem in line_run.items: |
2418 | 2426 |
if issubclass(type(connectedItem), SymbolSvgItem): self.itemTreeWidget.addTreeItem(treeItem, connectedItem) |
2419 |
#for connectedItem in line_run.items: |
|
2420 |
# if issubclass(type(connectedItem), SymbolSvgItem): self.itemTreeWidget.addTreeItem(treeItem, connectedItem) |
|
2421 | 2427 |
|
2422 | 2428 |
docData.tracerLineNos.append(item) |
2423 | 2429 |
|
... | ... | |
2470 | 2476 |
if type(symbol.attrs[key]) is not UserInputAttribute and type(symbol.attrs[key]) is not tuple: |
2471 | 2477 |
symbol.attrs[key] = self.graphicsView.findItemByUid(symbol.attrs[key]) |
2472 | 2478 |
|
2473 |
# Update Scene
|
|
2479 |
""" update scene """
|
|
2474 | 2480 |
self.graphicsView.scene.update(self.graphicsView.sceneRect()) |
2475 | 2481 |
for item in self.graphicsView.scene.items(): |
2476 | 2482 |
item.setVisible(True) |
... | ... | |
2478 | 2484 |
except Exception as ex: |
2479 | 2485 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
2480 | 2486 |
self.addMessage.emit(MessageType.Error, message) |
2487 |
finally: |
|
2488 |
self.blockSignals(False) |
|
2481 | 2489 |
|
2482 | 2490 |
''' |
2483 | 2491 |
@brief Remove added item on same place and Add GraphicsItem |
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
56 | 56 |
|
57 | 57 |
def get_property(self, property): |
58 | 58 |
""" return property with given value """ |
59 |
matches = [prop for prop,_ in self._properties.items() if prop.Attribute == property]
|
|
60 |
return self._properties[matches[0]] if matches else None
|
|
59 |
matches = [prop for prop,_ in self.properties.items() if prop.Attribute == property] |
|
60 |
return self.properties[matches[0]] if matches else None |
|
61 | 61 |
|
62 | 62 |
def set_property(self, property, value): |
63 | 63 |
""" set property with given value """ |
64 | 64 |
matches = [prop for prop,_ in self._properties.items() if prop.Attribute == property] |
65 | 65 |
if matches: self._properties[matches[0]] = value |
66 | 66 |
|
67 |
def empty(self): |
|
68 |
""" return True if run is empty else return False """ |
|
69 |
return False if self._runs else True |
|
70 |
|
|
67 | 71 |
def setVisible(self, visible): |
68 | 72 |
""" override visible value """ |
69 | 73 |
super(QEngineeringTextItem, self).setVisible(visible) |
... | ... | |
242 | 246 |
attr = SymbolAttr.fromXml(attr_node) |
243 | 247 |
item.attrs[attr] = attr_node.text |
244 | 248 |
|
245 |
item.uid = uuid.UUID(node.find('UID').text) |
|
249 |
item.uid = uuid.UUID(node.find('UID').text, version=4)
|
|
246 | 250 |
item.loc = (x, y) |
247 | 251 |
item.size = (width, height) |
248 | 252 |
item.angle = angle |
... | ... | |
373 | 377 |
run.explode() |
374 | 378 |
finally: |
375 | 379 |
self.runs.clear() |
380 |
self.set_property('From', None) |
|
381 |
self.set_property('To', None) |
|
376 | 382 |
|
377 | 383 |
''' |
378 | 384 |
@brief save Line Data |
DTI_PID/DTI_PID/Shapes/EngineeringRunItem.py | ||
---|---|---|
27 | 27 |
self.uid = uuid.uuid4() # generate UUID |
28 | 28 |
self._items = [] |
29 | 29 |
self._visible = False |
30 |
self.owner = None |
|
30 | 31 |
|
31 | 32 |
@property |
32 | 33 |
def visible(self): |
... | ... | |
66 | 67 |
item.owner = None |
67 | 68 |
finally: |
68 | 69 |
self.items.clear() |
70 |
if self.owner: self.owner.runs.remove(self) |
|
69 | 71 |
|
70 | 72 |
''' |
71 | 73 |
@brief get two points which's length is max |
내보내기 Unified diff