개정판 b73a62df
issue #578:
- show number of line no
DTI_PID/DTI_PID/ItemTreeWidget.py | ||
---|---|---|
347 | 347 |
''' |
348 | 348 |
lastSceneItems = None |
349 | 349 |
def sceneChanged(self, sceneItems): |
350 |
changedSceneItems = [item for item in sceneItems if ((issubclass(type(item), SymbolSvgItem)) or (type(item) is QEngineeringNoteItem) or (type(item) is QEngineeringLineNoTextItem) |
|
351 |
or (type(item) is QEngineeringUnknownItem)) and (not hasattr(item, 'treeItem') or item.treeItem is None)] # Sublist includes SymbolSvgItem |
|
352 |
first = [item for item in changedSceneItems if item.owner is None] |
|
353 |
second = [item for item in changedSceneItems if item.owner is not None] |
|
354 |
self.initResultTreeWidget(first + second) |
|
355 |
|
|
350 |
try: |
|
351 |
changedSceneItems = [item for item in sceneItems if ((issubclass(type(item), SymbolSvgItem)) or (type(item) is QEngineeringNoteItem) or (type(item) is QEngineeringLineNoTextItem) |
|
352 |
or (type(item) is QEngineeringUnknownItem)) and (not hasattr(item, 'treeItem') or item.treeItem is None)] # Sublist includes SymbolSvgItem |
|
353 |
first = [item for item in changedSceneItems if item.owner is None] |
|
354 |
second = [item for item in changedSceneItems if item.owner is not None] |
|
355 |
self.initResultTreeWidget(first + second) |
|
356 |
finally: |
|
357 |
if hasattr(self, 'LineNoTreeItem'): |
|
358 |
self.LineNoTreeItem.setText(0, 'LINE NO({})'.format(self.LineNoTreeItem.childCount())) |
|
359 |
|
|
356 | 360 |
''' |
357 | 361 |
@brief Initialize TreeWidget |
358 | 362 |
Tree Item Clear and Add Item |
DTI_PID/DTI_PID/TextItemFactory.py | ||
---|---|---|
50 | 50 |
result = (False,) |
51 | 51 |
result = self.isLineNo(text) |
52 | 52 |
|
53 |
if self.isNoteNoText(text): |
|
54 |
item = QEngineeringNoteItem() |
|
55 |
item.setToolTip(text) |
|
56 |
elif result[0]: |
|
53 |
if result[0]: |
|
57 | 54 |
item = QEngineeringLineNoTextItem(text) |
58 | 55 |
item.setToolTip(text) |
59 | 56 |
|
60 | 57 |
# get color option |
61 | 58 |
configs = docData.getConfigs('Line Color', 'Visible Option') |
62 |
colorProperty = '' |
|
63 | 59 |
if configs: |
64 | 60 |
visibleOption = configs[0].value |
65 | 61 |
else: |
... | ... | |
96 | 92 |
rgb = data.split(',') |
97 | 93 |
item.setColor(QColor(int(rgb[0]), int(rgb[1]), int(rgb[2])).name()) |
98 | 94 |
# up to here |
95 |
elif self.isNoteNoText(text): |
|
96 |
item = QEngineeringNoteItem() |
|
97 |
item.setToolTip(text) |
|
99 | 98 |
elif self.isSizeText(text, sizeDelimiter): |
100 | 99 |
item = QEngineeringSizeTextItem() |
101 | 100 |
item.setToolTip(text) |
... | ... | |
315 | 314 |
def isNoteNoText(self, text): |
316 | 315 |
appDocData = AppDocData.instance() |
317 | 316 |
configs = appDocData.getConfigs('Note No Tag Rule', 'Note No Expression') |
318 |
if 1 == len(configs): |
|
317 |
if 1 == len(configs) and configs[0].value:
|
|
319 | 318 |
expression = configs[0].value |
320 | 319 |
match = re.search(re.compile(expression), text) |
321 | 320 |
return (True if match else False) |
내보내기 Unified diff