14 |
14 |
|
15 |
15 |
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\Commands')
|
16 |
16 |
import DefaultCommand
|
|
17 |
import CopySymbolCommand
|
17 |
18 |
|
18 |
19 |
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\Shapes')
|
19 |
20 |
from EngineeringLineItem import QEngineeringLineItem
|
... | ... | |
58 |
59 |
self.mainWindow = mainWindow
|
59 |
60 |
# Image is displayed as a QPixmap in a QGraphicsScene attached to this QGraphicsView.
|
60 |
61 |
self.command = None
|
61 |
|
self.scene = QGraphicsScene()
|
|
62 |
self.scene = QGraphicsScene(self)
|
62 |
63 |
self.setScene(self.scene)
|
63 |
64 |
self.scene.setBackgroundBrush(Qt.gray)
|
64 |
65 |
self.crosshairPos = None
|
... | ... | |
101 |
102 |
# set currentAttribute
|
102 |
103 |
self.currentAttribute = ''
|
103 |
104 |
|
|
105 |
# copy symbol
|
|
106 |
self.copySymbol = None
|
|
107 |
|
104 |
108 |
'''
|
105 |
109 |
@brief Return Pixmap Handler
|
106 |
110 |
@author Jeongwoo
|
... | ... | |
306 |
310 |
items[0].attrs.append(attrItem)
|
307 |
311 |
#resultPropertyTable refresh
|
308 |
312 |
self.mainWindow.refreshResultPropertyTableWidget()
|
309 |
|
else:
|
310 |
|
pass
|
311 |
|
|
312 |
|
self.command = DefaultCommand.DefaultCommand(self)
|
313 |
|
cursor = QCursor(Qt.ArrowCursor)
|
314 |
|
QApplication.instance().setOverrideCursor(cursor)
|
315 |
|
|
|
313 |
|
|
314 |
self.command = DefaultCommand.DefaultCommand(self)
|
|
315 |
cursor = QCursor(Qt.ArrowCursor)
|
|
316 |
QApplication.instance().setOverrideCursor(cursor)
|
316 |
317 |
return
|
317 |
318 |
|
318 |
319 |
QGraphicsView.mouseReleaseEvent(self, event)
|
... | ... | |
353 |
354 |
elif event.key() == Qt.Key_Escape:
|
354 |
355 |
if self.command is not None:
|
355 |
356 |
self.command.execute(['keyPressEvent', event])
|
|
357 |
elif event.key() == Qt.Key_C and self.isPressCtrl:
|
|
358 |
selectedItems = self.scene.selectedItems()
|
|
359 |
if len(selectedItems) == 1 and type(selectedItems[0]) is SymbolSvgItem:
|
|
360 |
self.copySymbol = selectedItems[0]
|
|
361 |
elif event.key() == Qt.Key_V and self.isPressCtrl:
|
|
362 |
if self.copySymbol is not None:
|
|
363 |
self.command = CopySymbolCommand.CopySymbolCommand(self)
|
|
364 |
|
356 |
365 |
|
357 |
366 |
QGraphicsView.keyPressEvent(self, event)
|
358 |
367 |
except Exception as ex:
|
... | ... | |
481 |
490 |
def dropEvent(self, event):
|
482 |
491 |
from AppDocData import AppDocData
|
483 |
492 |
import symbol
|
484 |
|
|
|
493 |
|
485 |
494 |
scenePos = self.mapToScene(event.pos())
|
486 |
495 |
svgFileName = event.mimeData().text()
|
|
496 |
self.createSymbolAtPoint(scenePos, svgFileName)
|
|
497 |
event.acceptProposedAction()
|
|
498 |
|
|
499 |
'''
|
|
500 |
@brief drop create Symbol
|
|
501 |
@author kyouho
|
|
502 |
@date 2018.07.27
|
|
503 |
'''
|
|
504 |
def createSymbolAtPoint(self, scenePos, svgFileName):
|
|
505 |
from AppDocData import AppDocData
|
|
506 |
import symbol
|
|
507 |
|
487 |
508 |
symbol = AppDocData.instance().getSymbolByQuery('name', svgFileName)
|
488 |
509 |
svgFilePath = os.path.join(AppDocData.instance().getCurrentProject().getSvgFilePath(), symbol.getType(), svgFileName+'.svg')
|
489 |
510 |
svg = SymbolSvgItem.createItem(symbol.getType(), svgFilePath)
|
... | ... | |
515 |
536 |
self.setFocus()
|
516 |
537 |
svg.setSelected(True)
|
517 |
538 |
self.scene.setFocusItem(svg)
|
518 |
|
event.acceptProposedAction()
|
519 |
539 |
|
520 |
540 |
if __name__ == '__main__':
|
521 |
541 |
import sys
|