graphics/SFC_Objects.py
changeset 634 cc3335911c01
parent 633 3536f4469cde
child 641 e9295622ce9b
equal deleted inserted replaced
633:3536f4469cde 634:cc3335911c01
    75     
    75     
    76     def SetForced(self, forced):
    76     def SetForced(self, forced):
    77         if self.Forced != forced:
    77         if self.Forced != forced:
    78             self.Forced = forced
    78             self.Forced = forced
    79             if self.Visible:
    79             if self.Visible:
    80                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
    80                 self.Parent.ElementNeedRefresh(self)
    81     
    81     
    82     def SetValue(self, value):
    82     def SetValue(self, value):
    83         self.PreviousValue = self.Value
    83         self.PreviousValue = self.Value
    84         self.Value = value
    84         self.Value = value
    85         if self.Value != self.PreviousValue:
    85         if self.Value != self.PreviousValue:
    86             if self.Visible:
    86             if self.Visible:
    87                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
    87                 self.Parent.ElementNeedRefresh(self)
    88             self.SpreadCurrent()
    88             self.SpreadCurrent()
    89     
    89     
    90     def SpreadCurrent(self):
    90     def SpreadCurrent(self):
    91         if self.Parent.Debug:
    91         if self.Parent.Debug:
    92             spreading = self.Value
    92             spreading = self.Value
   606     
   606     
   607     def SetForced(self, forced):
   607     def SetForced(self, forced):
   608         if self.Forced != forced:
   608         if self.Forced != forced:
   609             self.Forced = forced
   609             self.Forced = forced
   610             if self.Visible:
   610             if self.Visible:
   611                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
   611                 self.Parent.ElementNeedRefresh(self)
   612         
   612         
   613     def SetValue(self, value):
   613     def SetValue(self, value):
   614         self.PreviousValue = self.Value
   614         self.PreviousValue = self.Value
   615         self.Value = value
   615         self.Value = value
   616         if self.Value != self.PreviousValue:
   616         if self.Value != self.PreviousValue:
   617             if self.Visible:
   617             if self.Visible:
   618                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
   618                 self.Parent.ElementNeedRefresh(self)
   619             self.SpreadCurrent()
   619             self.SpreadCurrent()
   620     
   620     
   621     def SpreadCurrent(self):
   621     def SpreadCurrent(self):
   622         if self.Parent.Debug:
   622         if self.Parent.Debug:
   623             if self.Value is None:
   623             if self.Value is None:
  1075                 self.Value = self.Inputs[0].ReceivingCurrent()
  1075                 self.Value = self.Inputs[0].ReceivingCurrent()
  1076             else:
  1076             else:
  1077                 self.Value = False
  1077                 self.Value = False
  1078             if self.Value and not self.PreviousValue:
  1078             if self.Value and not self.PreviousValue:
  1079                 if self.Visible:
  1079                 if self.Visible:
  1080                     self.Parent.UpdateRefreshRect(self.GetRedrawRect())
  1080                     self.Parent.ElementNeedRefresh(self)
  1081                 for output in self.Outputs:
  1081                 for output in self.Outputs:
  1082                     output.SpreadCurrent(True)
  1082                     output.SpreadCurrent(True)
  1083             elif not self.Value and self.PreviousValue:
  1083             elif not self.Value and self.PreviousValue:
  1084                 if self.Visible:
  1084                 if self.Visible:
  1085                     self.Parent.UpdateRefreshRect(self.GetRedrawRect())
  1085                     self.Parent.ElementNeedRefresh(self)
  1086                 for output in self.Outputs:
  1086                 for output in self.Outputs:
  1087                     output.SpreadCurrent(False)
  1087                     output.SpreadCurrent(False)
  1088     
  1088     
  1089     # Make a clone of this SFC_Divergence
  1089     # Make a clone of this SFC_Divergence
  1090     def Clone(self, parent, id = None, pos = None):
  1090     def Clone(self, parent, id = None, pos = None):
  1515     def SpreadCurrent(self):
  1515     def SpreadCurrent(self):
  1516         if self.Parent.Debug:
  1516         if self.Parent.Debug:
  1517             self.PreviousValue = self.Value
  1517             self.PreviousValue = self.Value
  1518             self.Value = self.Input.ReceivingCurrent()
  1518             self.Value = self.Input.ReceivingCurrent()
  1519             if self.Value != self.PreviousValue and self.Visible:
  1519             if self.Value != self.PreviousValue and self.Visible:
  1520                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
  1520                 self.Parent.ElementNeedRefresh(self)
  1521     
  1521     
  1522     # Make a clone of this SFC_Jump
  1522     # Make a clone of this SFC_Jump
  1523     def Clone(self, parent, id = None, pos = None):
  1523     def Clone(self, parent, id = None, pos = None):
  1524         jump = SFC_Jump(parent, self.Target, id)
  1524         jump = SFC_Jump(parent, self.Target, id)
  1525         jump.SetSize(self.Size[0], self.Size[1])
  1525         jump.SetSize(self.Size[0], self.Size[1])
  1781     def SpreadCurrent(self):
  1781     def SpreadCurrent(self):
  1782         if self.Parent.Debug:
  1782         if self.Parent.Debug:
  1783             self.PreviousValue = self.Value
  1783             self.PreviousValue = self.Value
  1784             self.Value = self.Input.ReceivingCurrent()
  1784             self.Value = self.Input.ReceivingCurrent()
  1785             if self.Value != self.PreviousValue and self.Visible:
  1785             if self.Value != self.PreviousValue and self.Visible:
  1786                 self.Parent.UpdateRefreshRect(self.GetRedrawRect())
  1786                 self.Parent.ElementNeedRefresh(self)
  1787     
  1787     
  1788     # Make a clone of this SFC_ActionBlock
  1788     # Make a clone of this SFC_ActionBlock
  1789     def Clone(self, parent, id = None, pos = None):
  1789     def Clone(self, parent, id = None, pos = None):
  1790         actions = [action.copy() for action in self.Actions]
  1790         actions = [action.copy() for action in self.Actions]
  1791         action_block = SFC_ActionBlock(parent, actions, id)
  1791         action_block = SFC_ActionBlock(parent, actions, id)