Example #1
0
def open_notebook(arg,
                  _user_info_db=_user_info_db,
                  scene_root=_scene_root,
                  history_db=_history_db,
                  library_db=_library_db,
                  model_db=_model_db,
                  azure_data_studio_location=_azure_data_studio_location,
                  current_scene_db=None,
                  test=False):
    """handles opening a notebook"""
    from src.praxxis.notebook import open_notebook
    from src.praxxis.util import roots
    from src.praxxis.sqlite import sqlite_user

    default_editor = sqlite_user.get_user_info(_user_info_db)[6][1]
    editor = input_editor = arg.viewer

    if input_editor == None:
        editor = default_editor

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    open_notebook.open_notebook(arg, current_scene_db, library_db,
                                azure_data_studio_location, editor, True)
Example #2
0
def test_open_notebook_bad_editor(setup, add_test_library, current_scene_db, library_db, ads_location):
    from src.praxxis.notebook import open_notebook
    from tests.src.praxxis.util import dummy_object
    from src.praxxis.util import error
    from src.praxxis.display import display_error

    notebook1 = dummy_object.make_dummy_notebook()
    editor = "not real"
    try:
        open_notebook.open_notebook(notebook1, current_scene_db, library_db, ads_location, editor, test=True) == 0
        assert 0
    except error.EditorNotFoundError as e:
        assert str(e) == display_error.editor_not_found_error(editor)
Example #3
0
def test_open_notebook_jupyter(setup, add_test_library, current_scene_db, library_db, ads_location):
    from src.praxxis.notebook import open_notebook
    from tests.src.praxxis.util import dummy_object

    notebook1 = dummy_object.make_dummy_notebook(viewer="jupyter")
    assert open_notebook.open_notebook(notebook1, current_scene_db, library_db, ads_location, test=True) == 0
    
Example #4
0
def open_notebook(arg,
                  scene_root=_scene_root,
                  history_db=_history_db,
                  library_db=_library_db,
                  azure_data_studio_location=_azure_data_studio_location,
                  current_scene_db=None,
                  test=False):
    """handles opening a notebook"""
    from src.praxxis.notebook import open_notebook
    from src.praxxis.util import roots

    # TODO: allow for selecting your own editor on first run
    editor = "vim"

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    open_notebook.open_notebook(arg, current_scene_db, library_db, azure_data_studio_location, editor, True)
Example #5
0
def test_open_notebook_ads(setup, add_test_library, current_scene_db, library_db, ads_location):
    from src.praxxis.notebook import open_notebook
    from tests.src.praxxis.util import dummy_object
    from src.praxxis.util import error
    from src.praxxis.display import display_error

    notebook1 = dummy_object.make_dummy_notebook(viewer="ads")
    try:
        assert open_notebook.open_notebook(notebook1, current_scene_db, library_db, ads_location, test=True) == 0
    except error.ADSNotFoundError as e:
        assert str(e) == display_error.ads_not_found_error(ads_location)