1 |
ksteube |
1147 |
intend=3*" " |
2 |
|
|
src= { "Camera" : { "Position" : "None", |
3 |
|
|
"ViewAngle" : "30."}, |
4 |
|
|
"Arrow" : { "LengthScale" : "1." } |
5 |
|
|
|
6 |
|
|
} |
7 |
|
|
|
8 |
|
|
for i in src: |
9 |
|
|
print "class %s(Renderable):"%i |
10 |
|
|
print intend + "\"\"\"" |
11 |
|
|
print intend + "%s object "%i.lower() |
12 |
|
|
print intend + "\"\"\"" |
13 |
|
|
print intend + "def __init__(self,scene,**args):" |
14 |
|
|
print 2*intend + "\"\"\"" |
15 |
|
|
print 2*intend + "creates an instance of "+i |
16 |
|
|
print 2*intend |
17 |
|
|
print 2*intend + "@param scene: where %s belongs to."%i.lower() |
18 |
|
|
print 2*intend + "@type scene: L{Scene}" |
19 |
|
|
print 2*intend + "\"\"\"" |
20 |
|
|
print 2*intend + "super(%s, self).__init__()"%i |
21 |
|
|
for j in src[i]: |
22 |
|
|
print 2*intend +"self.feature[\"%s\"]=Property(%s)"%(j,src[i][j]) |
23 |
|
|
print 2*intend +"scene._addComponent(self) # use this call to overwrite _render" |
24 |
|
|
print 2*intend + "" |
25 |
|
|
print intend + "def _render(self):" |
26 |
|
|
print intend + "\"\"\"" |
27 |
|
|
print intend + "generic renderer for this component. It will be overwritten by the actual renderer used for a scene" |
28 |
|
|
print intend + "\"\"\"" |
29 |
|
|
for j in src[i]: |
30 |
|
|
print 2*intend +"if self.feature[\"%s\"].isAltered():"%j |
31 |
|
|
print 3*intend +" # do some action with self.feature[\"%s\"].getValue()"%j |
32 |
|
|
print 3*intend +" pass" |
33 |
|
|
for j in src[i]: |
34 |
|
|
print intend + "def set%s(self,val):"%j |
35 |
|
|
print 2*intend + "\"\"\"" |
36 |
|
|
print 2*intend + "set new %s %s"%(i,j) |
37 |
|
|
print 2*intend |
38 |
|
|
print 2*intend + "@param val: where %s belongs to."%i.lower() |
39 |
|
|
print 2*intend + "@type scene: L{?}" |
40 |
|
|
print 2*intend + "\"\"\"" |
41 |
|
|
print 2*intend + "self.feature[\"%s\"].setValue(val)"%j |
42 |
|
|
print 2*intend + "" |
43 |
|
|
print intend + "def get%s(self):"%j |
44 |
|
|
print 2*intend + "\"\"\"" |
45 |
|
|
print 2*intend + "returns current %s of %s"%(j,i) |
46 |
|
|
print 2*intend |
47 |
|
|
print 2*intend + "@return: the current %s"%j |
48 |
|
|
print 2*intend + "@rtype: L{?}" |
49 |
|
|
print 2*intend + "\"\"\"" |
50 |
|
|
print 2*intend + "return self.feature[\"%s\"].getValue(val)"%j |
51 |
|
|
print 2*intend + "" |
52 |
|
|
|
53 |
|
|
|
54 |
|
|
|