Esempio n. 1
0
def show(model):
    """Take an instance of tardis model and display it.

    If IPython functions were successfully imported then QApplication instance 
    is created using get_app_qt4. This will only create the app instance if 
    it doesn't already exists. Otherwise it is explicitly started. 

    Then the mainwindow is created, the model is attached to it and its 
    show method is called.

    Finally the eventloop is started using IPython functions (which start them
    consistently) if they were imported. Otherwise it is started explicitly. 

    """
    if importFailed:
        app = QtWidgets.QApplication([])
    else:
        app = get_app_qt5()

    tablemodel = SimpleTableModel
    win = Tardis(tablemodel)
    win.show_model(model)

    if importFailed:
        app.exec_()
    else:
        start_event_loop_qt5(app)

        #If the IPython console is being used, this will evaluate to true.
        #In that case the window created will be garbage collected unless a
        #reference to it is maintained after this function exits. So the win is
        #returned.
        if is_event_loop_running_qt5(app):
            return win
Esempio n. 2
0
 def stop():
     kernel_client.stop_channels()
     kernel_manager.shutdown_kernel()
     guisupport.get_app_qt5().exit()