예제 #1
0
    def setup_pipeline(self):
        """Override this method so that it *creates* the tvtk
        pipeline.

        This method is invoked when the object is initialized via
        `__init__`.  Note that at the time this method is called, the
        tvtk data pipeline will *not* yet be setup.  So upstream data
        will not be available.  The idea is that you simply create the
        basic objects and setup those parts of the pipeline not
        dependent on upstream sources and filters.  You should also
        set the `actors` attribute up at this point.
        """
        # Setup the glyphs.
        sources = [
            tvtk.SphereWidget(theta_resolution=8, phi_resolution=6),
            tvtk.LineWidget(clamp_to_bounds=False),
            tvtk.PlaneWidget(),
            tvtk.PointWidget(outline=False,
                             x_shadows=False,
                             y_shadows=False,
                             z_shadows=False),
        ]
        self.widget_list = sources
        # The 'widgets' trait is set in the '_widget_changed' handler.
        self.widget = sources[0]

        for s in sources:
            self._connect(s)
 def __widget_dict_default(self):
     """Default value for source dict."""
     w = {'Box':tvtk.BoxWidget(place_factor = 0.9),
          'Sphere':tvtk.SphereWidget(place_factor = 0.9),
          'Plane':tvtk.PlaneWidget(place_factor = 0.9),
          'ImplicitPlane':
             tvtk.ImplicitPlaneWidget(place_factor=0.9,
                                      draw_plane=False)}
     return w