Bug on Contact Rising and Falling edge not displayed correctly while debugging fixed
authorlaurent
Wed, 30 Mar 2011 15:50:16 +0200
changeset 508 01f49e491be5
parent 507 42150e041dbe
child 509 6f72513bc074
Bug on Contact Rising and Falling edge not displayed correctly while debugging fixed
graphics/LD_Objects.py
--- a/graphics/LD_Objects.py	Wed Mar 30 15:49:09 2011 +0200
+++ b/graphics/LD_Objects.py	Wed Mar 30 15:50:16 2011 +0200
@@ -417,9 +417,15 @@
                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
     
     def SetValue(self, value):
+        if self.Type == CONTACT_RISING:
+            refresh = self.Value and not self.PreviousValue
+        elif self.Type == CONTACT_FALLING:
+            refresh = not self.Value and self.PreviousValue
+        else:
+            refresh = False
         self.PreviousValue = self.Value
         self.Value = value
-        if self.Value != self.PreviousValue:
+        if self.Value != self.PreviousValue or refresh:
             if self.Visible:
                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
             self.SpreadCurrent()
@@ -436,7 +442,7 @@
             elif self.Type == CONTACT_RISING:
                 spreading &= self.Value and not self.PreviousValue
             elif self.Type == CONTACT_FALLING:
-                spreading &= self.Value and not self.PreviousValue
+                spreading &= not self.Value and self.PreviousValue
             else:
                 spreading = False
             if spreading and not self.PreviousSpreading:
@@ -635,7 +641,7 @@
             if self.Type == CONTACT_NORMAL and self.Value or \
                self.Type == CONTACT_REVERSE and not self.Value or \
                self.Type == CONTACT_RISING and self.Value and not self.PreviousValue or \
-               self.Type == CONTACT_RISING and self.Value and not self.PreviousValue:
+               self.Type == CONTACT_RISING and not self.Value and self.PreviousValue:
                 if self.Forced:
                     dc.SetPen(wx.CYAN_PEN)
                 else: