예제 #1
0
파일: script.py 프로젝트: ylshimp/RAFCON
def execute(self, inputs, outputs, gvm):
    self.logger.debug("Delete state")
    state_id = inputs["generated_state_id"]
    # the target state is the hierarchy state, which holds this library state as child state
    target_state = self.parent.parent
    target_state.remove_state(state_id)
    while state_id in target_state.states.keys():
        time.sleep(0.1)
    call_gui_callback(wait_for_gui)
    return 0
예제 #2
0
def trigger_gui_signals(*args):
    sm_manager_model = args[0]
    main_window_controller = args[1]
    setup_config = args[2]
    state_machine = args[3]
    menubar_ctrl = main_window_controller.get_controller('menu_bar_controller')
    try:
        sm_manager_model.selected_state_machine_id = state_machine.state_machine_id
        call_gui_callback(gui_helper_state_machine.save_state_machine_as,
                          path=setup_config['target_path'][0])
    except:
        logger.exception("Could not save state machine")
    finally:
        call_gui_callback(menubar_ctrl.on_quit_activate, None)
예제 #3
0
def execute(self, inputs, outputs, gvm):
    self.logger.debug("Insert state")
    #libary_path = "unit_test_state_machines/bake_libraries"
    #libary_name = "bake_library1"
    libary_path = inputs["library_path"]
    libary_name = inputs["library_name"]
    s = LibraryState(libary_path,
                     libary_name,
                     name=libary_name,
                     state_id="test_state")
    call_gui_callback(self.parent.add_state, s)
    wait_for_gui()
    call_gui_callback(self.parent.add_transition, self.state_id, 0, s.state_id,
                      None)
    wait_for_gui()
    call_gui_callback(self.parent.add_transition, s.state_id, 0, "CXVBON",
                      None)
    wait_for_gui()
    parent_id = None
    for d_id, d in self.parent.input_data_ports.items():
        if d.name == "str_variable":
            parent_id = d_id
    call_gui_callback(self.parent.add_data_flow, self.parent.state_id,
                      parent_id, s.state_id, 0)
    wait_for_gui()
    outputs["generated_state_id"] = s.state_id
    time.sleep(1.0)
    return 0
예제 #4
0
파일: conftest.py 프로젝트: ylshimp/RAFCON
 def __call__(self, *args, **kwargs):
     from rafcon.gui.utils import wait_for_gui
     if self.with_gui:
         from rafcon.utils.gui_functions import call_gui_callback
         return_values = call_gui_callback(*args, **kwargs)
         call_gui_callback(wait_for_gui)
         return return_values
     else:
         func = args[0]
         result = func(*args[1:], **kwargs)
         # Now we manually need to run the GTK main loop to handle all asynchronous notifications
         # E.g., when a state machine is added to the manager (in the core), the models are in certain cases created
         # asynchronously, depending in which thread the manager model was created.
         wait_for_gui()
         return result
예제 #5
0
파일: start.py 프로젝트: homeskies/RAFCON
def start_stop_state_machine(state_machine, start_state_path, quit_flag):
    from rafcon.utils.gui_functions import call_gui_callback

    state_machine_execution_engine = core_singletons.state_machine_execution_engine
    call_gui_callback(
        state_machine_execution_engine.execute_state_machine_from_path,
        state_machine=state_machine,
        start_state_path=start_state_path,
        wait_for_execution_finished=True)

    if reactor_required():
        from twisted.internet import reactor
        reactor.callFromThread(reactor.stop)

    if quit_flag:
        gui_singletons.main_window_controller.get_controller(
            'menu_bar_controller').on_quit_activate(None, None)
예제 #6
0
파일: script.py 프로젝트: ylshimp/RAFCON
def execute(self, inputs, outputs, gvm):
    self.logger.debug("Delete state")
    state_id = inputs["generated_state_id"]
    # the target state is the hierarchy state, which holds this library state as child state
    target_state = self.parent.parent

    call_gui_callback(target_state.remove_state, state_id)
    # do not call this with idle_add, otherwise the oberserver will be triggered asynchronously
    # i.e. the before notification will be handled after the whole operation already happend
    #GLib.idle_add(target_state.remove_state, state_id)

    while state_id in target_state.states.keys():
        time.sleep(0.1)

    wait_for_gui()

    #call_gui_callback(wait_for_gui)

    #time.sleep(2.0)
    return 0
예제 #7
0
def execute(self, inputs, outputs, gvm):
    self.logger.debug("Insert library state")
    #libary_path = "unit_test_state_machines/bake_libraries"
    #libary_name = "bake_library1"
    libary_path = "unit_test_state_machines/dynamic_library_insertion_libraries"
    libary_name = "test_library"
    e = call_gui_callback(LibraryState,
                          libary_path,
                          libary_name,
                          name="test_library_state")
    call_gui_callback(self.parent.add_state, e)
    call_gui_callback(self.parent.add_transition, self.state_id, 0, e.state_id,
                      None)
    call_gui_callback(self.parent.add_transition, e.state_id, 0,
                      self.parent.state_id, 0)
    wait_for_gui()
    parent_id = None
    for d_id, d in self.parent.output_data_ports.items():
        if d.name == "output_0":
            parent_id = d_id
    call_gui_callback(self.parent.add_data_flow, e.state_id, 2,
                      self.parent.state_id, parent_id)
    wait_for_gui()
    return 0