개정판 46d70138
issue #563: add error detection
Change-Id: Ice6d19dd3c4c6094b1a255020c1ba3c24127eb0f
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
2053 | 2053 |
matches = [_item for _item in self.graphicsView.scene.items() if hasattr(_item, 'attrs')] |
2054 | 2054 |
# done = False |
2055 | 2055 |
for match in matches: |
2056 |
for assoc in match.associations(): |
|
2056 |
assocs = match.associations() |
|
2057 |
for assoc in assocs: |
|
2057 | 2058 |
if item is assoc: |
2058 | 2059 |
for attr in match.attrs.keys(): |
2059 | 2060 |
if attr.AssocItem and str(item.uid) == str(attr.AssocItem.uid): |
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
151 | 151 |
# move to abstractitem |
152 | 152 |
import uuid |
153 | 153 |
|
154 |
res = [] |
|
155 |
for key in self._associations.keys(): |
|
156 |
index = 0 |
|
157 |
for assoc in list(set(self._associations[key])): |
|
158 |
# find owner with uid if self.scene() is valid |
|
159 |
if self.scene() and assoc and type(assoc) is uuid.UUID: |
|
160 |
matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(assoc)] |
|
161 |
if matches: |
|
162 |
res.append(matches[0]) |
|
163 |
self._associations[key][index] = matches[0] |
|
164 |
# up to here |
|
165 |
elif assoc: |
|
166 |
res.append(assoc) |
|
167 |
index += 1 |
|
168 |
|
|
169 |
for key in self.attrs.keys(): |
|
170 |
if type(key.AssocItem) is uuid.UUID: |
|
171 |
for assoc in res: |
|
172 |
if str(key.AssocItem) == str(assoc.uid): |
|
173 |
key.AssocItem = assoc |
|
154 |
try: |
|
155 |
res = [] |
|
156 |
for key in self._associations.keys(): |
|
157 |
index = 0 |
|
158 |
for assoc in list(set(self._associations[key])): |
|
159 |
# find owner with uid if self.scene() is valid |
|
160 |
if self.scene() and assoc and type(assoc) is uuid.UUID: |
|
161 |
matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(assoc)] |
|
162 |
if matches: |
|
163 |
res.append(matches[0]) |
|
164 |
self._associations[key][index] = matches[0] |
|
165 |
# up to here |
|
166 |
elif assoc: |
|
167 |
res.append(assoc) |
|
168 |
index += 1 |
|
174 | 169 |
|
175 |
return res |
|
170 |
for key in self.attrs.keys(): |
|
171 |
if type(key.AssocItem) is uuid.UUID: |
|
172 |
for assoc in res: |
|
173 |
if str(key.AssocItem) == str(assoc.uid): |
|
174 |
key.AssocItem = assoc |
|
175 |
|
|
176 |
return res |
|
177 |
except Exception as ex: |
|
178 |
from App import App |
|
179 |
from AppDocData import MessageType |
|
180 |
|
|
181 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
182 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
183 |
return [] |
|
176 | 184 |
|
177 | 185 |
def get_assoc_item(self, assoc): |
178 | 186 |
""" get associated item of given object """ |
minorTools/xmlTextSearcher.py | ||
---|---|---|
3 | 3 |
def finder(): |
4 | 4 |
print("finder start") |
5 | 5 |
|
6 |
targetText = ['224d0e6f25c-648f-440a-b135-812d4b2c06e2']
|
|
6 |
targetText = ['Open Drain', 'open drain(1)', 'Open drain(2)', 'Open Drain(3)']
|
|
7 | 7 |
path = 'W:\ID2_Project\REB\Temp' |
8 | 8 |
|
9 | 9 |
print("target : " + str(len(targetText))) |
내보내기 Unified diff