Ejemplo n.º 1
0
 def __on_change_state(self, event):
     state_path = fsm.find_path(
         fsm.get_fsm_of_transition(self.transition_path),
         self.choice_state.GetStringSelection(),
         fsmstates.get_state_gui_name)
     if self.__get_transition().gettargetstatebyindex(
             self.target_index).getfullname() != state_path:
         self.__get_transition().settargetstatebyindex(
             self.target_index, pynebula.lookup(state_path))
         fsmevents.signal_fsm_change(self, self.target_index)
Ejemplo n.º 2
0
 def __on_change_state(self, event):
     state_path = fsm.find_path(
         fsm.get_fsm_of_transition( self.transition_path ),
         self.choice_state.GetStringSelection(),
         fsmstates.get_state_gui_name
         )
     if self.__get_transition().gettargetstatebyindex( self.target_index ).getfullname() != state_path:
         self.__get_transition().settargetstatebyindex(
             self.target_index, pynebula.lookup( state_path ) )
         fsmevents.signal_fsm_change(self, self.target_index)
Ejemplo n.º 3
0
def get_free_targets(transition, allowed_target=None):
    """
    Return a paths list of those states which the given transition doesn't
    already have a target for.
    
    \param transition Transition (path) to gather the free targets for
    \param allowed_target Target state (path) allowed as a free target, even if it's already taken
    \return List of states paths not found as targets for the given transition
    """
    fsm_path = fsm.get_fsm_of_transition(transition)
    states_paths = fsm.get_states(fsm_path)
    trans_obj = pynebula.lookup(transition)
    for i in range(trans_obj.gettargetsnumber()):
        state_path = trans_obj.gettargetstatebyindex(i).getfullname()
        if allowed_target != state_path:
            states_paths.remove(state_path)
    return states_paths
Ejemplo n.º 4
0
def get_free_targets(transition, allowed_target=None):
    """
    Return a paths list of those states which the given transition doesn't
    already have a target for.
    
    \param transition Transition (path) to gather the free targets for
    \param allowed_target Target state (path) allowed as a free target, even if it's already taken
    \return List of states paths not found as targets for the given transition
    """
    fsm_path = fsm.get_fsm_of_transition( transition )
    states_paths = fsm.get_states( fsm_path )
    trans_obj = pynebula.lookup( transition )
    for i in range( trans_obj.gettargetsnumber() ):
        state_path = trans_obj.gettargetstatebyindex(i).getfullname()
        if allowed_target != state_path:
            states_paths.remove( state_path )
    return states_paths