Exemple #1
0
def _create_data_source(metadata):
    """Creates a data source and adds it to the mayavi engine given
    metadata of the source.  Returns the created source.
    """
    factory = metadata.get_callable()
    src = factory()
    engine = tools.get_engine()
    engine.add_source(src)
    return src
Exemple #2
0
def open(filename, figure=None):
    """Open a supported data file given a filename.  Returns the source
    object if a suitable reader was found for the file.
    """
    if figure is None:
        engine = tools.get_engine()
    else:
        engine = engine_manager.find_figure_engine(figure)
        engine.current_scene = figure
    src = engine.open(filename)
    return src
Exemple #3
0
def open(filename, figure=None):
    """Open a supported data file given a filename.  Returns the source
    object if a suitable reader was found for the file.

    If 'figure' is False, no view is opened, and the code does not need
    GUI or openGL context.
    """
    if figure is None:
        engine = tools.get_engine()
    elif figure is False:
        # Get a null engine that we can use.
        engine = get_null_engine()
    else:
        engine = engine_manager.find_figure_engine(figure)
        engine.current_scene = figure
    src = engine.open(filename)
    return src