annotate op.py @ 1:d8a11a5981e2

start cvs
author drewp
date Wed, 03 Jul 2002 09:43:24 +0000
parents 45b12307c695
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
1 """each node type has an Op within it"""
45b12307c695 Initial revision
drewp
parents:
diff changeset
2
45b12307c695 Initial revision
drewp
parents:
diff changeset
3 class Op:
45b12307c695 Initial revision
drewp
parents:
diff changeset
4 """nodes can have several versions of their operation function.
45b12307c695 Initial revision
drewp
parents:
diff changeset
5
45b12307c695 Initial revision
drewp
parents:
diff changeset
6 ops don't return anything!
45b12307c695 Initial revision
drewp
parents:
diff changeset
7 """
45b12307c695 Initial revision
drewp
parents:
diff changeset
8 def __init__(self):
45b12307c695 Initial revision
drewp
parents:
diff changeset
9 """This should not be overridden without being called."""
45b12307c695 Initial revision
drewp
parents:
diff changeset
10 pass
45b12307c695 Initial revision
drewp
parents:
diff changeset
11
45b12307c695 Initial revision
drewp
parents:
diff changeset
12 def inputschanged(self, input, output, stateaccess):
45b12307c695 Initial revision
drewp
parents:
diff changeset
13 """If you only define one op function body, make it this one. """
45b12307c695 Initial revision
drewp
parents:
diff changeset
14 pass
45b12307c695 Initial revision
drewp
parents:
diff changeset
15
45b12307c695 Initial revision
drewp
parents:
diff changeset
16 def created(self, input, output, stateaccess):
45b12307c695 Initial revision
drewp
parents:
diff changeset
17 """This is called one time when the node is newly created. It's not called
45b12307c695 Initial revision
drewp
parents:
diff changeset
18 when the node instance is pickled/unpickled. Use this version to initialize
45b12307c695 Initial revision
drewp
parents:
diff changeset
19 state.
45b12307c695 Initial revision
drewp
parents:
diff changeset
20 """
45b12307c695 Initial revision
drewp
parents:
diff changeset
21 # an extra call to changed() should help the outputs get set
45b12307c695 Initial revision
drewp
parents:
diff changeset
22 # correctly before any real inputs-changed events come around
45b12307c695 Initial revision
drewp
parents:
diff changeset
23 # (assuming this method doesn't get overridden with a
45b12307c695 Initial revision
drewp
parents:
diff changeset
24 # specialized version)
45b12307c695 Initial revision
drewp
parents:
diff changeset
25 self.inputschanged(input, output, stateaccess)
45b12307c695 Initial revision
drewp
parents:
diff changeset
26
45b12307c695 Initial revision
drewp
parents:
diff changeset
27 def parameterschanged(self, input, output, stateaccess):
45b12307c695 Initial revision
drewp
parents:
diff changeset
28 self.inputschanged(input, output, stateaccess)
45b12307c695 Initial revision
drewp
parents:
diff changeset
29
45b12307c695 Initial revision
drewp
parents:
diff changeset
30 def clocked(self, input, output, stateaccess):
45b12307c695 Initial revision
drewp
parents:
diff changeset
31 self.inputschanged(input, output, stateaccess)