vtk-ruby 5.0.4.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. data/lib/VTK/common.rb +7 -0
  2. data/lib/VTK/common.rb.rule +1 -0
  3. data/lib/VTK/filtering.rb +7 -0
  4. data/lib/VTK/filtering.rb.rule +1 -0
  5. data/lib/VTK/genericfiltering.rb +7 -0
  6. data/lib/VTK/genericfiltering.rb.rule +1 -0
  7. data/lib/VTK/graphics.rb +7 -0
  8. data/lib/VTK/graphics.rb.rule +1 -0
  9. data/lib/VTK/gtk.rb +5 -0
  10. data/lib/VTK/gtk.rb.rule +1 -0
  11. data/lib/VTK/gtk/GtkGLExtVTKRenderWindow.rb +635 -0
  12. data/lib/VTK/gtk/GtkGLExtVTKRenderWindow.rb.rule +1 -0
  13. data/lib/VTK/gtk/GtkGLExtVTKRenderWindowInteractor.rb +355 -0
  14. data/lib/VTK/gtk/GtkGLExtVTKRenderWindowInteractor.rb.rule +1 -0
  15. data/lib/VTK/gtk/GtkVTKRenderWindow.rb +615 -0
  16. data/lib/VTK/gtk/GtkVTKRenderWindow.rb.rule +1 -0
  17. data/lib/VTK/gtk/GtkVTKRenderWindowInteractor.rb +336 -0
  18. data/lib/VTK/gtk/GtkVTKRenderWindowInteractor.rb.rule +1 -0
  19. data/lib/VTK/hybrid.rb +7 -0
  20. data/lib/VTK/hybrid.rb.rule +1 -0
  21. data/lib/VTK/imaging.rb +7 -0
  22. data/lib/VTK/imaging.rb.rule +1 -0
  23. data/lib/VTK/io.rb +7 -0
  24. data/lib/VTK/io.rb.rule +1 -0
  25. data/lib/VTK/parallel.rb +7 -0
  26. data/lib/VTK/parallel.rb.rule +1 -0
  27. data/lib/VTK/rendering.rb +7 -0
  28. data/lib/VTK/rendering.rb.rule +1 -0
  29. data/lib/VTK/tk.rb +4 -0
  30. data/lib/VTK/tk.rb.rule +1 -0
  31. data/lib/VTK/tk/vtkLoadRubyTkWidgets.rb +54 -0
  32. data/lib/VTK/tk/vtkLoadRubyTkWidgets.rb.rule +1 -0
  33. data/lib/VTK/tk/vtkTkImageViewerWidget.rb +377 -0
  34. data/lib/VTK/tk/vtkTkImageViewerWidget.rb.rule +1 -0
  35. data/lib/VTK/tk/vtkTkPhotoImage.rb +28 -0
  36. data/lib/VTK/tk/vtkTkPhotoImage.rb.rule +1 -0
  37. data/lib/VTK/tk/vtkTkRenderWidget.rb +486 -0
  38. data/lib/VTK/tk/vtkTkRenderWidget.rb.rule +1 -0
  39. data/lib/VTK/tk/vtkTkRenderWindowInteractor.rb +394 -0
  40. data/lib/VTK/tk/vtkTkRenderWindowInteractor.rb.rule +1 -0
  41. data/lib/VTK/util.rb +6 -0
  42. data/lib/VTK/util.rb.rule +1 -0
  43. data/lib/VTK/util/colors.rb +223 -0
  44. data/lib/VTK/util/colors.rb.rule +1 -0
  45. data/lib/VTK/util/misc.rb +68 -0
  46. data/lib/VTK/util/misc.rb.rule +1 -0
  47. data/lib/VTK/util/vtkConstants.rb +123 -0
  48. data/lib/VTK/util/vtkConstants.rb.rule +1 -0
  49. data/lib/VTK/util/vtkImageExportToArray.rb +96 -0
  50. data/lib/VTK/util/vtkImageExportToArray.rb.rule +1 -0
  51. data/lib/VTK/util/vtkImageImportFromArray.rb +116 -0
  52. data/lib/VTK/util/vtkImageImportFromArray.rb.rule +1 -0
  53. data/lib/VTK/volumerendering.rb +7 -0
  54. data/lib/VTK/volumerendering.rb.rule +1 -0
  55. data/lib/VTK/vtkCommon.dll +0 -0
  56. data/lib/VTK/vtkCommon.exp +0 -0
  57. data/lib/VTK/vtkCommon.lib +0 -0
  58. data/lib/VTK/vtkCommonRuby.dll +0 -0
  59. data/lib/VTK/vtkCommonRuby.exp +0 -0
  60. data/lib/VTK/vtkCommonRuby.lib +0 -0
  61. data/lib/VTK/vtkCommonRubyD.dll +0 -0
  62. data/lib/VTK/vtkCommonRubyD.exp +0 -0
  63. data/lib/VTK/vtkCommonRubyD.lib +0 -0
  64. data/lib/VTK/vtkDICOMParser.dll +0 -0
  65. data/lib/VTK/vtkDICOMParser.exp +0 -0
  66. data/lib/VTK/vtkDICOMParser.lib +0 -0
  67. data/lib/VTK/vtkFiltering.dll +0 -0
  68. data/lib/VTK/vtkFiltering.exp +0 -0
  69. data/lib/VTK/vtkFiltering.lib +0 -0
  70. data/lib/VTK/vtkFilteringRuby.dll +0 -0
  71. data/lib/VTK/vtkFilteringRuby.exp +0 -0
  72. data/lib/VTK/vtkFilteringRuby.lib +0 -0
  73. data/lib/VTK/vtkFilteringRubyD.dll +0 -0
  74. data/lib/VTK/vtkFilteringRubyD.exp +0 -0
  75. data/lib/VTK/vtkFilteringRubyD.lib +0 -0
  76. data/lib/VTK/vtkGenericFiltering.dll +0 -0
  77. data/lib/VTK/vtkGenericFiltering.exp +0 -0
  78. data/lib/VTK/vtkGenericFiltering.lib +0 -0
  79. data/lib/VTK/vtkGenericFilteringRuby.dll +0 -0
  80. data/lib/VTK/vtkGenericFilteringRuby.exp +0 -0
  81. data/lib/VTK/vtkGenericFilteringRuby.lib +0 -0
  82. data/lib/VTK/vtkGenericFilteringRubyD.dll +0 -0
  83. data/lib/VTK/vtkGenericFilteringRubyD.exp +0 -0
  84. data/lib/VTK/vtkGenericFilteringRubyD.lib +0 -0
  85. data/lib/VTK/vtkGraphics.dll +0 -0
  86. data/lib/VTK/vtkGraphics.exp +0 -0
  87. data/lib/VTK/vtkGraphics.lib +0 -0
  88. data/lib/VTK/vtkGraphicsRuby.dll +0 -0
  89. data/lib/VTK/vtkGraphicsRuby.exp +0 -0
  90. data/lib/VTK/vtkGraphicsRuby.lib +0 -0
  91. data/lib/VTK/vtkGraphicsRubyD.dll +0 -0
  92. data/lib/VTK/vtkGraphicsRubyD.exp +0 -0
  93. data/lib/VTK/vtkGraphicsRubyD.lib +0 -0
  94. data/lib/VTK/vtkHybrid.dll +0 -0
  95. data/lib/VTK/vtkHybrid.exp +0 -0
  96. data/lib/VTK/vtkHybrid.lib +0 -0
  97. data/lib/VTK/vtkHybridRuby.dll +0 -0
  98. data/lib/VTK/vtkHybridRuby.exp +0 -0
  99. data/lib/VTK/vtkHybridRuby.lib +0 -0
  100. data/lib/VTK/vtkHybridRubyD.dll +0 -0
  101. data/lib/VTK/vtkHybridRubyD.exp +0 -0
  102. data/lib/VTK/vtkHybridRubyD.lib +0 -0
  103. data/lib/VTK/vtkIO.dll +0 -0
  104. data/lib/VTK/vtkIO.exp +0 -0
  105. data/lib/VTK/vtkIO.lib +0 -0
  106. data/lib/VTK/vtkIORuby.dll +0 -0
  107. data/lib/VTK/vtkIORuby.exp +0 -0
  108. data/lib/VTK/vtkIORuby.lib +0 -0
  109. data/lib/VTK/vtkIORubyD.dll +0 -0
  110. data/lib/VTK/vtkIORubyD.exp +0 -0
  111. data/lib/VTK/vtkIORubyD.lib +0 -0
  112. data/lib/VTK/vtkImaging.dll +0 -0
  113. data/lib/VTK/vtkImaging.exp +0 -0
  114. data/lib/VTK/vtkImaging.lib +0 -0
  115. data/lib/VTK/vtkImagingRuby.dll +0 -0
  116. data/lib/VTK/vtkImagingRuby.exp +0 -0
  117. data/lib/VTK/vtkImagingRuby.lib +0 -0
  118. data/lib/VTK/vtkImagingRubyD.dll +0 -0
  119. data/lib/VTK/vtkImagingRubyD.exp +0 -0
  120. data/lib/VTK/vtkImagingRubyD.lib +0 -0
  121. data/lib/VTK/vtkNetCDF.dll +0 -0
  122. data/lib/VTK/vtkNetCDF.exp +0 -0
  123. data/lib/VTK/vtkNetCDF.lib +0 -0
  124. data/lib/VTK/vtkParallel.dll +0 -0
  125. data/lib/VTK/vtkParallel.exp +0 -0
  126. data/lib/VTK/vtkParallel.lib +0 -0
  127. data/lib/VTK/vtkParallelRuby.dll +0 -0
  128. data/lib/VTK/vtkParallelRuby.exp +0 -0
  129. data/lib/VTK/vtkParallelRuby.lib +0 -0
  130. data/lib/VTK/vtkParallelRubyD.dll +0 -0
  131. data/lib/VTK/vtkParallelRubyD.exp +0 -0
  132. data/lib/VTK/vtkParallelRubyD.lib +0 -0
  133. data/lib/VTK/vtkParseOGLExt.exe +0 -0
  134. data/lib/VTK/vtkRendering.dll +0 -0
  135. data/lib/VTK/vtkRendering.exp +0 -0
  136. data/lib/VTK/vtkRendering.lib +0 -0
  137. data/lib/VTK/vtkRenderingRuby.dll +0 -0
  138. data/lib/VTK/vtkRenderingRuby.exp +0 -0
  139. data/lib/VTK/vtkRenderingRuby.lib +0 -0
  140. data/lib/VTK/vtkRenderingRubyD.dll +0 -0
  141. data/lib/VTK/vtkRenderingRubyD.exp +0 -0
  142. data/lib/VTK/vtkRenderingRubyD.lib +0 -0
  143. data/lib/VTK/vtkVREncodeString.exe +0 -0
  144. data/lib/VTK/vtkVolumeRendering.dll +0 -0
  145. data/lib/VTK/vtkVolumeRendering.exp +0 -0
  146. data/lib/VTK/vtkVolumeRendering.lib +0 -0
  147. data/lib/VTK/vtkVolumeRenderingRuby.dll +0 -0
  148. data/lib/VTK/vtkVolumeRenderingRuby.exp +0 -0
  149. data/lib/VTK/vtkVolumeRenderingRuby.lib +0 -0
  150. data/lib/VTK/vtkVolumeRenderingRubyD.dll +0 -0
  151. data/lib/VTK/vtkVolumeRenderingRubyD.exp +0 -0
  152. data/lib/VTK/vtkVolumeRenderingRubyD.lib +0 -0
  153. data/lib/VTK/vtkWidgets.dll +0 -0
  154. data/lib/VTK/vtkWidgets.exp +0 -0
  155. data/lib/VTK/vtkWidgets.lib +0 -0
  156. data/lib/VTK/vtkWidgetsRuby.dll +0 -0
  157. data/lib/VTK/vtkWidgetsRuby.exp +0 -0
  158. data/lib/VTK/vtkWidgetsRuby.lib +0 -0
  159. data/lib/VTK/vtkWidgetsRubyD.dll +0 -0
  160. data/lib/VTK/vtkWidgetsRubyD.exp +0 -0
  161. data/lib/VTK/vtkWidgetsRubyD.lib +0 -0
  162. data/lib/VTK/vtkWrapRuby.exe +0 -0
  163. data/lib/VTK/vtkWrapRubyInit.exe +0 -0
  164. data/lib/VTK/vtk_dummy.rb +3 -0
  165. data/lib/VTK/vtkexoIIc.dll +0 -0
  166. data/lib/VTK/vtkexoIIc.exp +0 -0
  167. data/lib/VTK/vtkexoIIc.lib +0 -0
  168. data/lib/VTK/vtkexpat.dll +0 -0
  169. data/lib/VTK/vtkexpat.exp +0 -0
  170. data/lib/VTK/vtkexpat.lib +0 -0
  171. data/lib/VTK/vtkfreetype.dll +0 -0
  172. data/lib/VTK/vtkfreetype.exp +0 -0
  173. data/lib/VTK/vtkfreetype.lib +0 -0
  174. data/lib/VTK/vtkftgl.dll +0 -0
  175. data/lib/VTK/vtkftgl.exp +0 -0
  176. data/lib/VTK/vtkftgl.lib +0 -0
  177. data/lib/VTK/vtkjpeg.dll +0 -0
  178. data/lib/VTK/vtkjpeg.exp +0 -0
  179. data/lib/VTK/vtkjpeg.lib +0 -0
  180. data/lib/VTK/vtkpng.dll +0 -0
  181. data/lib/VTK/vtkpng.exp +0 -0
  182. data/lib/VTK/vtkpng.lib +0 -0
  183. data/lib/VTK/vtkruby.exe +0 -0
  184. data/lib/VTK/vtksys.dll +0 -0
  185. data/lib/VTK/vtksys.exp +0 -0
  186. data/lib/VTK/vtksys.lib +0 -0
  187. data/lib/VTK/vtksysEncodeExecutable.exe +0 -0
  188. data/lib/VTK/vtksysProcessFwd9x.exe +0 -0
  189. data/lib/VTK/vtktiff.dll +0 -0
  190. data/lib/VTK/vtktiff.exp +0 -0
  191. data/lib/VTK/vtktiff.lib +0 -0
  192. data/lib/VTK/vtkzlib.dll +0 -0
  193. data/lib/VTK/vtkzlib.exp +0 -0
  194. data/lib/VTK/vtkzlib.lib +0 -0
  195. data/lib/VTK/widgets.rb +7 -0
  196. data/lib/VTK/widgets.rb.rule +1 -0
  197. data/lib/setup.rb +104 -0
  198. data/lib/vtk.rb +35 -0
  199. data/lib/vtk_dummy.rb +3 -0
  200. metadata +256 -0
@@ -0,0 +1 @@
1
+ # generated from CMake
@@ -0,0 +1,336 @@
1
+ """
2
+ Description:
3
+
4
+ Provides a pyGtk vtkRenderWindowInteractor widget. This embeds a
5
+ vtkRenderWindow inside a GTK widget && uses the
6
+ vtkGenericRenderWindowInteractor for the event handling. This is
7
+ vtkGenericRenderWindowInteractor end
8
+ based on vtkTkRenderWindow.py.
9
+
10
+ The class uses the gtkgl.GtkGLArea widget (gtkglarea). This avoids
11
+ The end
12
+ a lot of problems with flicker.
13
+
14
+ There is a working example at the bottom.
15
+
16
+ Created by Prabhu Ramachandran, April 2002.
17
+
18
+ Bugs:
19
+
20
+ (*) There is a focus related problem. Tkinter has a focus object
21
+ that handles focus events. I dont know of an equivalent object
22
+ under GTK. So, when an 'enter_notify_event' is received on the
23
+ GtkVTKRenderWindow I grab the focus but I dont know what to do when
24
+ I get a 'leave_notify_event'.
25
+
26
+ (*) Will !work under Win32 because it uses the XID of a window in
27
+ OnRealize. Suggestions to fix this will be appreciated.
28
+
29
+ """
30
+
31
+ require 'vtk'
32
+
33
+
34
+ class GtkVTKRenderWindowInteractor(gtkgl.GtkGLArea)
35
+
36
+ """ Embeds a vtkRenderWindow into a pyGTK widget && uses
37
+ vtkGenericRenderWindowInteractor for the event handling. This
38
+ vtkGenericRenderWindowInteractor end
39
+ class embeds the RenderWindow correctly. A __getattr__ hook is
40
+ end
41
+ provided that makes the class behave like a
42
+ provided that makes the end
43
+ vtkGenericRenderWindowInteractor."""
44
+
45
+ def __init__(self, *args)
46
+ l = list(args)
47
+ attr = (gtkgl.RGBA, gtkgl.DOUBLEBUFFER)
48
+ l.insert(0, self)
49
+ l.insert(1, attr)
50
+ apply(gtkgl.GtkGLArea.__init__, l)
51
+ self._RenderWindow = Vtk::RenderWindow.new
52
+
53
+ # private attributes
54
+ self.__Created = 0
55
+ self._ActiveButton = 0
56
+
57
+ self._Iren = Vtk::GenericRenderWindowInteractor.new
58
+ self._Iren.SetRenderWindow(self._RenderWindow)
59
+
60
+ self._Iren.AddObserver('CreateTimerEvent', self.CreateTimer)
61
+ self._Iren.AddObserver('DestroyTimerEvent', self.DestroyTimer)
62
+ self.ConnectSignals
63
+
64
+ # need this to be able to handle key_press events.
65
+ self.set_flags(gtk.CAN_FOCUS)
66
+ # default size
67
+ self.set_usize(300, 300)
68
+ end
69
+
70
+ def set_usize(self, w, h)
71
+ end
72
+ end
73
+ gtkgl.GtkGLArea.set_usize(self, w, h)
74
+ self._RenderWindow.SetSize(w, h)
75
+ self._Iren.SetSize(w, h)
76
+ self._Iren.ConfigureEvent
77
+
78
+ def ConnectSignals(self)
79
+ self.connect("realize", self.OnRealize)
80
+ self.connect("expose_event", self.OnExpose)
81
+ self.connect("configure_event", self.OnConfigure)
82
+ self.connect("button_press_event", self.OnButtonDown)
83
+ self.connect("button_release_event", self.OnButtonUp)
84
+ self.connect("motion_notify_event", self.OnMouseMove)
85
+ self.connect("enter_notify_event", self.OnEnter)
86
+ self.connect("leave_notify_event", self.OnLeave)
87
+ self.connect("key_press_event", self.OnKeyPress)
88
+ self.connect("delete_event", self.OnDestroy)
89
+ self.add_events(GDK.EXPOSURE_MASK| GDK.BUTTON_PRESS_MASK |
90
+ GDK.BUTTON_RELEASE_MASK |
91
+ GDK.KEY_PRESS_MASK |
92
+ GDK.POINTER_MOTION_MASK |
93
+ GDK.POINTER_MOTION_HINT_MASK |
94
+ GDK.ENTER_NOTIFY_MASK | GDK.LEAVE_NOTIFY_MASK)
95
+ end
96
+
97
+ def __getattr__(self, attr)
98
+ """Makes the object behave like a
99
+ vtkGenericRenderWindowInteractor"""
100
+ if attr == '__vtk__'
101
+ return lambda t=self._Iren: t
102
+ elsif hasattr(self._Iren, attr) return getattr(self._Iren, attr)
103
+ else raise AttributeError, self.__class__.__name__ + \
104
+ " has no attribute named " + attr
105
+ end
106
+ end
107
+
108
+ def CreateTimer(self, obj, event)
109
+ gtk.timeout_add(10, self._Iren.TimerEvent)
110
+ end
111
+
112
+ def DestroyTimer(self, obj, event)
113
+ """The timer is a one shot timer so will expire automatically."""
114
+ return 1
115
+ end
116
+
117
+ def GetRenderWindow(self)
118
+ return self._RenderWindow
119
+ end
120
+
121
+ def Render(self)
122
+ if self.__Created
123
+ self._RenderWindow.Render
124
+ end
125
+ end
126
+
127
+ def OnRealize(self, *args)
128
+ if self.__Created == 0
129
+ # you can't get the xid without the window being realized.
130
+ self.realize
131
+ win_id = str(self.get_window.xid)
132
+ self._RenderWindow.SetWindowInfo(win_id)
133
+ end
134
+ end
135
+ self._Iren.Initialize
136
+ self.__Created = 1
137
+ return gtk.TRUE
138
+
139
+ def OnConfigure(self, wid, event=nil)
140
+ sz = self._RenderWindow.GetSize
141
+ if (event.width != sz[0]) || (event.height != sz[1])
142
+ self._Iren.SetSize(event.width, event.height)
143
+ self._Iren.ConfigureEvent
144
+ end
145
+ return gtk.TRUE
146
+ end
147
+
148
+ def OnExpose(self, *args)
149
+ self.Render
150
+ return gtk.TRUE
151
+ end
152
+
153
+ def OnDestroy(self, event=nil)
154
+ self.hide
155
+ del self._RenderWindow
156
+ self.destroy
157
+ return gtk.TRUE
158
+ end
159
+
160
+ def _GetCtrlShift(self, event)
161
+ ctrl, shift = 0, 0
162
+ if ((event.state & GDK.CONTROL_MASK) == GDK.CONTROL_MASK)
163
+ ctrl = 1
164
+ end
165
+ if ((event.state & GDK.SHIFT_MASK) == GDK.SHIFT_MASK)
166
+ shift = 1
167
+ end
168
+ return ctrl, shift
169
+ end
170
+
171
+ def OnButtonDown(self, wid, event)
172
+ """Mouse button pressed."""
173
+ m = self.get_pointer
174
+ ctrl, shift = self._GetCtrlShift(event)
175
+ self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
176
+ chr(0), 0, nil)
177
+ button = event.button
178
+ if button == 3
179
+ self._Iren.RightButtonPressEvent
180
+ return gtk.TRUE
181
+ end
182
+ end
183
+ elif button == 1
184
+ self._Iren.LeftButtonPressEvent
185
+ return gtk.TRUE
186
+ elend
187
+ elif button == 2
188
+ self._Iren.MiddleButtonPressEvent
189
+ return gtk.TRUE
190
+ else:
191
+ return gtk.FALSE
192
+
193
+ def OnButtonUp(self, wid, event)
194
+ """Mouse button released."""
195
+ m = self.get_pointer
196
+ ctrl, shift = self._GetCtrlShift(event)
197
+ self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
198
+ chr(0), 0, nil)
199
+ button = event.button
200
+ if button == 3
201
+ self._Iren.RightButtonReleaseEvent
202
+ return gtk.TRUE
203
+ end
204
+ end
205
+ elend
206
+ elif button == 1
207
+ self._Iren.LeftButtonReleaseEvent
208
+ return gtk.TRUE
209
+ elend
210
+ elif button == 2
211
+ self._Iren.MiddleButtonReleaseEvent
212
+ return gtk.TRUE
213
+
214
+ return gtk.FALSE
215
+
216
+ def OnMouseMove(self, wid, event)
217
+ """Mouse has moved."""
218
+ m = self.get_pointer
219
+ ctrl, shift = self._GetCtrlShift(event)
220
+ self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
221
+ chr(0), 0, nil)
222
+ self._Iren.MouseMoveEvent
223
+ return gtk.TRUE
224
+ end
225
+
226
+ def OnEnter(self, wid, event)
227
+ """Entering the vtkRenderWindow."""
228
+ self.grab_focus
229
+ m = self.get_pointer
230
+ ctrl, shift = self._GetCtrlShift(event)
231
+ self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
232
+ chr(0), 0, nil)
233
+ self._Iren.EnterEvent
234
+ return gtk.TRUE
235
+ end
236
+
237
+ def OnLeave(self, wid, event)
238
+ """Leaving the vtkRenderWindow."""
239
+ m = self.get_pointer
240
+ ctrl, shift = self._GetCtrlShift(event)
241
+ self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
242
+ chr(0), 0, nil)
243
+ self._Iren.LeaveEvent
244
+ return gtk.TRUE
245
+ end
246
+
247
+ def OnKeyPress(self, wid, event)
248
+ """Key pressed."""
249
+ m = self.get_pointer
250
+ ctrl, shift = self._GetCtrlShift(event)
251
+ end
252
+ elend
253
+ keycode, keysym = event.keyval, event.string
254
+ key = chr(0)
255
+ if keycode < 256
256
+ key = chr(keycode)
257
+ end
258
+ self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
259
+ key, 0, keysym)
260
+ self._Iren.KeyPressEvent
261
+ self._Iren.CharEvent
262
+ return gtk.TRUE
263
+
264
+ def OnKeyRelease(self, wid, event)
265
+ "Key released."
266
+ m = self.get_pointer
267
+ ctrl, shift = self._GetCtrlShift(event)
268
+ end
269
+ keycode, keysym = event.keyval, event.string
270
+ key = chr(0)
271
+ if keycode < 256
272
+ key = chr(keycode)
273
+ end
274
+ self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
275
+ key, 0, keysym)
276
+ self._Iren.KeyReleaseEvent
277
+ return gtk.TRUE
278
+
279
+ def Initialize(self)
280
+ end
281
+ if self.__Created
282
+ end
283
+ self._Iren.Initialize
284
+
285
+
286
+ def main
287
+ # The main window
288
+ window = gtk.GtkWindow(gtk.WINDOW_TOPLEVEL)
289
+ window.set_title("A GtkVTKRenderWindow Demo!")
290
+ window.connect("destroy", gtk.mainquit)
291
+ window.connect("delete_event", gtk.mainquit)
292
+ window.set_border_width(10)
293
+
294
+ # A VBox into which widgets are packed.
295
+ vbox = gtk.GtkVBox(spacing=3)
296
+ window.add(vbox)
297
+ vbox.show
298
+
299
+ # The GtkVTKRenderWindow
300
+ gvtk = GtkVTKRenderWindowInteractor
301
+ #gvtk.SetDesiredUpdateRate(1000)
302
+ gvtk.set_usize(400, 400)
303
+ vbox.pack_start(gvtk)
304
+ gvtk.show
305
+ gvtk.Initialize
306
+ gvtk.Start
307
+ # prevents 'q' from exiting the app.
308
+ gvtk.AddObserver("ExitEvent", lambda o,e,x=nil: x)
309
+
310
+ # The VTK stuff.
311
+ cone = Vtk::ConeSource.new
312
+ cone.SetResolution(80)
313
+ coneMapper = Vtk::PolyDataMapper.new
314
+ coneMapper.SetInput(cone.GetOutput)
315
+ #coneActor = Vtk::LODActor.new
316
+ coneActor = Vtk::Actor.new
317
+ coneActor.SetMapper(coneMapper)
318
+ coneActor.GetProperty.SetColor(0.5, 0.5, 1.0)
319
+ ren = Vtk::Renderer.new
320
+ gvtk.GetRenderWindow.AddRenderer(ren)
321
+ ren.AddActor(coneActor)
322
+
323
+ # A simple quit button
324
+ quit = gtk.GtkButton("Quit!")
325
+ quit.connect("clicked", gtk.mainquit)
326
+ vbox.pack_start(quit)
327
+ quit.show
328
+
329
+ # show the main window && start event processing.
330
+ window.show
331
+ gtk.mainloop
332
+ end
333
+
334
+
335
+ if __name__ == "__main__"
336
+ main
@@ -0,0 +1 @@
1
+ # generated from CMake
@@ -0,0 +1,7 @@
1
+ require 'rbconfig'
2
+
3
+ if Config::CONFIG['host_os'] =~ /win32/
4
+ require 'vtk/vtkHybridRuby'
5
+ else
6
+ require 'vtk/libvtkHybridRuby'
7
+ end
@@ -0,0 +1 @@
1
+ # generated from CMake
@@ -0,0 +1,7 @@
1
+ require 'rbconfig'
2
+
3
+ if Config::CONFIG['host_os'] =~ /win32/
4
+ require 'vtk/vtkImagingRuby'
5
+ else
6
+ require 'vtk/libvtkImagingRuby'
7
+ end
@@ -0,0 +1 @@
1
+ # generated from CMake
@@ -0,0 +1,7 @@
1
+ require 'rbconfig'
2
+
3
+ if Config::CONFIG['host_os'] =~ /win32/
4
+ require 'vtk/vtkIORuby'
5
+ else
6
+ require 'vtk/libvtkIORuby'
7
+ end
@@ -0,0 +1 @@
1
+ # generated from CMake
@@ -0,0 +1,7 @@
1
+ require 'rbconfig'
2
+
3
+ if Config::CONFIG['host_os'] =~ /win32/
4
+ require 'vtk/vtkParallelRuby'
5
+ else
6
+ require 'vtk/libvtkParallelRuby'
7
+ end
@@ -0,0 +1 @@
1
+ # generated from CMake
@@ -0,0 +1,7 @@
1
+ require 'rbconfig'
2
+
3
+ if Config::CONFIG['host_os'] =~ /win32/
4
+ require 'vtk/vtkRenderingRuby'
5
+ else
6
+ require 'vtk/libvtkRenderingRuby'
7
+ end
@@ -0,0 +1 @@
1
+ # generated from CMake
@@ -0,0 +1,4 @@
1
+ require 'vtk/tk/vtkTkRenderWidget'
2
+ require 'vtk/tk/vtkTkImageViewerWidget'
3
+ require 'vtk/tk/vtkTkRenderWindowInteractor'
4
+ require 'vtk/tk/vtkTkPhotoImage'
@@ -0,0 +1 @@
1
+ # generated from CMake
@@ -0,0 +1,54 @@
1
+ require 'rbconfig'
2
+ require 'tk'
3
+
4
+ def Vtk.LoadRubyTkWidgets
5
+ =begin
6
+ vtkLoadRubyTkWidgets(interp) -- load vtk-tk widget extensions
7
+
8
+ This is a mess of mixed python and tcl code that searches for the
9
+ shared object file that contains the python-vtk-tk widgets. Both
10
+ the ruby path and the tcl path are searched.
11
+ =end
12
+ name = 'vtkRenderingRubyTkWidgets'
13
+ pkgname = name.downcase.capitalize
14
+
15
+ # find out if the file is already loaded
16
+ loaded = Tk.tk_call('info', 'loaded')
17
+ if loaded.include?(pkgname)
18
+ return false
19
+ end
20
+
21
+ # create the platform-dependent file name
22
+ prefix = ''
23
+ if Config::CONFIG['arch']=~/linux/
24
+ prefix = 'lib'
25
+ end
26
+ extension = Tk.tk_call('info', 'sharedlibextension')
27
+ filename = prefix+name+extension
28
+
29
+ # create an extensive list of paths to search
30
+ pathlist = $LOAD_PATH
31
+ # add tcl paths, ensure that {} is handled properly
32
+ auto_paths = Tk::AUTO_PATH.to_a
33
+ pathlist += auto_paths
34
+
35
+ # a common place for these sorts of things
36
+ if Config::CONFIG['arch']=~/linux/
37
+ pathlist += ['/usr/local/lib']
38
+ end
39
+
40
+ # attempt to load
41
+ for path in pathlist
42
+ fullpath = File.join(path, filename)
43
+ begin
44
+ Tk.load_tcllibrary(fullpath, pkgname)
45
+ return true
46
+ rescue
47
+ next
48
+ end
49
+ end
50
+
51
+ # re-generate the error
52
+ Tk.tk_call('load', filename)
53
+ return nil
54
+ end