Example #1
0
    def __init__(self, parent, event, entity):
        wx.PyControl.__init__(self, parent, style=wx.NO_BORDER|wx.TAB_TRAVERSAL)
        self.entity = entity
        self.event = str(event)
        event_id = servers.get_trigger_server().geteventtransientid( event )
        event_label = servers.get_trigger_server().geteventlabel( event_id )
        event_label = "On " + event_label.lower()
        self.staticbox_operations = wx.StaticBox(self, -1, event_label)
        self.list_operations = wx.ListBox(self, -1)
        self.button_add_cmd = wx.Button(self, -1, "Add cmd")
        self.button_add_script = wx.Button(self, -1, "Add script")
        self.button_remove = wx.Button(self, -1, "Remove")
        self.button_edit = wx.Button(self, -1, "Edit")
        self.label_execute = wx.StaticText(self, -1, "Execute")
        self.choice_execute = wx.Choice(
                                        self, 
                                        -1, 
                                        choices=['All', 'One', 'Some']
                                        )
        self.label_min_delay = wx.StaticText(self, -1, "Minimum delay")
        self.float_min_delay = floatctrl.FloatCtrl(
                                        self, 
                                        size=wx.Size(50,-1), 
                                        style=wx.TE_RIGHT 
                                        )
        self.label_max_delay = wx.StaticText(self, -1, "Maximum delay")
        self.float_max_delay = floatctrl.FloatCtrl(
                                        self, 
                                        size=wx.Size(50,-1), 
                                        style=wx.TE_RIGHT 
                                        )

        self.__set_properties()
        self.__do_layout()
        self.__bind_events()
Example #2
0
    def __init__(self, parent, event, entity):
        wx.PyControl.__init__(self,
                              parent,
                              style=wx.NO_BORDER | wx.TAB_TRAVERSAL)
        self.entity = entity
        self.event = str(event)
        event_id = servers.get_trigger_server().geteventtransientid(event)
        event_label = servers.get_trigger_server().geteventlabel(event_id)
        event_label = "On " + event_label.lower()
        self.staticbox_operations = wx.StaticBox(self, -1, event_label)
        self.list_operations = wx.ListBox(self, -1)
        self.button_add_cmd = wx.Button(self, -1, "Add cmd")
        self.button_add_script = wx.Button(self, -1, "Add script")
        self.button_remove = wx.Button(self, -1, "Remove")
        self.button_edit = wx.Button(self, -1, "Edit")
        self.label_execute = wx.StaticText(self, -1, "Execute")
        self.choice_execute = wx.Choice(self,
                                        -1,
                                        choices=['All', 'One', 'Some'])
        self.label_min_delay = wx.StaticText(self, -1, "Minimum delay")
        self.float_min_delay = floatctrl.FloatCtrl(self,
                                                   size=wx.Size(50, -1),
                                                   style=wx.TE_RIGHT)
        self.label_max_delay = wx.StaticText(self, -1, "Maximum delay")
        self.float_max_delay = floatctrl.FloatCtrl(self,
                                                   size=wx.Size(50, -1),
                                                   style=wx.TE_RIGHT)

        self.__set_properties()
        self.__do_layout()
        self.__bind_events()
def get_condition_gui_name(condition_path):
    condition = pynebula.lookup(condition_path)
    ##    shared_event_prefix = format.append_to_path( fsm.get_event_conditions_lib(), "event" )
    ##    if condition_path.startswith( shared_event_prefix ):
    if condition.isa('neventcondition'):
        return servers.get_trigger_server().geteventlabel(condition.getevent())
    else:
        return condition.getname()
def get_condition_gui_name(condition_path):
    condition = pynebula.lookup(condition_path)
##    shared_event_prefix = format.append_to_path( fsm.get_event_conditions_lib(), "event" )
##    if condition_path.startswith( shared_event_prefix ):
    if condition.isa('neventcondition'):
        return servers.get_trigger_server().geteventlabel( condition.getevent() )
    else:
        return condition.getname()
Example #5
0
def get_root_dir(noh = True):
    """Return the root directory of all trigger related objects"""
    if noh:
        path = "/trigger"
        __safe_new(path)
    else:
        path = servers.get_trigger_server().getstoragepath()
    return path
    def __set_properties(self):
        self.SetScrollRate(10, 10)

        # Available input events
        ts = servers.get_trigger_server()
        for i in range(ts.geteventtypesnumber()):
            if ts.isagenerictriggerinevent(i):
                self.checklist_input.Append(ts.geteventlabel(i))
                self.event_ids.append(i)
 def __set_properties(self):
     self.SetScrollRate(10, 10)
     
     # Available input events
     ts = servers.get_trigger_server()
     for i in range( ts.geteventtypesnumber() ):
         if ts.isagenerictriggerinevent(i):
             self.checklist_input.Append( ts.geteventlabel(i) )
             self.event_ids.append( i )
Example #8
0
def restore():
    """Load the whole FSM library"""
    fs = servers.get_fsm_server()
    fs.loadall()
    
    # Create event conditions for all the new events handled by a FSM
    ts = servers.get_trigger_server()
    for i in range( ts.geteventtypesnumber() ):
        if ts.isafsminevent( i ):
            # This creates the event if it doesn't exist yet
            id_name = ts.geteventpersistentid( i )
#            return
            fs.geteventcondition( str(id_name) )
Example #9
0
    def __update_input_ctrl(self):
        self.checklist_input.Clear()
        self.event_ids = {}
        if self.entity is None:
            return

        # Available input events
        trigger_server = servers.get_trigger_server()
        for index in range( trigger_server.geteventtypesnumber() ):
            if trigger_server.isanareatriggerinevent(index):
                # since the list box is sorted we can't assume the position 
                # of any item won't change, so we need to store the id of 
                # each group against its name
                event_label =  trigger_server.geteventlabel(index) 
                self.event_ids[event_label] = index
                j = self.checklist_input.Append(event_label)
                # Enabled input events
                if self.get_event_flag( index ):
                    self.checklist_input.Check( j )
Example #10
0
    def __update_input_ctrl(self):
        self.checklist_input.Clear()
        self.event_ids = {}
        if self.entity is None:
            return

        # Available input events
        trigger_server = servers.get_trigger_server()
        for index in range(trigger_server.geteventtypesnumber()):
            if trigger_server.isanareatriggerinevent(index):
                # since the list box is sorted we can't assume the position
                # of any item won't change, so we need to store the id of
                # each group against its name
                event_label = trigger_server.geteventlabel(index)
                self.event_ids[event_label] = index
                j = self.checklist_input.Append(event_label)
                # Enabled input events
                if self.get_event_flag(index):
                    self.checklist_input.Check(j)
Example #11
0
 def __get_trigger_server(self):
     return servers.get_trigger_server()
 def __get_trigger_server(self):
     return servers.get_trigger_server()