개정판 9424bdca
issue #563: add association to line no item
Change-Id: I476b51670ad1587273ef281580645087bf5c7d55
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
329 | 329 |
app_doc_data = AppDocData.instance() |
330 | 330 |
|
331 | 331 |
# get associations |
332 |
associations = app_doc_data.get_component_associations(uid) |
|
333 |
if associations: |
|
334 |
for assoc in associations: |
|
335 |
_attrType = assoc['Type'] |
|
336 |
if not _attrType in item._associations: |
|
337 |
item._associations[_attrType] = [] |
|
338 |
item._associations[_attrType].append( |
|
339 |
uuid.UUID(assoc['Association']) if assoc['Association'] != 'None' else None) |
|
340 |
# up to here |
|
341 |
|
|
342 |
# get associations |
|
332 | 343 |
associations = app_doc_data.get_component_associations(component['UID']) |
333 | 344 |
if associations: |
334 | 345 |
for assoc in associations: |
... | ... | |
405 | 416 |
item.angle = angle |
406 | 417 |
item.setToolTip('<b>{}</b><br>LINE NO={}'.format(str(item.uid), text)) |
407 | 418 |
|
419 |
# get associations |
|
420 |
attributeValue = node.find('ASSOCIATIONS') |
|
421 |
if attributeValue is not None: |
|
422 |
for assoc in attributeValue.iter('ASSOCIATION'): |
|
423 |
_attrType = assoc.attrib['TYPE'] |
|
424 |
if not _attrType in item._associations: |
|
425 |
item._associations[_attrType] = [] |
|
426 |
item._associations[_attrType].append(uuid.UUID(assoc.text) if assoc.text != 'None' else None) |
|
427 |
# up to here |
|
428 |
|
|
408 | 429 |
""" apply freeze value """ |
409 | 430 |
# item.freeze_item.update_freeze(item.prop('Freeze')) |
410 | 431 |
|
... | ... | |
471 | 492 |
|
472 | 493 |
for run in self.runs: |
473 | 494 |
node.append(run.toXml()) |
495 |
|
|
496 |
attributeValueNode = Element('ASSOCIATIONS') |
|
497 |
for key, value in self._associations.items(): |
|
498 |
for assoc in value: |
|
499 |
assoc_node = Element('ASSOCIATION') |
|
500 |
assoc_node.attrib['TYPE'] = str(key) |
|
501 |
assoc_node.text = str(assoc) |
|
502 |
attributeValueNode.append(assoc_node) |
|
503 |
node.append(attributeValueNode) |
|
474 | 504 |
|
475 | 505 |
properties_node = Element('PROPERTIES') |
476 | 506 |
for prop, value in self.properties.items(): |
... | ... | |
694 | 724 |
sql = 'insert into LineNoAttributes({}) values({})'.format(','.join(cols), ','.join(values)) |
695 | 725 |
resLater.append((sql, tuple(params))) |
696 | 726 |
|
727 |
if self.associations(): |
|
728 |
cols = ['UID', '[Type]', 'Components_UID', 'Association'] |
|
729 |
values = ['?', '?', '?', '?'] |
|
730 |
params = [] |
|
731 |
for assoc in self.associations(): |
|
732 |
params.append( |
|
733 |
(str(uuid.uuid4()), QEngineeringAbstractItem.assoc_type(assoc), str(self.uid), str(assoc.uid))) |
|
734 |
sql = 'insert into Associations({}) values({})'.format(','.join(cols), ','.join(values)) |
|
735 |
resLater.append((sql, tuple(params))) |
|
736 |
|
|
697 | 737 |
# insert line no's Attributes |
698 | 738 |
cols = ['UID', 'Components_UID', 'SymbolAttribute_UID', 'Value', 'Association_UID', 'Freeze'] |
699 | 739 |
values = ['?', '?', '?', '?', '?', '?'] |
내보내기 Unified diff