개정판 b5716bb0
line no sort added
Change-Id: I919d015cffb1c444ba1043dd7c4d685d04d77849
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
255 | 255 |
|
256 | 256 |
cmp_fnc = lambda psz1, psz2: _StrCmpLogicalW(psz1, psz2) |
257 | 257 |
|
258 |
sorted(data, key=cmp_to_key(cmp_fnc)) |
|
258 |
return sorted(data, key=cmp_to_key(cmp_fnc))
|
|
259 | 259 |
|
260 | 260 |
''' |
261 | 261 |
@brief Get drawing file list |
... | ... | |
273 | 273 |
(os.path.splitext(f)[1].upper() == '.PNG' or os.path.splitext(f)[1].upper() == '.JPG' or |
274 | 274 |
os.path.splitext(f)[1].upper() == '.JPEG')] |
275 | 275 |
|
276 |
self.winsort(drawingFileList) |
|
276 |
drawingFileList = self.winsort(drawingFileList)
|
|
277 | 277 |
#drawingFileList.sort() |
278 | 278 |
except Exception as ex: |
279 | 279 |
print('error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
593 | 593 |
|
594 | 594 |
self.itemTreeWidget.InitLineNoItems() |
595 | 595 |
|
596 |
line_nos = [line_no for line_no in line_nos if type(line_no) is QEngineeringLineNoTextItem] |
|
596 |
line_nos = app_doc_data.tracerLineNos |
|
597 |
''' |
|
598 |
_line_nos = [line_no for line_no in line_nos if type(line_no) is QEngineeringLineNoTextItem] |
|
597 | 599 |
line_no_pairs = [] |
598 | 600 |
line_no_texts = [] |
599 |
for line_no in line_nos: |
|
601 |
for line_no in _line_nos:
|
|
600 | 602 |
text = line_no.sort_order_text() |
601 | 603 |
line_no_pairs.append([line_no, text]) |
602 | 604 |
line_no_texts.append(text) |
603 | 605 |
|
606 |
line_no_texts = app_doc_data.winsort(list(set(line_no_texts))) |
|
604 | 607 |
|
608 |
for line_no_text in line_no_texts: |
|
609 |
for line_no_pair in [line_no_pair for line_no_pair in line_no_pairs if line_no_pair[1] == line_no_text]: |
|
610 |
line_nos.remove(line_no_pair[0]) |
|
611 |
line_nos.insert(0, line_no_pair[0]) |
|
612 |
''' |
|
605 | 613 |
|
606 |
line_nos = app_doc_data.tracerLineNos |
|
607 |
line_nos.sort(key=lambda x: int(x.getAttributes(True)[[_key for _key in x.getAttributes(True).keys() if _key.Attribute == 'Tag Seq No'][0]]) if (x.getAttributes(True) and [_key for _key in x.getAttributes(True).keys() if _key.Attribute == 'Tag Seq No']) else -1 if type(x) is QEngineeringLineNoTextItem else 9999999) |
|
614 |
#line_nos = app_doc_data.tracerLineNos
|
|
615 |
#line_nos.sort(key=lambda x: int(x.getAttributes(True)[[_key for _key in x.getAttributes(True).keys() if _key.Attribute == 'Tag Seq No'][0]]) if (x.getAttributes(True) and [_key for _key in x.getAttributes(True).keys() if _key.Attribute == 'Tag Seq No']) else -1 if type(x) is QEngineeringLineNoTextItem else 9999999)
|
|
608 | 616 |
for line_no in line_nos: |
609 | 617 |
item = self.itemTreeWidget.addTreeItem(self.itemTreeWidget.root, line_no) |
610 | 618 |
connectedItems = line_no.getConnectedItems() |
... | ... | |
2335 | 2343 |
"""update item tree widget""" |
2336 | 2344 |
line_no_items = [item for item in self.graphicsView.scene().items() |
2337 | 2345 |
if type(item) is QEngineeringLineNoTextItem] |
2338 |
line_no_items.sort(key=lambda x: int(x.getAttributes(True)[[_key for _key in x.getAttributes(True).keys() if _key.Attribute == 'Tag Seq No'][0]]) if (x.getAttributes(True) and [_key for _key in x.getAttributes(True).keys() if _key.Attribute == 'Tag Seq No']) else -1) |
|
2346 |
|
|
2347 |
# line No sort |
|
2348 |
#line_no_items.sort(key=lambda x: int(x.getAttributes(True)[[_key for _key in x.getAttributes(True).keys() if _key.Attribute == 'Tag Seq No'][0]]) if (x.getAttributes(True) and [_key for _key in x.getAttributes(True).keys() if _key.Attribute == 'Tag Seq No']) else -1) |
|
2349 |
line_no_pairs = [] |
|
2350 |
line_no_texts = [] |
|
2351 |
for line_no in line_no_items: |
|
2352 |
text = line_no.sort_order_text() |
|
2353 |
line_no_pairs.append([line_no, text]) |
|
2354 |
line_no_texts.append(text) |
|
2355 |
|
|
2356 |
line_no_texts = app_doc_data.winsort(list(set(line_no_texts))) |
|
2357 |
|
|
2358 |
for line_no_text in line_no_texts: |
|
2359 |
for line_no_pair in [line_no_pair for line_no_pair in line_no_pairs if line_no_pair[1] == line_no_text]: |
|
2360 |
line_no_items.remove(line_no_pair[0]) |
|
2361 |
line_no_items.insert(-1, line_no_pair[0]) |
|
2362 |
# up to here |
|
2363 |
|
|
2339 | 2364 |
for line_no in line_no_items: |
2340 | 2365 |
line_no_tree_item = self.itemTreeWidget.addTreeItem(self.itemTreeWidget.root, line_no) |
2341 | 2366 |
for run in line_no.runs: |
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
1166 | 1166 |
configs = app_doc_data.getConfigs('Sort', 'LineNoKeys') |
1167 | 1167 |
targets = configs[0].value.split(',') if configs else [] |
1168 | 1168 |
|
1169 |
attrs = self.getAttributes(True) |
|
1170 |
matches = [] |
|
1171 |
|
|
1172 |
for key in targets: |
|
1173 |
_matches = [_key for _key in list(attrs.keys()) if str(_key.UID) == key] |
|
1174 |
if _matches: |
|
1175 |
matches.append(attrs[_matches[0]]) |
|
1169 |
if targets: |
|
1170 |
attrs = self.getAttributes(True) |
|
1171 |
matches = [] |
|
1172 |
|
|
1173 |
for key in targets: |
|
1174 |
_matches = [_key for _key in list(attrs.keys()) if str(_key.UID) == key] |
|
1175 |
if _matches: |
|
1176 |
matches.append(attrs[_matches[0]]) |
|
1177 |
else: |
|
1178 |
matches = [self.text()] |
|
1176 | 1179 |
|
1177 | 1180 |
return '_'.join(matches) |
1178 | 1181 |
|
내보내기 Unified diff