def run_standalone(self): from enthought.mayavi.core.engine import Engine from enthought.mayavi.plugins.script import Script from enthought.pyface.api import ApplicationWindow, GUI self.setup_logger() if self.offscreen: engine = Engine(scene_factory=off_screen_viewer) else: engine = Engine() engine.start() self.script = Script(engine=engine) self.gui = g = GUI() self.app_window = a = ApplicationWindow() a.open() a.show(False) g.invoke_later(self.run) g.start_event_loop()
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())
def new_engine(self): """ Creates a new engine, envisage or not depending on the options. """ check_backend() if options.backend == 'envisage': from enthought.mayavi.plugins.app import Mayavi m = Mayavi(start_gui_event_loop=False) m.main() process_ui_events() window = m.application.workbench.active_window engine = window.get_service(Engine) elif options.backend == 'test': engine = NullEngine(name='Null Mlab Engine') engine.start() else: if options.offscreen: engine = OffScreenEngine(name='Mlab offscreen Engine') engine.start() else: engine = Engine(name='Mlab Engine') engine.start() self.current_engine = engine return engine
def setUp(self): e = Engine() e.start() self._non_null_engine = e mlab.set_engine(e)
def __engine_default(self): e = Engine() e.start() e.new_scene(self._scene) return e