개정판 d92c6e2a
search duplication line no improve
Change-Id: I1e6fd84c9e54d1f7617c6eab38875177fdc98894
DTI_PID/DTI_PID/TextItemEditDialog.py | ||
---|---|---|
59 | 59 |
finally: |
60 | 60 |
pass |
61 | 61 |
|
62 |
app_doc_data = AppDocData.instance() |
|
63 |
configs = app_doc_data.getConfigs('Sort', 'LineNoKeys') |
|
64 |
keys = configs[0].value if configs else '' |
|
65 |
self.target = keys.split(',') if keys else [] |
|
66 |
|
|
62 | 67 |
def set_angle_zero(self): |
63 | 68 |
text_items = [item for item in self.mainWindow.graphicsView.scene().items() |
64 | 69 |
if issubclass(type(item), QEngineeringTextItem) and item.owner] |
... | ... | |
289 | 294 |
sys.exc_info()[-1].tb_lineno) |
290 | 295 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
291 | 296 |
|
297 |
def compare_line_no(self, lineNo1, lineNo2): |
|
298 |
""" return true if line no same""" |
|
299 |
|
|
300 |
if not self.target or not lineNo1 or not lineNo2: |
|
301 |
return False |
|
302 |
|
|
303 |
if lineNo1.text() == lineNo2.text(): |
|
304 |
return True |
|
305 |
|
|
306 |
attrs1 = lineNo1.getAttributes(True) |
|
307 |
attrs2 = lineNo2.getAttributes(True) |
|
308 |
|
|
309 |
for key in self.target: |
|
310 |
matches1 = [_key for _key in list(attrs1.keys()) if str(_key.UID) == key] |
|
311 |
matches2 = [_key for _key in list(attrs2.keys()) if str(_key.UID) == key] |
|
312 |
|
|
313 |
if not matches1 and not matches2: |
|
314 |
continue |
|
315 |
if not (matches1 and matches2 and attrs1[matches1[0]] == attrs2[matches2[0]]): |
|
316 |
return False |
|
317 |
|
|
318 |
return True |
|
319 |
|
|
292 | 320 |
def find_text(self): |
293 | 321 |
"""find user input text""" |
294 | 322 |
|
... | ... | |
311 | 339 |
for line_no2 in line_nos: |
312 | 340 |
if line_no1 == line_no2: |
313 | 341 |
continue |
314 |
elif line_no1.text() == line_no2.text() :
|
|
342 |
elif (not self.target and line_no1.text() == line_no2.text()) or (self.target and self.compare_line_no(line_no1, line_no2)):
|
|
315 | 343 |
if line_no1.text() not in duplication: |
316 | 344 |
duplication[line_no1.text()] = [line_no1, line_no2] |
317 | 345 |
else: |
내보내기 Unified diff