예제 #1
0
def main():
    # Create the MayaVi engine and start it.
    e = Engine()
    # Starting the engine registers the engine with the registry and
    # notifies others that the engine is ready.
    e.start()

    # Do this if you need to see the MayaVi tree view UI.
    ev = EngineView(engine=e)
    ui = ev.edit_traits()

    # Create a new scene.
    scene = e.new_scene()
    # Now create a new scene just for kicks.
    scene1 = e.new_scene()

    # Now setup a normal MayaVi pipeline.
    src = VTKXMLFileReader()
    src.initialize(join(get_data_dir(abspath(__file__)),
                        'fire_ug.vtu'))
    e.add_source(src)
    e.add_module(Outline())
    e.add_module(ScalarCutPlane())
    e.add_module(Streamline())
    return e, ui
예제 #2
0
 def show_engine(self, engine=None, rich_view=True):
     """ Show a dialog with the mayavi pipeline. This dialog allows to
         edit graphicaly the properties of the different objects on
         the scenes.
     """
     if engine is None:
         engine = self.get_engine()
     if engine.__class__.__name__ == 'EnvisageEngine' or \
                                         options.backend == 'test':
         # FIXME: This should pop up the relevent envisage view
         pass
     elif rich_view:
         from enthought.mayavi.core.ui.engine_rich_view import \
                 EngineRichView
         figure = engine.current_scene
         view = EngineRichView(engine=engine)
         if figure is None:
             scene = None
         else:
             scene = figure.scene
         return view.scene_editing_view(scene=scene)
     else:
         from enthought.mayavi.core.ui.engine_view import \
                 EngineView
         scene = engine.current_scene
         view = EngineView(engine=engine)
         return view.edit_traits()
예제 #3
0
def show_mesh(file_name, ndim):
    mayavi_engine = Engine()
    mayavi_engine.start()
    mayavi_engine.new_scene()

    # View the MayaVi pipeline
    engine_view = EngineView(engine=mayavi_engine)
    ui = engine_view.edit_traits()

    # Setup MayaVi pipeline
    src = TriangleReader()
    
    if (ndim == 2):
        src.initialize(file_name+'.edge') # Load the 2D .edge file
    else:
        src.initialize(file_name+'.face') # Load the 3D .face file

    mayavi_engine.add_source(src)
    # Add any filters, modules here in the order that they are to appear in the pipeline
    mayavi_engine.add_module(Surface())
예제 #4
0
    def __init__(self, **traits):
        HasTraits.__init__(self, **traits)
        self.engine_view = EngineView(engine=self.scene.engine)

        # Hook up the current_selection to change when the one in the engine
        # changes.  This is probably unnecessary in Traits3 since you can show
        # the UI of a sub-object in T3.
        self.scene.engine.on_trait_change(self._selection_change,
                                          'current_selection')

        self.generate_data_mayavi()
예제 #5
0
def main():
    # Create the MayaVi engine and start it.
    e = Engine()
    # Starting the engine registers the engine with the registry and
    # notifies others that the engine is ready.
    e.start()

    # Do this if you need to see the MayaVi tree view UI.
    ev = EngineView(engine=e)
    ui = ev.edit_traits()

    # Create a new scene.
    scene = e.new_scene()
    # Now create a new scene just for kicks.
    scene1 = e.new_scene()

    # Now setup a normal MayaVi pipeline.
    src = VTKXMLFileReader()
    src.initialize(join(get_data_dir(abspath(__file__)), 'fire_ug.vtu'))
    e.add_source(src)
    e.add_module(Outline())
    e.add_module(ScalarCutPlane())
    e.add_module(Streamline())
    return e, ui
예제 #6
0
    def _engine_view_factory(self, window, **traits):
        """ Factory method for engine views. """
        from enthought.pyface.workbench.traits_ui_view import \
                TraitsUIView
        from enthought.mayavi.core.ui.engine_view import \
                            EngineView

        engine_view = EngineView(engine=self._get_engine(window))
        tui_engine_view = TraitsUIView(obj=engine_view,
                                       id=ENGINE_VIEW,
                                       name='Mayavi',
                                       window=window,
                                       position='left',
                                       **traits)
        return tui_engine_view