graphics/GraphicCommons.py
changeset 102 85875dcb7754
parent 99 2b18a72dcaf0
child 108 9aa1fdfb7cb2
--- a/graphics/GraphicCommons.py	Tue Oct 02 18:00:13 2007 +0200
+++ b/graphics/GraphicCommons.py	Tue Oct 02 18:07:59 2007 +0200
@@ -684,8 +684,12 @@
         self.Pos = position
         self.Direction = direction
         self.Wires = []
-        self.Negated = negated
-        self.Edge = edge
+        if IsOfType("BOOL", type):
+            self.Negated = negated
+            self.Edge = edge
+        else:
+            self.Negated = False
+            self.Edge = "none"
         self.OneConnected = onlyone
         self.Pen = wx.BLACK_PEN
         self.RefreshNameSize()
@@ -707,8 +711,10 @@
     def GetType(self):
         if IsEndType(self.Type):
             return self.Type
+        elif (self.Negated or self.Edge != "none") and IsOfType("BOOL", self.Type):
+            return "BOOL"
         else:
-            return self.ParentBlock.GetConnectionResultType(self)
+            return self.ParentBlock.GetConnectionResultType(self, self.Type)
     
     # Returns the connector type
     def GetConnectedType(self):
@@ -735,6 +741,10 @@
     def SetName(self, name):
         self.Name = name
         self.RefreshNameSize()
+
+    def SetValue(self, value):
+        for wire, handle in self.Wires:
+            wire.SetValue(value)
     
     # Changes the connector name size
     def RefreshNameSize(self):
@@ -874,8 +884,9 @@
     
     # Changes the connector negated property
     def SetNegated(self, negated):
-        self.Negated = negated
-        self.Edge = "none"
+        if IsOfType("BOOL", self.Type):
+            self.Negated = negated
+            self.Edge = "none"
     
     # Returns the connector edge property
     def GetEdge(self):
@@ -883,8 +894,9 @@
     
     # Changes the connector edge property
     def SetEdge(self, edge):
-        self.Edge = edge
-        self.Negated = False
+        if IsOfType("BOOL", self.Type):
+            self.Edge = edge    
+            self.Negated = False
     
     # Tests if the point given is near from the end point of this connector
     def TestPoint(self, pt, exclude = True):
@@ -964,6 +976,7 @@
             self.Points = []
             self.Segments = []
         self.SelectedSegment = None
+        self.Value = None
         self.OverStart = False
         self.OverEnd = False
     
@@ -1013,6 +1026,9 @@
             return True
         return False
     
+    def SetValue(self, value):
+        self.Value = value
+    
     # Unconnect the start and end points
     def Clean(self):
         if self.StartConnected: