Пример #1
0
def run_gui(core_config=None, gui_config=None, runtime_config=None, libraries=None, timeout=5, patch_threading=True):

    if gui_config is None:
        gui_config = {'HISTORY_ENABLED': False, 'AUTO_BACKUP_ENABLED': False}
    if 'HISTORY_ENABLED' not in list(gui_config.keys()):
        gui_config['HISTORY_ENABLED'] = False
    if 'AUTO_BACKUP_ENABLED' not in list(gui_config.keys()):
        gui_config['AUTO_BACKUP_ENABLED'] = False

    if patch_threading:
        patch_gtkmvc3_model_mt()
    global gui_ready, gui_thread, gui_executed_once

    print("WT thread: ", currentThread(), currentThread().ident)
    gui_ready = Event()
    gui_thread = Thread(target=run_gui_thread, args=[gui_config, runtime_config])
    gui_thread.start()

    used_gui_threads.add(gui_thread)
    print("used_gui_threads", used_gui_threads)
    # gui callback needed as all state machine from former tests are deleted in initialize_environment_core
    call_gui_callback(initialize_environment_core, core_config, libraries)
    if not gui_ready.wait(timeout):
        from rafcon.gui.start import stop_gtk
        stop_gtk()
        raise RuntimeError("Could not start GUI")

    # IMPORTANT signal handler and respective import of gui.start to avoid that singletons are created in this thread
    # -> TODO cleanup with app-class creation
    initialize_signal_handler()
    gui_executed_once = True
Пример #2
0
    def on_destroy(self, widget, data=None):
        from rafcon.gui.start import stop_gtk

        logger.debug("The GUI is being closed now")
        self.main_window_view.hide()

        stop_gtk()