Changeset 160
- Timestamp:
- 05/17/02 17:39:46 (6 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBJabber/RBJabber/SubjectObserver/StateMachine.py
r159 r160 35 35 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 36 36 37 from Subject import Subject37 from CategorySubject import CategorySubject 38 38 from operator import and_, or_ 39 39 … … 68 68 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 69 69 70 class State( Subject):70 class State(CategorySubject): 71 71 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 72 72 #~ Constants / Variables / Etc. … … 83 83 def __init__(self, InfluxsClass=AndStateList, **kw): 84 84 self.__dict__.update(kw) 85 Subject.__init__(self)85 CategorySubject.__init__(self) 86 86 self._Influxs = InfluxsClass() 87 self.StateSubject = Subject()88 87 89 88 def __int__(self): … … 94 93 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 95 94 95 def AddObserver(self, callable, category='', **kw): 96 category = category or 'precondition' 97 return apply(CategorySubject.AddObserver, (self, category, callable), kw) 98 96 99 def SetState(self, value =1): 97 100 if value != self.value: … … 99 102 if self.value and not self._Influxs: 100 103 self.UpdateObservers(precondition=self.value) 101 self. StateSubject.UpdateObservers(state=self)104 self.UpdateObservers(state=self) 102 105 if self._handled > 0: 103 106 self._handled = 0 … … 111 114 precondition = int(self._Influxs) 112 115 if precondition: 113 lock = self. StateSubject.Lock()116 lock = self.Lock() 114 117 self.UpdateObservers(precondition=precondition) 115 118 self._Influxs.SetHandled() … … 118 121 def AddInflux(self, Influx): 119 122 self._Influxs.append(Influx) 120 Influx. StateSubject.AddObserver(self.CheckInfluxs, priority=-1)123 Influx.AddObserver(self.CheckInfluxs, 'state', priority=-1) 121 124 122 125 def AddOutflux(self, Outflux):
