개정판 ce1fcab9
add delete context
Change-Id: I59c223c97dd67f7852153ef8427d19630c75940b
DTI_PID/DTI_PID/ItemTreeWidget.py | ||
---|---|---|
91 | 91 |
if self.selectedItems(): |
92 | 92 |
for item in self.selectedItems(): |
93 | 93 |
data = item.data(0, self.TREE_DATA_ROLE) |
94 |
if data is not None: |
|
94 |
if data is not None and (type(data) is QEngineeringUnknownItem or issubclass(type(data), SymbolSvgItem)):
|
|
95 | 95 |
data.transfer.onRemoved.emit(data) |
96 | 96 |
# self.imageViewer.scene.removeItem(data) |
97 | 97 |
|
... | ... | |
191 | 191 |
reverse_flow_action = QAction(self.tr("Reverse Flow")) |
192 | 192 |
reverse_flow_action.triggered.connect(lambda: self.reverse_line_flow(item)) |
193 | 193 |
menu.addAction(reverse_flow_action) |
194 |
delete_action = QAction(self.tr("Delete")) |
|
195 |
delete_action.triggered.connect(lambda: self.delete_action(item)) |
|
196 |
menu.addAction(delete_action) |
|
194 | 197 |
menu.exec_(self.viewport().mapToGlobal(position)) |
195 | 198 |
elif len(indexes) > 0 and data is not None and issubclass(type(data), QEngineeringRunItem): |
196 | 199 |
menu = QMenu() |
... | ... | |
323 | 326 |
sys.exc_info()[-1].tb_lineno) |
324 | 327 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
325 | 328 |
|
329 |
def delete_action(self, lineTreeWidgetItem): |
|
330 |
""" delete line no """ |
|
331 |
|
|
332 |
try: |
|
333 |
text, result = QInputDialog.getText(self, self.tr('Delete line no.'), self.tr('To proceed, enter "Confirm" in the input box below.')) |
|
334 |
|
|
335 |
if result and text == 'Confirm': |
|
336 |
line_item = lineTreeWidgetItem.data(0, self.TREE_DATA_ROLE) |
|
337 |
if line_item: |
|
338 |
line_item.transfer.onRemoved.emit(line_item) |
|
339 |
except Exception as ex: |
|
340 |
from App import App |
|
341 |
from AppDocData import MessageType |
|
342 |
|
|
343 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
344 |
sys.exc_info()[-1].tb_lineno) |
|
345 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
346 |
|
|
326 | 347 |
def reverse_line_flow(self, lineTreeWidgetItem): |
327 | 348 |
""" reverse line flow """ |
328 | 349 |
|
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
688 | 688 |
x = self.loc[0] |
689 | 689 |
y = self.loc[1] |
690 | 690 |
|
691 |
#x = self.transform().m31() |
|
692 |
#y = self.transform().m32() |
|
693 |
|
|
691 | 694 |
transform = QTransform() |
692 | 695 |
if (1.57 == self.angle) or (4.71 == self.angle): |
693 | 696 |
rect = self.text_size |
내보내기 Unified diff