개정판 af2e60f2
size test
Change-Id: I1c9da08778afd53496f8c3dbee108c5aef1289cb
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
29 | 29 |
self.connectors = [] |
30 | 30 |
self.attrs = {} # attributes |
31 | 31 |
self._associations = {'Text Item': [], 'Symbol Item': []} # associated items |
32 |
self.sizeDepth = 0 |
|
32 | 33 |
|
33 | 34 |
#self.refresh_count = random.randint(0, 9) |
34 | 35 |
|
... | ... | |
350 | 351 |
def EvaluatedSize(self): |
351 | 352 |
from EngineeringReducerItem import QEngineeringReducerItem |
352 | 353 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
354 |
from SymbolSvgItem import SymbolSvgItem |
|
355 |
from EngineeringLineItem import QEngineeringLineItem |
|
353 | 356 |
from AppDocData import AppDocData |
354 | 357 |
|
355 | 358 |
try: |
356 |
if self.Size: return self.Size |
|
359 |
if self.Size: |
|
360 |
self.sizeDepth = 0 |
|
361 |
return self.Size |
|
357 | 362 |
if self.owner and issubclass(type(self.owner), QEngineeringLineNoTextItem): |
358 | 363 |
matches = [run for run in self.owner.runs if self in run.items] |
359 | 364 |
if matches: |
... | ... | |
364 | 369 |
for item in upstream: |
365 | 370 |
if type(item) is QEngineeringReducerItem: |
366 | 371 |
if item.connectors[0].connectedItem is prev: ### Main Size |
367 |
if item.mainSubSize and item.mainSubSize[0]: return item.mainSubSize[0] |
|
372 |
if item.mainSubSize and item.mainSubSize[0]: |
|
373 |
self.sizeDepth = 0 |
|
374 |
return item.mainSubSize[0] |
|
368 | 375 |
elif item.connectors[1].connectedItem is prev: ### Sub Size |
369 |
if item.mainSubSize and item.mainSubSize[1]: return item.mainSubSize[1] |
|
376 |
if item.mainSubSize and item.mainSubSize[1]: |
|
377 |
self.sizeDepth = 0 |
|
378 |
return item.mainSubSize[1] |
|
370 | 379 |
else: |
371 | 380 |
if item.Size: |
381 |
self.sizeDepth = 0 |
|
372 | 382 |
return item.Size |
373 | 383 |
prev = item |
374 | 384 |
|
... | ... | |
377 | 387 |
for item in downstream: |
378 | 388 |
if type(item) is QEngineeringReducerItem: |
379 | 389 |
if item.connectors[0].connectedItem is prev: ### Main Size |
380 |
if item.mainSubSize and item.mainSubSize[0]: return item.mainSubSize[0] |
|
390 |
if item.mainSubSize and item.mainSubSize[0]: |
|
391 |
self.sizeDepth = 0 |
|
392 |
return item.mainSubSize[0] |
|
381 | 393 |
elif item.connectors[1].connectedItem is prev: ### Sub Size |
382 |
if item.mainSubSize and item.mainSubSize[1]: return item.mainSubSize[1] |
|
394 |
if item.mainSubSize and item.mainSubSize[1]: |
|
395 |
self.sizeDepth = 0 |
|
396 |
return item.mainSubSize[1] |
|
383 | 397 |
else: |
384 | 398 |
if item.Size: |
399 |
self.sizeDepth = 0 |
|
385 | 400 |
return item.Size |
386 | 401 |
prev = item |
387 | 402 |
|
388 | 403 |
if 'Drain' == matches[0].Type: |
404 |
self.sizeDepth = 0 |
|
389 | 405 |
return '' |
390 | 406 |
#return AppDocData.instance().drain_size |
391 | 407 |
|
392 |
return self.owner.Size |
|
393 |
|
|
408 |
if self in self.owner.runs[0].items: |
|
409 |
self.sizeDepth = 0 |
|
410 |
return self.owner.Size |
|
411 |
elif self.sizeDepth < 2: |
|
412 |
matches = [run for run in self.owner.runs if self in run.items] |
|
413 |
if type(matches[0].items[0]) is QEngineeringLineItem: |
|
414 |
_item = matches[0].items[0] |
|
415 |
connectedItems = [conn.connectedItem for conn in _item.connectors if conn._connected_at == QEngineeringAbstractItem.CONNECTED_AT_PT and \ |
|
416 |
conn.connectedItem and conn.connectedItem not in matches[0].items] |
|
417 |
if connectedItems: |
|
418 |
connectedItems[0].sizeDepth = self.sizeDepth + 1 |
|
419 |
res = connectedItems[0].EvaluatedSize |
|
420 |
if res: |
|
421 |
self.sizeDepth = 0 |
|
422 |
return res |
|
423 |
if type(matches[0].items[-1]) is QEngineeringLineItem: |
|
424 |
_item = matches[0].items[-1] |
|
425 |
connectedItems = [conn.connectedItem for conn in _item.connectors if conn._connected_at == QEngineeringAbstractItem.CONNECTED_AT_PT and \ |
|
426 |
conn.connectedItem and conn.connectedItem not in matches[0].items] |
|
427 |
if connectedItems: |
|
428 |
connectedItems[0].sizeDepth = self.sizeDepth + 1 |
|
429 |
res = connectedItems[0].EvaluatedSize |
|
430 |
if res: |
|
431 |
self.sizeDepth = 0 |
|
432 |
return res |
|
433 |
if issubclass(type(matches[0].items[0]), SymbolSvgItem): |
|
434 |
_item = matches[0].items[0] |
|
435 |
connectedItems = [_item.connectors[index].connectedItem for index in range(len(_item.conn_type)) if (_item.conn_type[index] == 'Secondary' or _item.conn_type[index] == 'Primary') and \ |
|
436 |
_item.connectors[index].connectedItem and _item.connectors[index].connectedItem not in matches[0].items] |
|
437 |
if connectedItems: |
|
438 |
connectedItems[0].sizeDepth = self.sizeDepth + 1 |
|
439 |
res = connectedItems[0].EvaluatedSize |
|
440 |
if res: |
|
441 |
self.sizeDepth = 0 |
|
442 |
return res |
|
443 |
if issubclass(type(matches[0].items[-1]), SymbolSvgItem): |
|
444 |
_item = matches[0].items[-1] |
|
445 |
connectedItems = [_item.connectors[index].connectedItem for index in range(len(_item.conn_type)) if (_item.conn_type[index] == 'Secondary' or _item.conn_type[index] == 'Primary') and \ |
|
446 |
_item.connectors[index].connectedItem and _item.connectors[index].connectedItem not in matches[0].items] |
|
447 |
if connectedItems: |
|
448 |
connectedItems[0].sizeDepth = self.sizeDepth + 1 |
|
449 |
res = connectedItems[0].EvaluatedSize |
|
450 |
if res: |
|
451 |
self.sizeDepth = 0 |
|
452 |
return res |
|
453 |
if type(matches[0].items[0]) is QEngineeringLineItem: |
|
454 |
_item = matches[0].items[0] |
|
455 |
connectedItems = [conn.connectedItem for conn in _item.connectors if conn.connectedItem and conn.connectedItem not in matches[0].items] |
|
456 |
if connectedItems: |
|
457 |
connectedItems[0].sizeDepth = self.sizeDepth + 1 |
|
458 |
res = connectedItems[0].EvaluatedSize |
|
459 |
if res: |
|
460 |
self.sizeDepth = 0 |
|
461 |
return res |
|
462 |
if type(matches[0].items[-1]) is QEngineeringLineItem: |
|
463 |
_item = matches[0].items[-1] |
|
464 |
connectedItems = [conn.connectedItem for conn in _item.connectors if conn.connectedItem and conn.connectedItem not in matches[0].items] |
|
465 |
if connectedItems: |
|
466 |
connectedItems[0].sizeDepth = self.sizeDepth + 1 |
|
467 |
res = connectedItems[0].EvaluatedSize |
|
468 |
if res: |
|
469 |
self.sizeDepth = 0 |
|
470 |
return res |
|
471 |
|
|
472 |
self.sizeDepth = 0 |
|
394 | 473 |
return '' |
395 | 474 |
except Exception as ex: |
396 | 475 |
from App import App |
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
59 | 59 |
""" return line no's size """ |
60 | 60 |
attrs = self.getAttributes() |
61 | 61 |
matches = [value for attr, value in attrs.items() if attr.Attribute.upper() == 'NOMINALDIAMETER'] |
62 |
return matches[0] if matches else None
|
|
62 |
return matches[0] if matches else ''
|
|
63 | 63 |
|
64 | 64 |
def empty(self): |
65 | 65 |
""" return True if run is empty else return False """ |
내보내기 Unified diff