Beispiel #1
0
 def loadConn(self, item):
     c = Connection(None, self)
     pt1 = QtCore.QPointF(float(item.findtext('pos1X')),
                          float(item.findtext('pos1Y')))
     pt2 = QtCore.QPointF(float(item.findtext('pos2X')),
                          float(item.findtext('pos2Y')))
     c.pos1 = pt1
     c.pos2 = pt2
     c.update_ports_from_pos()
Beispiel #2
0
 def bindNode(self):
     self.scene.DgmToUndo()
     item = self.scene.item
     if len(item.port_out.connections) == 1:
         c1 = item.port_in.connections[0]
         c2 = item.port_out.connections[0]
         c = Connection(None, self.scene)
         c.pos1 = c1.pos1
         c.pos2 = c2.pos2
         item.remove()
         c.update_ports_from_pos()
         if isinstance(c.port1, OutPort) and isinstance(c.port2, InPort):
             pos = QtCore.QPointF((c.pos2.x() + c.pos1.x()) / 2, c.pos1.y())
             self.newNode(c, pos)
     else:
         self.scene.clearLastUndo()