개정판 7375ffe7
add symbol explode funct
Change-Id: I683361e5dab43cc83f00176e66f05dfb7647387b
DTI_PID/DTI_PID/ItemTreeWidget.py | ||
---|---|---|
27 | 27 |
from EngineeringUnknownItem import QEngineeringUnknownItem |
28 | 28 |
from EngineeringErrorItem import QEngineeringErrorItem |
29 | 29 |
from EngineeringEndBreakItem import QEngineeringEndBreakItem |
30 |
from EngineeringSpecBreakItem import QEngineeringSpecBreakItem |
|
31 |
from EngineeringErrorItem import QEngineeringErrorItem |
|
30 | 32 |
from EngineeringFlowMarkItem import QEngineeringFlowMarkItem |
31 | 33 |
from EngineeringLineItem import QEngineeringLineItem |
32 | 34 |
from SymbolSvgItem import SymbolSvgItem |
... | ... | |
160 | 162 |
showAction.triggered.connect(lambda: self.showFromToALLEvent(item)) |
161 | 163 |
menu.addAction(showAction) |
162 | 164 |
menu.exec_(self.viewport().mapToGlobal(position)) |
165 |
if item is self.SymbolsTreeItem: |
|
166 |
menu = QMenu() |
|
167 |
explode_action = QAction(self.tr("Explode Attributes(keep breaks)")) |
|
168 |
explode_action.triggered.connect(lambda: self.explode_all_symbols(item)) |
|
169 |
menu.addAction(explode_action) |
|
170 |
menu.exec_(self.viewport().mapToGlobal(position)) |
|
163 | 171 |
else: |
164 | 172 |
data = item.data(0, self.TREE_DATA_ROLE) |
165 | 173 |
if len(indexes) > 0 and data is not None and issubclass(type(data), QEngineeringLineNoTextItem): |
... | ... | |
273 | 281 |
sys.exc_info()[-1].tb_lineno) |
274 | 282 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
275 | 283 |
|
284 |
def explode_all_symbols(self, tree_widget_item): |
|
285 |
""" explode all symbol's attribute """ |
|
286 |
|
|
287 |
try: |
|
288 |
for i in reversed(range(self.SymbolsTreeItem.childCount())): |
|
289 |
symbol = self.SymbolsTreeItem.child(i).data(0, self.TREE_DATA_ROLE) |
|
290 |
if type(symbol) is QEngineeringSpecBreakItem or type(symbol) is QEngineeringErrorItem or type(symbol) is QEngineeringEndBreakItem: |
|
291 |
continue |
|
292 |
for assoc in symbol.associations(): |
|
293 |
if issubclass(type(assoc), QEngineeringTextItem): |
|
294 |
assoc.owner = None |
|
295 |
symbol.attrs = {} |
|
296 |
symbol._associations = {'Text Item': [], 'Symbol Item': []} |
|
297 |
|
|
298 |
except Exception as ex: |
|
299 |
from App import App |
|
300 |
from AppDocData import MessageType |
|
301 |
|
|
302 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
303 |
sys.exc_info()[-1].tb_lineno) |
|
304 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
305 |
|
|
276 | 306 |
def explode_all_line_nos(self, tree_widget_item, remainFromTo=False): |
277 | 307 |
""" explode all line nos """ |
278 | 308 |
|
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
264 | 264 |
|
265 | 265 |
def associations(self): |
266 | 266 |
""" return associated instance """ |
267 |
# move to abstractitem |
|
267 |
|
|
268 | 268 |
import uuid |
269 | 269 |
|
270 | 270 |
try: |
DTI_PID/DTI_PID/SymbolListTreeWidget.py | ||
---|---|---|
27 | 27 |
from EngineeringUnknownItem import QEngineeringUnknownItem |
28 | 28 |
from EngineeringErrorItem import QEngineeringErrorItem |
29 | 29 |
from EngineeringEndBreakItem import QEngineeringEndBreakItem |
30 |
from EngineeringSpecBreakItem import QEngineeringSpecBreakItem |
|
31 |
from EngineeringErrorItem import QEngineeringErrorItem |
|
30 | 32 |
from EngineeringFlowMarkItem import QEngineeringFlowMarkItem |
31 | 33 |
from EngineeringLineItem import QEngineeringLineItem |
32 | 34 |
from SymbolSvgItem import SymbolSvgItem |
... | ... | |
68 | 70 |
self.imageViewer = imageViewer |
69 | 71 |
self.scene = imageViewer.scene() |
70 | 72 |
self.root = None |
71 |
#self.customContextMenuRequested.connect(self.openContextMenu) |
|
73 |
self.setContextMenuPolicy(Qt.CustomContextMenu) |
|
74 |
self.customContextMenuRequested.connect(self.openContextMenu) |
|
72 | 75 |
|
73 | 76 |
''' |
74 | 77 |
@brief delete selected symbol |
... | ... | |
113 | 116 |
sys.exc_info()[-1].tb_lineno) |
114 | 117 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
115 | 118 |
|
119 |
def openContextMenu(self, position): |
|
120 |
try: |
|
121 |
indexes = self.selectedIndexes() |
|
122 |
itemPosition = self.mapTo(self, position) |
|
123 |
item = self.itemAt(itemPosition) |
|
124 |
if item is not None: |
|
125 |
if item is self.SymbolsTreeItem: |
|
126 |
menu = QMenu() |
|
127 |
explode_action = QAction(self.tr("Explode Attributes(keep breaks)")) |
|
128 |
explode_action.triggered.connect(lambda: self.explode_all_symbols(item)) |
|
129 |
menu.addAction(explode_action) |
|
130 |
menu.exec_(self.viewport().mapToGlobal(position)) |
|
131 |
except Exception as ex: |
|
132 |
from App import App |
|
133 |
from AppDocData import MessageType |
|
134 |
|
|
135 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
136 |
sys.exc_info()[-1].tb_lineno) |
|
137 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
138 |
|
|
139 |
def explode_all_symbols(self, tree_widget_item): |
|
140 |
""" explode all symbol's attribute """ |
|
141 |
|
|
142 |
from EngineeringSpecBreakItem import QEngineeringSpecBreakItem |
|
143 |
from EngineeringErrorItem import QEngineeringErrorItem |
|
144 |
from EngineeringEndBreakItem import QEngineeringEndBreakItem |
|
145 |
|
|
146 |
try: |
|
147 |
for i in reversed(range(self.SymbolsTreeItem.childCount())): |
|
148 |
symbol = self.SymbolsTreeItem.child(i).data(0, self.TREE_DATA_ROLE) |
|
149 |
if type(symbol) is QEngineeringSpecBreakItem or type(symbol) is QEngineeringErrorItem or type(symbol) is QEngineeringEndBreakItem: |
|
150 |
continue |
|
151 |
for assoc in symbol.associations(): |
|
152 |
if issubclass(type(assoc), QEngineeringTextItem): |
|
153 |
assoc.owner = None |
|
154 |
symbol.attrs = {} |
|
155 |
symbol._associations = {'Text Item': [], 'Symbol Item': []} |
|
156 |
|
|
157 |
except Exception as ex: |
|
158 |
from App import App |
|
159 |
from AppDocData import MessageType |
|
160 |
|
|
161 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
162 |
sys.exc_info()[-1].tb_lineno) |
|
163 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
164 |
|
|
116 | 165 |
''' |
117 | 166 |
@brief Clear TreeWidget and Set Current PID |
118 | 167 |
@author Jeongwoo |
내보내기 Unified diff