개정판 de8b8993
issue #000: fix assoc item binding
Change-Id: I68448807538694c6d6cbe8ddb5aca8631406ea31
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
165 | 165 |
freeze = True |
166 | 166 |
break |
167 | 167 |
if freeze: |
168 |
for assoc in self.associations(): |
|
169 |
assoc.owner = self |
|
168 |
pass |
|
169 |
#for assoc in self.associations(): |
|
170 |
# assoc.owner = self |
|
170 | 171 |
|
171 | 172 |
else: |
172 | 173 |
self.attrs.clear() |
DTI_PID/DTI_PID/Shapes/QEngineeringOPCItem.py | ||
---|---|---|
84 | 84 |
rect = self.sceneBoundingRect() |
85 | 85 |
for attr in attributes: |
86 | 86 |
if rect.contains(attr.center()): |
87 |
self.add_assoc_item(attr)
|
|
88 |
attr.owner = self |
|
87 |
if self.add_assoc_item(attr):
|
|
88 |
attr.owner = self
|
|
89 | 89 |
|
90 |
self.associations() # to binding object from scene |
|
90 | 91 |
if 'Text Item' in self._associations and self._associations['Text Item']: |
91 | 92 |
if 0 == self.angle: |
92 | 93 |
sorted(self._associations['Text Item'], key=lambda attr: attr.loc[0]) # sort by x coordinate |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
306 | 306 |
|
307 | 307 |
res = [] |
308 | 308 |
for key in self._associations.keys(): |
309 |
index = 0 |
|
309 | 310 |
for assoc in self._associations[key]: |
310 | 311 |
# find owner with uid |
311 | 312 |
if assoc and type(assoc) is uuid.UUID: |
312 | 313 |
matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(assoc)] |
313 |
if matches: res.append(matches[0]) # TODO: need to update association with instance |
|
314 |
if matches: |
|
315 |
res.append(matches[0]) # TODO: need to update association with instance |
|
316 |
self._associations[key][index] = matches[0] |
|
317 |
index += 1 |
|
314 | 318 |
# up to here |
315 | 319 |
elif assoc: |
316 | 320 |
res.append(assoc) |
내보내기 Unified diff