コード例 #1
0
 def __on_new_state(self, event):
     """Create a new state with default values"""
     state_path = fsm.get_free_name( self.fsm_path, 'state' )
     state = fsmstatetype.create_default_state( state_path )
     if state != None:
         self.__get_fsm().addstate( state )
         self.list_states.Append( get_state_gui_name(state_path) )
         fsmevents.signal_fsm_change(self, fsmevents.ID_NewState)
コード例 #2
0
 def __on_new_transition(self, event):
     """Create a new transition with default values"""
     # Get the first free condition by default
     cond_paths = fsmtransitiontype.get_free_event_conditions( self.state_path )
     if len(cond_paths) == 0:
         cond_paths = fsmtransitiontype.get_free_script_conditions( self.state_path )
         if len(cond_paths) == 0:
             cjr.show_information_message(
                 "This state already has transitions for all " \
                 "the available conditions."
                 )
             return
     condition = pynebula.lookup( cond_paths[0] )
     # Create the transition with a free name
     transition_path = fsm.get_free_name( self.__get_transitions_path(),
         'transition' )
     transition = pynebula.new( "ntransition", transition_path )
     transition.setcondition( condition )
     self.__get_state().addtransition( transition )
     self.list_transitions.Append( get_transition_gui_name( transition.getfullname() ) )
     self.__update_new_button()
     fsmevents.signal_fsm_change(self, fsmevents.ID_NewTransition)