Changeset 121
- Timestamp:
- 04/22/02 17:24:15 (6 years ago)
- Files:
-
- trunk/RBJabber/RBJabber/SubjectObserver/StateMachine.py (modified) (1 diff)
- trunk/RBSkinning/RBSkinning/StateSkinTest.py (modified) (1 diff)
- trunk/RBSkinning/RBSkinning/teststate.skin (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBJabber/RBJabber/SubjectObserver/StateMachine.py
r107 r121 57 57 def __rand__(self, other): return int(self) and other 58 58 def __and__(self, other): return int(self) and other 59 def __nonzero__(self): return int(self)59 #def __nonzero__(self): return int(self) 60 60 def __int__(self): return self.value 61 61 trunk/RBSkinning/RBSkinning/StateSkinTest.py
r120 r121 35 35 states = dict([(x.name, x) for x in skin.Elements('state')]) 36 36 37 def test(state, precondition):38 print state.name, state.desc39 state.SetState()40 print "Done"37 #def test(state, precondition): 38 # print state.name, state.desc 39 # state.SetState() 40 # print "Done" 41 41 42 for each in states.itervalues():43 each.AddObserver(test)42 #for each in states.itervalues(): 43 # each.AddObserver(test) 44 44 45 45 states['Test1'].SetState() trunk/RBSkinning/RBSkinning/teststate.skin
r120 r121 1 1 <?xml version='1.0'?> 2 2 <skin:skin xmlns:state='http://namespaces.runeblade.com/state' xmlns:skin='http://namespaces.runeblade.com/skin' xmlns:py='http://namespaces.runeblade.com/xmlPython'> 3 <py:inline> 4 from Foundation import ContextApply 5 self.AddNamespace(ContextApply) 6 </py:inline> 3 7 <!-- state stuff --> 4 <state:state name='Test1' desc='First State to test' /> 5 <state:state name='Test2' desc='Second State to test' /> 6 <state:state name='Test3' desc='Third State to test' /> 8 <state:state name='Test1' desc='First State to test' > 9 <py:inline> 10 parentObj.AddObserver(ContextApply_0(parentObj.SetState)) 11 </py:inline> 12 </state:state> 13 <state:state name='Test2' desc='Second State to test'> 14 <py:inline> 15 parentObj.AddObserver(ContextApply_0(parentObj.SetState)) 16 </py:inline> 17 </state:state> 18 <state:state name='Test3' desc='Third State to test'> 19 <py:inline> 20 #parentObj.AddObserver(ContextApply_0(parentObj.SetState)) 21 def test(state, precondition): 22 print " That TICKLES " 23 state.SetState() 24 parentObj.AddObserver(test) 25 </py:inline> 26 </state:state> 7 27 <state:arc start='Test1' end='Test2' /> 8 28 <state:arc start='Test2' end='Test3' />
