graphics/LD_Objects.py
changeset 253 d9391572655f
parent 249 d8425712acef
child 254 27abdcf9a460
--- a/graphics/LD_Objects.py	Sun Sep 07 15:27:53 2008 +0200
+++ b/graphics/LD_Objects.py	Sun Sep 07 15:29:12 2008 +0200
@@ -400,8 +400,10 @@
             self.SpreadCurrent()
     
     def SpreadCurrent(self):
-        spreading = self.Input.ReceivingCurrent()
-        if self.Value is not None:
+        if self.Parent.Debug:
+            if self.Value is None:
+                self.Value = False
+            spreading = self.Input.ReceivingCurrent()
             if self.Type == CONTACT_NORMAL:
                 spreading &= self.Value
             elif self.Type == CONTACT_REVERSE:
@@ -412,11 +414,11 @@
                 spreading &= self.Value and not self.PreviousValue
             else:
                 spreading = False
-        if spreading and not self.PreviousSpreading:
-            self.Output.SpreadCurrent(True)
-        elif not spreading and self.PreviousSpreading:
-            self.Output.SpreadCurrent(False)
-        self.PreviousSpreading = spreading
+            if spreading and not self.PreviousSpreading:
+                self.Output.SpreadCurrent(True)
+            elif not spreading and self.PreviousSpreading:
+                self.Output.SpreadCurrent(False)
+            self.PreviousSpreading = spreading
     
     # Make a clone of this LD_Contact
     def Clone(self, parent, id = None, pos = None):
@@ -687,20 +689,16 @@
             self.Output.Flush()
             self.Output = None
     
-    def SetValue(self, value):
-        if self.Value != value:
-            self.Value = value
-            self.Refresh()
-    
     def SpreadCurrent(self):
-        self.PreviousValue = self.Value
-        self.Value = self.Input.ReceivingCurrent()
-        if self.Value and not self.PreviousValue:
-            self.Output.SpreadCurrent(True)
-        elif not self.Value and self.PreviousValue:
-            self.Output.SpreadCurrent(False)
-        if self.Value != self.PreviousValue:
-            self.Refresh()
+        if self.Parent.Debug:
+            self.PreviousValue = self.Value
+            self.Value = self.Input.ReceivingCurrent()
+            if self.Value and not self.PreviousValue:
+                self.Output.SpreadCurrent(True)
+            elif not self.Value and self.PreviousValue:
+                self.Output.SpreadCurrent(False)
+            if self.Value != self.PreviousValue:
+                self.Refresh()
     
     # Make a clone of this LD_Coil
     def Clone(self, parent, id = None, pos = None):