Пример #1
0
def create_default_state(path, type='nleafstate'):
    """Create a state with default parameters"""
    state = pynebula.new(type, path)
    if type == 'nleafstate':
        action_path = fsm.get_behaction_of_state(path)
        action = fsmaction.create_default_action(action_path)
        if action != None:
            state.setbehaviouralaction(action)
        else:
            state = None
            pynebula.delete(path)
            cjr.show_error_message(
                "There isn't any action available.\n" \
                "Couldn't create a default leaf state."
                )
    elif type == 'nnodestate':
        selector_list = fsm.get_fsm_selectors()
        if len(selector_list) > 0:
            state.setfsmselectorbyname(str(selector_list[0]))
        else:
            state = None
            pynebula.delete(path)
            cjr.show_error_message(
                "There isn't any FSM selection script available.\n" \
                "Couldn't create a default node state."
                )
    return state
Пример #2
0
 def __update_choice_selector(self):
     # Fill choice control
     self.choice_selector.Clear()
     selector_list = fsm.get_fsm_selectors()
     selector_list.sort()
     self.choice_selector.AppendItems(selector_list)
     # Select current selector
     current_selector_name = self.__get_state().getfsmselector().getname()
     self.choice_selector.SetStringSelection(current_selector_name)
Пример #3
0
 def __update_choice_selector(self):
     # Fill choice control
     self.choice_selector.Clear()
     selector_list = fsm.get_fsm_selectors()
     selector_list.sort()
     self.choice_selector.AppendItems(selector_list)
     # Select current selector
     current_selector_name = self.__get_state().getfsmselector().getname()
     self.choice_selector.SetStringSelection(current_selector_name)
Пример #4
0
def create_default_state(path, type="nleafstate"):
    """Create a state with default parameters"""
    state = pynebula.new(type, path)
    if type == "nleafstate":
        action_path = fsm.get_behaction_of_state(path)
        action = fsmaction.create_default_action(action_path)
        if action != None:
            state.setbehaviouralaction(action)
        else:
            state = None
            pynebula.delete(path)
            cjr.show_error_message("There isn't any action available.\n" "Couldn't create a default leaf state.")
    elif type == "nnodestate":
        selector_list = fsm.get_fsm_selectors()
        if len(selector_list) > 0:
            state.setfsmselectorbyname(str(selector_list[0]))
        else:
            state = None
            pynebula.delete(path)
            cjr.show_error_message(
                "There isn't any FSM selection script available.\n" "Couldn't create a default node state."
            )
    return state