개정판 5fb1ee2f
issue #000: fix explode with freeze and add explode keep from, to value
Change-Id: I51b675833189c09da96942c8f0957adf3553f9cb
DTI_PID/DTI_PID/ItemTreeWidget.py | ||
---|---|---|
137 | 137 |
explode_action = QAction(self.tr("Explode")) |
138 | 138 |
explode_action.triggered.connect(lambda : self.explode_all_line_nos(item)) |
139 | 139 |
menu.addAction(explode_action) |
140 |
explodeKeepFromTo_action = QAction(self.tr("Explode (keep from, to)")) |
|
141 |
explodeKeepFromTo_action.triggered.connect(lambda : self.explode_all_line_nos(item, True)) |
|
142 |
menu.addAction(explodeKeepFromTo_action) |
|
140 | 143 |
menu.exec_(self.viewport().mapToGlobal(position)) |
141 | 144 |
else: |
142 | 145 |
data = item.data(0, self.TREE_DATA_ROLE) |
... | ... | |
148 | 151 |
menu.addAction(pickColorAction) |
149 | 152 |
explode_action = QAction(self.tr("Explode")) |
150 | 153 |
freeze = data.prop('Freeze') |
151 |
#print(freeze) |
|
152 | 154 |
explode_action.setEnabled(not freeze) |
153 | 155 |
explode_action.triggered.connect(lambda : self.explode_line_no(item)) |
154 | 156 |
menu.addAction(explode_action) |
... | ... | |
209 | 211 |
finally: |
210 | 212 |
pass |
211 | 213 |
|
212 |
def explode_all_line_nos(self, tree_widget_item): |
|
214 |
def explode_all_line_nos(self, tree_widget_item, remainFromTo=False):
|
|
213 | 215 |
""" explode all line nos """ |
214 | 216 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
215 | 217 |
|
216 |
try: |
|
217 |
for i in reversed(range(self.LineNoTreeItem.childCount())): |
|
218 |
self.explode_line_no(self.LineNoTreeItem.child(i)) |
|
219 |
finally: |
|
220 |
for item in [item for item in self.scene.items() if hasattr(item, '_owner') and item.owner is not None]: |
|
221 |
if type(item.owner) is QEngineeringLineNoTextItem and 'False' == str(item.owner.property('Freeze')): |
|
222 |
item.owner = None |
|
223 |
|
|
218 |
for i in reversed(range(self.LineNoTreeItem.childCount())): |
|
219 |
if not self.LineNoTreeItem.child(i).data(0, self.TREE_DATA_ROLE).prop('Freeze'): |
|
220 |
self.explode_line_no(self.LineNoTreeItem.child(i), remainFromTo) |
|
221 |
|
|
224 | 222 |
def reverse_line_flow(self, lineNoTreeWidgetItem): |
225 | 223 |
""" reverse line flow """ |
226 | 224 |
|
... | ... | |
231 | 229 |
finally: |
232 | 230 |
pass |
233 | 231 |
|
234 |
def explode_line_no(self, lineNoTreeWidgetItem): |
|
232 |
def explode_line_no(self, lineNoTreeWidgetItem, remainFromTo=False):
|
|
235 | 233 |
""" explode line no """ |
236 | 234 |
|
237 | 235 |
try: |
... | ... | |
244 | 242 |
for i in reversed(range(lineNoTreeWidgetItem.childCount())): |
245 | 243 |
lineNoTreeWidgetItem.takeChild(i) |
246 | 244 |
|
247 |
line_no_item.explode() |
|
245 |
line_no_item.explode(remainFromTo)
|
|
248 | 246 |
finally: |
249 | 247 |
pass |
250 | 248 |
|
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
483 | 483 |
|
484 | 484 |
return visited |
485 | 485 |
|
486 |
def explode(self): |
|
486 |
def explode(self, remainFromTo=False):
|
|
487 | 487 |
""" explode line no """ |
488 | 488 |
|
489 | 489 |
if False == self.prop('Freeze'): |
... | ... | |
492 | 492 |
self.runs[index].explode() |
493 | 493 |
finally: |
494 | 494 |
self.runs.clear() |
495 |
self.set_property('From', None) |
|
496 |
self.set_property('To', None) |
|
495 |
if not remainFromTo: |
|
496 |
self.set_property('From', None) |
|
497 |
self.set_property('To', None) |
|
497 | 498 |
|
498 | 499 |
''' |
499 | 500 |
@brief save Line Data |
DTI_PID/DTI_PID/Shapes/QEngineeringTrimLineNoTextItem.py | ||
---|---|---|
63 | 63 |
|
64 | 64 |
return node |
65 | 65 |
|
66 |
def explode(self): |
|
66 |
def explode(self, dummy=None):
|
|
67 | 67 |
from App import App |
68 | 68 |
super().explode() |
69 | 69 |
treeWidget = App.mainWnd().itemTreeWidget |
내보내기 Unified diff