コード例 #1
0
ファイル: plug.py プロジェクト: jonntd/vortex
 def connect(self, plug, edge=None):
     if not self.isConnectedTo(plug) or not plug.isOutput():
         edge = plug.getConnection(self)
         if not edge:
             edge = baseEdge.Edge("_".join([self.name, plug.name]),
                                  inputPlug=plug,
                                  outputPlug=self)
             self.connectionAdded.emit(edge)
             return edge
         edge.connect(plug, self)
         self.connectionAdded.emit(edge)
         return edge
コード例 #2
0
ファイル: plug.py プロジェクト: jonntd/vortex
 def connect(self, plug):
     """Creates a connection between to plugs, a input can only have one input so current connections is cleared
     before creating the new connection
     :param plug: BasePlug instance
     :return: Edge
     """
     if plug.isInput() or self.getConnection(plug):
         return
     edge = baseEdge.Edge(self.name + "_" + plug.name,
                          inputPlug=self,
                          outputPlug=plug)
     self.dirty = True
     self.connectionAdded.emit(edge)
     return edge
コード例 #3
0
 def testIsConnected(self):
     edge3 = baseEdge.Edge("testEdg2")
     self.assertTrue(self.edge.isConnected(self.inputPlug, self.outputPlug))
     self.assertFalse(edge3.isConnected(self.inputPlug, self.outputPlug))
コード例 #4
0
 def setUp(self):
     self.inputPlug = plug.InputPlug("inputPlug1")
     self.outputPlug = plug.OutputPlug("outputPlug1")
     self.edge = baseEdge.Edge("testEdge1", inputPlug=self.inputPlug, outputPlug=self.outputPlug)
     self.edge2 = baseEdge.Edge("testEdg2", inputPlug=self.inputPlug, outputPlug=self.outputPlug)
コード例 #5
0
 def testEquality(self):
     edge3 = baseEdge.Edge("testEdg2")
     self.assertEquals(self.edge, self.edge2)
     self.assertNotEquals(self.edge, edge3)