290 |
290 |
@brief create a symbol
|
291 |
291 |
@history 2018.05.02 Jeongwoo Change return value of QSymbolEditorDialog (Single variable → Tuple)
|
292 |
292 |
Add SymbolSvgItem
|
|
293 |
2018.05.03 Jeongwoo Change method to draw Svg Item on Scene (svg.addSvgItemToScene)
|
293 |
294 |
'''
|
294 |
295 |
def createSymbol(self):
|
295 |
296 |
image = self.graphicsView.image()
|
... | ... | |
299 |
300 |
self.dirTreeWidget.initDirTreeWidget()
|
300 |
301 |
if isAccepted:
|
301 |
302 |
if isImmediateInsert:
|
302 |
|
''''''
|
303 |
303 |
svgPath = AppDocData.instance().getCurrentProject().getSvgFilePath() + "/" + newSym.getType() + "/" + newSym.getName() + ".svg"
|
304 |
304 |
img = cv2.imread(AppDocData.instance().getCurrentProject().getImageFilePath() + "/" + newSym.getType() + "/" + newSym.getName() + ".png", 1)
|
305 |
305 |
w, h = (0, 0)
|
... | ... | |
314 |
314 |
#### If case of 'lambda svg=svg:', function uses the 'svg' value bound to lambda
|
315 |
315 |
svg.clicked.connect(lambda param=svg: self.resultTreeWidget.findItem(param))
|
316 |
316 |
svg.removed.connect(self.resultTreeWidget.itemRemoved)
|
317 |
|
|
318 |
|
transform = QTransform()
|
319 |
|
transform.translate(offsetX, offsetY)
|
320 |
|
svg.setTransform(transform)
|
321 |
|
self.graphicsView.scene.addItem(svg)
|
|
317 |
svg.addSvgItemToScene(self.graphicsView.scene)
|
322 |
318 |
for connector in svg.connectors:
|
323 |
319 |
self.graphicsView.scene.addItem(connector)
|
324 |
320 |
|
... | ... | |
496 |
492 |
humkyung 2018.04.23 connect item remove slot to result tree
|
497 |
493 |
Jeongwoo 2018.04.25 Add if state with QEngineeringNoteItem
|
498 |
494 |
Jeongwoo 2018.04.26 Change method to create TextItem object with TextItemFactory
|
|
495 |
Jeongwoo 2018.05.03 Change method to draw Svg Item on Scene (svg.addSvgItemToScene)
|
499 |
496 |
'''
|
500 |
497 |
def loadRecognitionResult(self, xmlPath):
|
501 |
498 |
from xml.etree.ElementTree import Element, SubElement, dump, ElementTree, parse
|
... | ... | |
525 |
522 |
#### If case of 'lambda svg=svg:', function uses the 'svg' value bound to lambda
|
526 |
523 |
svg.clicked.connect(lambda param=svg: self.resultTreeWidget.findItem(param))
|
527 |
524 |
svg.removed.connect(self.resultTreeWidget.itemRemoved)
|
528 |
|
|
529 |
|
transform = QTransform()
|
530 |
|
if (1.57 == angle) or (4.71 == angle):
|
531 |
|
transform.translate(pt[0] + size[0]*0.5,pt[1] + size[1]*0.5)
|
532 |
|
transform.rotateRadians(-svg.angle)
|
533 |
|
transform.translate(-size[1]*0.5, -size[0]*0.5)
|
534 |
|
elif 3.14 == angle:
|
535 |
|
transform.translate(pt[0] + size[0]*0.5,pt[1] + size[1]*0.5)
|
536 |
|
transform.rotateRadians(-svg.angle)
|
537 |
|
transform.translate(-size[0]*0.5, -size[1]*0.5)
|
538 |
|
else:
|
539 |
|
transform.translate(pt[0],pt[1])
|
540 |
|
svg.setTransform(transform)
|
541 |
|
self.graphicsView.scene.addItem(svg)
|
|
525 |
svg.addSvgItemToScene(self.graphicsView.scene)
|
542 |
526 |
for connector in svg.connectors:
|
543 |
527 |
self.graphicsView.scene.addItem(connector)
|
544 |
528 |
else:
|