def __update_new_button(self):
     if self.state_path != None:
         # Enable the new button when there's some transition condition not
         # chosen yet for this state
         self.button_new.Enable(
             len( fsmtransitiontype.get_free_event_conditions(self.state_path) ) + \
             len( fsmtransitiontype.get_free_script_conditions(self.state_path) ) > 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)