프로젝트

일반

사용자정보

개정판 cb9f937a

IDcb9f937a80655c6b45bb300d2ca4d75db85aa841
상위 288cb956
하위 676045a1, 44a2e1c8

함의성이(가) 5년 이상 전에 추가함

issue #000: fix symbol item size and add single connection item assistant

Change-Id: I606884ae1e680a5fd0f16a349d3358125ed98744

차이점 보기:

DTI_PID/DTI_PID/QtImageViewer.py
597 597
        from EngineeringLineItem import QEngineeringLineItem
598 598
        from SymbolSvgItem import SymbolSvgItem
599 599

  
600
        svg.transfer.onRemoved.connect(self.mainWindow.itemRemoved)
601

  
600 602
        items = [item for item in self.scene.items(scenePos) if type(item) is not QGraphicsPixmapItem and type(item) is not QGraphicsTextItem]
601 603
        connectors = []
602 604
        if len(items) > 0 and type(items[0]) is QEngineeringConnectorItem:
......
643 645
                            break
644 646
                connectors[0].connectedItem = svg
645 647
        else:
646
            transform = QTransform()
647
            transform.translate(scenePos.x() - svg.symbolOrigin[0], scenePos.y() - svg.symbolOrigin[1])
648
            svg.setTransform(transform)
648
            svg.angle = 0.0
649 649
            svg.loc = [round(scenePos.x() - svg.symbolOrigin[0], 1), round(scenePos.y() - svg.symbolOrigin[1], 1)]
650
            svg.size = [svg.boundingRect().width(), svg.boundingRect().height()]
651 650
            svg.origin = [round(scenePos.x(), 1), round(scenePos.y(), 1)]
652
            self.scene.addItem(svg)
653

  
654
        svg.transfer.onRemoved.connect(self.mainWindow.itemRemoved)
651
            svg.addSvgItemToScene(self.scene)
652
            if len(svg.connectors) == 1:
653
                # single connection item assistant
654
                items = [item for item in self.scene.items(scenePos) if type(item) is QEngineeringConnectorItem and issubclass(type(item.parentItem()), SymbolSvgItem) and not item.connectedItem]
655
                if items:
656
                    svg.connectors[0].connectedItem = items[0].parentItem()
657
                    items[0].connectedItem = svg
655 658

  
656 659
        for conn in svg.connectors:
657 660
            conn.sceneConnectPoint = (conn.sceneBoundingRect().center().x(), conn.sceneBoundingRect().center().y())
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
421 421
            self.type = _type
422 422
            self.angle = angle
423 423
            self.loc = loc
424
            self.size = size
424
            self.size = size if size else [0, 0]
425 425
            self.origin = origin
426 426
            if dbUid is None:
427 427
                symbolInfo = docData.getSymbolByQuery('name', name)

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)