Exemple #1
0
def main_window(foqus_session, qtbot, main_window_params):
    from foqus_lib import foqus
    foqus.guiImport(mpl_backend='AGG')

    from foqus_lib.gui.main.mainWindow import mainWindow

    main_win = mainWindow(
        main_window_params['title'],
        main_window_params['width'],
        main_window_params['height'],
        foqus_session,  # FOQUS session data
        splash=None,
        showUQ=False,
        showOpt=False,
        showOuu=True,
        showBasicData=False,
        showSDOE=False,
        ts=False)
    main_win.closeEvent = lambda *args, **kwargs: None
    print(f'main_win={main_win}')
    main_win.app = QtWidgets.QApplication.instance()
    print(f'main_win.app={main_win.app}')
    # qtbot.addWidget(main_win)
    qtbot.waitForWindowShown(main_win)
    print(f'main_win.app.activeWindow()={main_win.app.activeWindow()}')
    yield main_win
    main_win.close()
Exemple #2
0
def startGUI(
    showSplash=False,
    app=None,
    showUQ=True,
    showOpt=True,
    showBasicData=True,
    showSDOE=True,
    ts=None,
):
    """
    This function starts the main window of the FOQUS GUI.

    Args:
        showSplash: if false don't show splash screen
        app: if already created pyside app to show message use it
        showUQ: Show the UQ tab
        showOpt: Show the optimzation tab
        showBasicDataTab: Show the Basic Data tab
        ts: A testing script to automatiacally run when GUI starts.
    """
    import foqus_lib.gui.main.mainWindow as MW

    if app == None:
        app = PyQt5.QtWidgets.QApplication(sys.argv)
    # create main window and start application loop
    makeSplash()
    if showSplash:
        # add timer to show splash
        splashScr[0] = PyQt5.QtCore.QTimer()
        splashScr[0].timeout.connect(hideSplash)
        # splash_timeout_ms is how long to show splash in ms
        # it is set in the first code line of this file
        splashScr[0].start(splash_timeout_ms)
        splashScr[1].setWindowFlags(splashScr[1].windowFlags()
                                    | PyQt5.QtCore.Qt.WindowStaysOnTopHint)
        splashScr[1].show()

    mainWin = MW.mainWindow(
        "FOQUS",  # window title
        800,  # width
        600,  # height
        dat,  # FOQUS session data
        splashScr[1],  # splash screen to use for about
        showUQ=showUQ,
        showOpt=showOpt,
        showBasicData=showBasicData,
        showSDOE=showSDOE,
        ts=ts,
    )
    mainWin.app = app
    app.exec_()
    return mainWin