개정판 e6c0d46b
restore re undo and copy paste improve
Change-Id: I5e932dd1b620c1c1fc8cd6cd58a46488c56f995b
DTI_PID/DTI_PID/AppRibbon.py | ||
---|---|---|
95 | 95 |
shortcut = QShortcut(QKeySequence(Qt.Key_V), parent) |
96 | 96 |
shortcut.activated.connect(main_wnd.onValidation) |
97 | 97 |
|
98 |
shortcut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_Z), parent) |
|
99 |
shortcut.activated.connect(main_wnd._scene.undo_stack.undo) |
|
100 |
shortcut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_Y), parent) |
|
101 |
shortcut.activated.connect(main_wnd._scene.undo_stack.redo) |
|
102 |
|
|
98 | 103 |
shortcut = QShortcut(QKeySequence(Qt.Key_Z), parent) |
99 | 104 |
shortcut.activated.connect(main_wnd.onAreaZoom) |
100 | 105 |
shortcut = QShortcut(QKeySequence(Qt.Key_W), parent) |
... | ... | |
170 | 175 |
#shortcut = QShortcut(QKeySequence(Qt.Key_L), pane.ui.toolButtonLine) |
171 | 176 |
#shortcut.activated.connect(main_wnd.onPlaceLine) |
172 | 177 |
|
173 |
pane.ui.toolButtonUndo.setEnabled(False) |
|
174 |
pane.ui.toolButtonRedo.setEnabled(False) |
|
175 |
pane.ui.toolButtonUndo.setVisible(False) |
|
176 |
pane.ui.toolButtonRedo.setVisible(False) |
|
178 |
#pane.ui.toolButtonUndo.setEnabled(False)
|
|
179 |
#pane.ui.toolButtonRedo.setEnabled(False)
|
|
180 |
#pane.ui.toolButtonUndo.setVisible(False)
|
|
181 |
#pane.ui.toolButtonRedo.setVisible(False)
|
|
177 | 182 |
pane.ui.toolButtonRotateCCW.setVisible(False) |
178 | 183 |
pane.ui.line_2.setVisible(False) |
179 | 184 |
|
DTI_PID/DTI_PID/Commands/CreateCommand.py | ||
---|---|---|
21 | 21 |
|
22 | 22 |
def redo(self): |
23 | 23 |
"""redo""" |
24 |
|
|
25 | 24 |
if not self._created: |
26 | 25 |
for item in self._items: |
27 | 26 |
self._scene.addItem(item) |
DTI_PID/DTI_PID/Commands/DeleteCommand.py | ||
---|---|---|
7 | 7 |
from PyQt5.QtGui import * |
8 | 8 |
from PyQt5.QtWidgets import * |
9 | 9 |
|
10 |
from SymbolSvgItem import SymbolSvgItem |
|
11 |
#from EngineeringVendorItem import QEngineeringVendorItem |
|
12 |
#from EngineeringTextItem import QEngineeringTextItem |
|
13 |
#from EngineeringAbstractItem import QEngineeringAbstractItem |
|
14 |
|
|
10 | 15 |
|
11 | 16 |
class DeleteCommand(QUndoCommand): |
12 | 17 |
def __init__(self, scene, items, parent=None): |
... | ... | |
18 | 23 |
def undo(self): |
19 | 24 |
"""undo""" |
20 | 25 |
for item in self._items: |
26 |
''' |
|
27 |
if type(item) is not QEngineeringVendorItem and issubclass(type(item), SymbolSvgItem): |
|
28 |
item.addSvgItemToScene(self._scene) |
|
29 |
elif issubclass(type(item), QEngineeringTextItem): |
|
30 |
item.addTextItemToScene(self._scene) |
|
31 |
else: |
|
32 |
self._scene.addItem(item) |
|
33 |
''' |
|
21 | 34 |
self._scene.addItem(item) |
35 |
for conn in item.connectors: |
|
36 |
conn.connectedItem = None |
|
37 |
|
|
38 |
for item in self._items: |
|
39 |
if issubclass(type(item), SymbolSvgItem): |
|
40 |
item.bind_close_items() |
|
22 | 41 |
|
23 | 42 |
def redo(self): |
24 | 43 |
"""redo""" |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
3816 | 3816 |
2018.11.22 euisung fix note road |
3817 | 3817 |
''' |
3818 | 3818 |
def load_recognition_result_from_xml(self, drawing): |
3819 |
''' no more used ''' |
|
3819 | 3820 |
# Yield successive n-sized |
3820 | 3821 |
# chunks from l. |
3821 | 3822 |
def divide_chunks(l, n): |
DTI_PID/DTI_PID/QtImageViewerScene.py | ||
---|---|---|
72 | 72 |
from QEngineeringTrimLineNoTextItem import QEngineeringLineNoTextItem |
73 | 73 |
from EngineeringSpecBreakItem import QEngineeringSpecBreakItem |
74 | 74 |
from EngineeringVendorItem import QEngineeringVendorItem |
75 |
from EngineeringConnectorItem import QEngineeringConnectorItem |
|
75 | 76 |
from DeleteCommand import DeleteCommand |
76 | 77 |
from RotateCommand import RotateCommand |
77 | 78 |
from FlipCommand import FlipCommand |
... | ... | |
80 | 81 |
try: |
81 | 82 |
#print('scene : ' + str(event.key())) |
82 | 83 |
if event.key() == Qt.Key_Delete or event.key() == Qt.Key_E: |
83 |
cmd = DeleteCommand(self, [item for item in self.selectedItems() if hasattr(item, 'transfer')]) |
|
84 |
cmd = DeleteCommand(self, [item for item in self.selectedItems() if hasattr(item, 'transfer') and type(item) is not QEngineeringConnectorItem])
|
|
84 | 85 |
self._undo_stack.push(cmd) |
85 | 86 |
elif event.key() in [Qt.Key_S, Qt.Key_D, Qt.Key_H]: |
86 | 87 |
if self.selectedItems(): |
... | ... | |
145 | 146 |
from xml.etree import ElementTree |
146 | 147 |
|
147 | 148 |
root = ElementTree.fromstring(text) |
149 |
new_symbols = [] |
|
148 | 150 |
|
149 | 151 |
fromDrawing = root.find('DWGNAME').text |
150 | 152 |
fixedPosition = False |
... | ... | |
180 | 182 |
svg.set_property('Show', True) |
181 | 183 |
|
182 | 184 |
QtImageViewer.matchSymbolToLine(self, svg, QPointF(item.origin[0], item.origin[1]) + delta, item.angle) |
185 |
new_symbols.append(svg) |
|
183 | 186 |
''' |
184 | 187 |
# uid 새로 할당 |
185 | 188 |
item.uid = uuid.uuid4() |
... | ... | |
237 | 240 |
|
238 | 241 |
self.addItem(item) |
239 | 242 |
|
243 |
for svg in new_symbols: |
|
244 |
svg.bind_close_items() |
|
245 |
|
|
240 | 246 |
elif event.key() == Qt.Key_Z and event.modifiers() & Qt.ControlModifier: |
241 | 247 |
#self._undo_stack.undo() |
242 | 248 |
pass |
내보내기 Unified diff