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