Example #1
0
def launchShell(workflow_cmdline_args, preinit_funcs, postinit_funcs):
    """
    Start the ilastik shell GUI with the given workflow type.
    Note: A QApplication must already exist, and you must call this function from its event loop.
    """
    for f in preinit_funcs:
        f()

    # This will import a lot of stuff (essentially the entire program).
    # We use a late import here so the splash screen is shown while this lengthy import happens.
    from ilastik.shell.gui.ilastikShell import IlastikShell
    
    # Create the shell and populate it
    global shell
    shell = IlastikShell(None, workflow_cmdline_args)

    assert QApplication.instance().thread() == shell.thread()

    if ilastik.config.cfg.getboolean("ilastik", "debug"):
        # In debug mode, we always start with the same size window.
        # This is critical for recorded test cases.
        shell.resize(1000, 750)
        # Also, ensure that the window title bar doesn't start off screen, 
        #  which can be an issue when using xvfb or vnc viewers
        shell.move(10,10)
    shell.show()
    
    # FIXME: The workflow_cmdline_args parameter is meant
    #        for arguments to the workflow, not the shell.
    #        This is a bit hacky.
    if workflow_cmdline_args and "--fullscreen" in workflow_cmdline_args:
        workflow_cmdline_args.remove('--fullscreen')
        shell.showMaximized()
    
    # Run post-init funcs
    for f in postinit_funcs:
        QTimer.singleShot(0, functools.partial(f, shell) )
    
    # On Mac, the main window needs to be explicitly raised
    shell.raise_()
    QApplication.instance().processEvents()
    
    return shell
Example #2
0
def launchShell(workflow_cmdline_args, preinit_funcs, postinit_funcs):
    """
    Start the ilastik shell GUI with the given workflow type.
    Note: A QApplication must already exist, and you must call this function from its event loop.
    """
    for f in preinit_funcs:
        f()

    # This will import a lot of stuff (essentially the entire program).
    # We use a late import here so the splash screen is shown while this lengthy import happens.
    from ilastik.shell.gui.ilastikShell import IlastikShell

    # Create the shell and populate it
    global shell
    shell = IlastikShell(None, workflow_cmdline_args)

    assert QApplication.instance().thread() == shell.thread()

    if ilastik.config.cfg.getboolean("ilastik", "debug"):
        # In debug mode, we always start with the same size window.
        # This is critical for recorded test cases.
        shell.resize(1000, 750)
        # Also, ensure that the window title bar doesn't start off screen,
        #  which can be an issue when using xvfb or vnc viewers
        shell.move(10, 10)
    shell.show()

    # FIXME: The workflow_cmdline_args parameter is meant
    #        for arguments to the workflow, not the shell.
    #        This is a bit hacky.
    if workflow_cmdline_args and "--fullscreen" in workflow_cmdline_args:
        workflow_cmdline_args.remove("--fullscreen")
        shell.showMaximized()

    # Run post-init funcs
    for f in postinit_funcs:
        QTimer.singleShot(0, functools.partial(f, shell))

    # On Mac, the main window needs to be explicitly raised
    shell.raise_()
    QApplication.instance().processEvents()

    return shell