Beispiel #1
0
 def buildFrom(cls, sourceNode, destNode, sourceProp, destProp):
     link = cls()
     
     # id to identify a single instance
     Link.id += 1
     link.id = Link.id
             
     link.sourceNode = sourceNode
     link.destNode = destNode
     
     link.sourceProp = sourceProp
     link.destProp = destProp
     
     # create gfxLink
     from gfx.view import GfxLink
     link.gfxLink = GfxLink.createFromLink(link)     
     
     return link  
Beispiel #2
0
 def buildFrom(cls, sourceNode, destNode, sourceProp, destProp):
     link = cls()
     
     # id to identify a single instance
     Link.id += 1
     link.id = Link.id
             
     link.sourceNode = sourceNode
     link.destNode = destNode
     
     link.sourceProp = sourceProp
     link.destProp = destProp
     
     # create gfxLink
     from gfx.view import GfxLink
     link.gfxLink = GfxLink.createFromLink(link)     
     
     return link  
Beispiel #3
0
 def onMousePressEvent(self, event):
     # propagate to Qt so selected graphics items are selected
     QtGui.QGraphicsView.mousePressEvent(self.controller.gfxPanel, event)
     
     # we got into this state so we know we are on a Property
     itemPressed = self.controller.gfxPanel.itemAt(event.pos())                    
     pickData = itemPressed.propertyAt(self.controller.gfxPanel.mapToScene(event.pos()))
     
     # set source property stuff
     self.gfxSourceNode = itemPressed
     self.sourceProp = pickData['property']
     self.sourcePoint = pickData['point']
     
     # create a GfxLink (points in scene space)
     from gfx.view import GfxLink
     self.gfxLink = GfxLink.createFromPoints(self.sourcePoint, 
                                             self.controller.gfxPanel.mapToScene(event.pos()))
     
     # add GfxLink to the scene
     scene = self.controller.gfxPanel.scene()
     scene.addItem(self.gfxLink)
Beispiel #4
0
    def onMousePressEvent(self, event):
        # propagate to Qt so selected graphics items are selected
        QtGui.QGraphicsView.mousePressEvent(self.controller.gfxPanel, event)

        # we got into this state so we know we are on a Property
        itemPressed = self.controller.gfxPanel.itemAt(event.pos())
        pickData = itemPressed.propertyAt(
            self.controller.gfxPanel.mapToScene(event.pos()))

        # set source property stuff
        self.gfxSourceNode = itemPressed
        self.sourceProp = pickData['property']
        self.sourcePoint = pickData['point']

        # create a GfxLink (points in scene space)
        from gfx.view import GfxLink
        self.gfxLink = GfxLink.createFromPoints(
            self.sourcePoint, self.controller.gfxPanel.mapToScene(event.pos()))

        # add GfxLink to the scene
        scene = self.controller.gfxPanel.scene()
        scene.addItem(self.gfxLink)