Commit MetaInfo

Revisãob75ed0ad4d5f3faf64df21c42de9560e222685eb (tree)
Hora2013-03-01 15:19:31
Autorpylaf
Commiterpylaf

Mensagem de Log

using recipe

Mudança Sumário

Diff

diff -r 6041fc96c7b8 -r b75ed0ad4d5f src/experiment/vtk_tree_pylafiii.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/experiment/vtk_tree_pylafiii.py Fri Mar 01 15:19:31 2013 +0900
@@ -0,0 +1,87 @@
1+# coding: utf-8
2+
3+#TODO: ネットリスト、コラボマップ用レシピの再構築
4+#TODO: パラメータパネル
5+#TODO: データクラスとデータパネル
6+
7+import vtk
8+import pylafiii as laf
9+from pylafiii.vtkext import Actor,Renderer,RenderWidget,TupledCombiner5,PolyDataMapper,SphereSource
10+import inspect
11+
12+class Test(laf.Recipe):
13+ XML = '''<?xml version="1.0" ?>
14+<recipe>
15+<netlist>
16+ <logic name="renderer" cls="Renderer" module="pylafiii.vtkext.base"/>
17+ <logic name="actors" cls="TupledCombiner5" module="pylafiii.vtkext.base"/>
18+ <logic name="actor0" cls="Actor" module="pylafiii.vtkext.actor"/>
19+ <logic name="mapper0" cls="PolyDataMapper" module="pylafiii.vtkext.mapper"/>
20+ <logic name="spheresource" cls="SphereSource" module="pylafiii.vtkext.source"/>
21+ <logic name="actor1" cls="Actor" module="pylafiii.vtkext.actor"/>
22+ <logic name="actor2" cls="Actor" module="pylafiii.vtkext.actor"/>
23+ <link><port owner="actors" name="collection"/><port owner="renderer" name="actors"/></link>
24+ <link><port owner="actor0" name="vtkobj"/><port owner="actors" name="hook0"/></link>
25+ <link><port owner="mapper0" name="vtkobj"/><port owner="actor0" name="mapper"/></link>
26+ <link><port owner="spheresource" name="output"/><port owner="mapper0" name="input"/></link>
27+ <link><port owner="actor1" name="vtkobj"/><port owner="actors" name="hook1"/></link>
28+ <link><port owner="actor2" name="vtkobj"/><port owner="actors" name="hook2"/></link>
29+</netlist>
30+<collabomap>
31+ <item name="renderer" locx="525" locy="50"/>
32+ <item name="actors" locx="450" locy="100"/>
33+ <item name="actor0" locx="150" locy="200"/>
34+ <item name="mapper0" locx="150" locy="250"/>
35+ <item name="spheresource" locx="150" locy="300"/>
36+ <item name="actor1" locx="300" locy="225"/>
37+ <item name="actor2" locx="450" locy="200"/>
38+</collabomap>
39+</recipe>
40+'''
41+# laf.link(laf.port(rt.children['actor0'],'vtkobj'),laf.port(rt.children['actors'],'hook0'))
42+# laf.link(laf.port(rt.children['mapper0'],'vtkobj'),laf.port(rt.children['actor0'],'mapper'))
43+# laf.link(laf.port(rt.children['spheresource'],'output'),laf.port(rt.children['mapper0'],'input'))
44+# laf.link(laf.port(rt.children['actor1'],'vtkobj'),laf.port(rt.children['actors'],'hook1'))
45+# laf.link(laf.port(rt.children['actor2'],'vtkobj'),laf.port(rt.children['actors'],'hook2'))
46+
47+if __name__ == '__main__':
48+ import Tkinter
49+ tk = Tkinter.Tk()
50+ rt = laf.Root()
51+ #
52+ w = laf.chef.CollaboMap(tk,name='collabomap',width=640,height=400)
53+ w.pack(side=Tkinter.LEFT,anchor=Tkinter.NE,fill=Tkinter.BOTH,expand=True)
54+# w = laf.chef.SelectedPortsWidget(Tkinter.Toplevel(tk))
55+# w.pack()
56+ w = laf.chef.ClassChooser(Tkinter.Toplevel(tk,name='classchooser'),name='classchooser')
57+ w.pack(side=Tkinter.LEFT,anchor=Tkinter.NE,fill=Tkinter.BOTH,expand=True)
58+ laf.link(laf.port(tk.children['classchooser'].children['classchooser'],'chosenclass'),laf.port(tk.children['collabomap'],'chosenclass'))
59+ #
60+ w = RenderWidget(Tkinter.Toplevel(tk))
61+ w.pack(side=Tkinter.LEFT,anchor=Tkinter.NE,fill=Tkinter.BOTH,expand=True)
62+ #
63+ x = Test()
64+ laf.chef.cook_netlist(x,master=rt)
65+ tk.children['collabomap'].cook_collabomap(x)
66+# o = Renderer(name='renderer')
67+# o = TupledCombiner5(name='actors')
68+# o = Actor(name='actor0')
69+# o = PolyDataMapper(name='mapper0')
70+# o = SphereSource(name='spheresource')
71+# o = Actor(name='actor1')
72+# o = Actor(name='actor2')
73+ laf.link(laf.port(rt.children['renderer'],'vtkobj'),laf.port(w,'renderer'))
74+# laf.link(laf.port(rt.children['actors'],'collection'),laf.port(rt.children['renderer'],'actors'))
75+# laf.link(laf.port(rt.children['actor0'],'vtkobj'),laf.port(rt.children['actors'],'hook0'))
76+# laf.link(laf.port(rt.children['mapper0'],'vtkobj'),laf.port(rt.children['actor0'],'mapper'))
77+# laf.link(laf.port(rt.children['spheresource'],'output'),laf.port(rt.children['mapper0'],'input'))
78+# laf.link(laf.port(rt.children['actor1'],'vtkobj'),laf.port(rt.children['actors'],'hook1'))
79+# laf.link(laf.port(rt.children['actor2'],'vtkobj'),laf.port(rt.children['actors'],'hook2'))
80+ # print rt.children['renderer'].vtkobj.GetActors()
81+ #laf.port(rt.children['mapper0'],'vtkobj').unlink()
82+ laf.port(rt.children['actor1'],'vtkobj').unlink()
83+ # print rt.children['renderer'].vtkobj.GetActors()
84+ #w.connect(rt.children['rnd'])
85+# del o
86+ Tkinter.mainloop()
87+
\ No newline at end of file
Show on old repository browser