graphics/SFC_Objects.py
changeset 368 591ba4003d74
parent 361 62570186dad4
child 379 e4c26ee9c998
equal deleted inserted replaced
367:2fdf57d0ce51 368:591ba4003d74
    75     
    75     
    76     def SetValue(self, value):
    76     def SetValue(self, value):
    77         self.PreviousValue = self.Value
    77         self.PreviousValue = self.Value
    78         self.Value = value
    78         self.Value = value
    79         if self.Value != self.PreviousValue:
    79         if self.Value != self.PreviousValue:
    80             self.Parent.UpdateRefreshRect(self.GetRedrawRect())
    80             if self.Visible:
       
    81                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
    81             self.SpreadCurrent()
    82             self.SpreadCurrent()
    82     
    83     
    83     def SpreadCurrent(self):
    84     def SpreadCurrent(self):
    84         if self.Parent.Debug:
    85         if self.Parent.Debug:
    85             spreading = self.Value
    86             spreading = self.Value
   579     
   580     
   580     def SetValue(self, value):
   581     def SetValue(self, value):
   581         self.PreviousValue = self.Value
   582         self.PreviousValue = self.Value
   582         self.Value = value
   583         self.Value = value
   583         if self.Value != self.PreviousValue:
   584         if self.Value != self.PreviousValue:
   584             self.Parent.UpdateRefreshRect(self.GetRedrawRect())
   585             if self.Visible:
       
   586                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
   585             self.SpreadCurrent()
   587             self.SpreadCurrent()
   586     
   588     
   587     def SpreadCurrent(self):
   589     def SpreadCurrent(self):
   588         if self.Parent.Debug:
   590         if self.Parent.Debug:
   589             if self.Value is None:
   591             if self.Value is None:
  1027             elif self.Type in [SELECTION_DIVERGENCE, SIMULTANEOUS_DIVERGENCE]:
  1029             elif self.Type in [SELECTION_DIVERGENCE, SIMULTANEOUS_DIVERGENCE]:
  1028                 self.Value = self.Inputs[0].ReceivingCurrent()
  1030                 self.Value = self.Inputs[0].ReceivingCurrent()
  1029             else:
  1031             else:
  1030                 self.Value = False
  1032                 self.Value = False
  1031             if self.Value and not self.PreviousValue:
  1033             if self.Value and not self.PreviousValue:
  1032                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
  1034                 if self.Visible:
       
  1035                     self.Parent.UpdateRefreshRect(self.GetRedrawRect())
  1033                 for output in self.Outputs:
  1036                 for output in self.Outputs:
  1034                     output.SpreadCurrent(True)
  1037                     output.SpreadCurrent(True)
  1035             elif not self.Value and self.PreviousValue:
  1038             elif not self.Value and self.PreviousValue:
  1036                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
  1039                 if self.Visible:
       
  1040                     self.Parent.UpdateRefreshRect(self.GetRedrawRect())
  1037                 for output in self.Outputs:
  1041                 for output in self.Outputs:
  1038                     output.SpreadCurrent(False)
  1042                     output.SpreadCurrent(False)
  1039     
  1043     
  1040     # Make a clone of this SFC_Divergence
  1044     # Make a clone of this SFC_Divergence
  1041     def Clone(self, parent, id = None, pos = None):
  1045     def Clone(self, parent, id = None, pos = None):
  1466     
  1470     
  1467     def SpreadCurrent(self):
  1471     def SpreadCurrent(self):
  1468         if self.Parent.Debug:
  1472         if self.Parent.Debug:
  1469             self.PreviousValue = self.Value
  1473             self.PreviousValue = self.Value
  1470             self.Value = self.Input.ReceivingCurrent()
  1474             self.Value = self.Input.ReceivingCurrent()
  1471             if self.Value != self.PreviousValue:
  1475             if self.Value != self.PreviousValue and self.Visible:
  1472                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
  1476                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
  1473     
  1477     
  1474     # Make a clone of this SFC_Jump
  1478     # Make a clone of this SFC_Jump
  1475     def Clone(self, parent, id = None, pos = None):
  1479     def Clone(self, parent, id = None, pos = None):
  1476         jump = SFC_Jump(parent, self.Target, id)
  1480         jump = SFC_Jump(parent, self.Target, id)
  1711     
  1715     
  1712     def SpreadCurrent(self):
  1716     def SpreadCurrent(self):
  1713         if self.Parent.Debug:
  1717         if self.Parent.Debug:
  1714             self.PreviousValue = self.Value
  1718             self.PreviousValue = self.Value
  1715             self.Value = self.Input.ReceivingCurrent()
  1719             self.Value = self.Input.ReceivingCurrent()
  1716             if self.Value != self.PreviousValue:
  1720             if self.Value != self.PreviousValue and self.Visible:
  1717                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
  1721                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
  1718     
  1722     
  1719     # Make a clone of this SFC_ActionBlock
  1723     # Make a clone of this SFC_ActionBlock
  1720     def Clone(self, parent, id = None, pos = None):
  1724     def Clone(self, parent, id = None, pos = None):
  1721         actions = [action.copy() for action in self.Actions]
  1725         actions = [action.copy() for action in self.Actions]