Exemplo n.º 1
0
    def onAction(self, action):
        id = action.getId()
        
        if id in Action.GO_BACK:
            self.closed = True
            self.saveSettings()
            self.close()
            self.bus.deregister(self)
            
        elif id in (Action.UP, Action.DOWN, Action.PAGE_UP, Action.PAGE_DOWN, Action.HOME, Action.END):

            if self.lastFocusId == ID_GROUPS_LISTBOX:
                self.onGroupSelect()
            
            elif self.lastFocusId == ID_PROGRAMS_LISTBOX:
                self.onTitleSelect()
        
        elif id in (Action.ACTION_NEXT_ITEM, Action.ACTION_PREV_ITEM,):
            log.debug('next/prev: ' + toolkit.toString(action))
            
            if self.lastFocusId == ID_GROUPS_LISTBOX:
                self.selectListItemAtIndex(self.groupsListbox, [0, self.groupsListbox.size()-1][id == Action.ACTION_NEXT_ITEM])
                self.onGroupSelect()
            
            elif self.lastFocusId == ID_PROGRAMS_LISTBOX:
                self.selectListItemAtIndex(self.programsListbox, [0, self.programsListbox.size()-1][id == Action.ACTION_NEXT_ITEM])
                self.onTitleSelect()
            
        elif id == ID_GROUPS_LISTBOX:
            pass #log.debug('groups action!')
        else:
            log.debug('uncaught action id %s' % id)
Exemplo n.º 2
0
    def onAction(self, action):
        id = action.getId()
        
        if id in (Action.PREVIOUS_MENU, Action.PARENT_DIR):
            self.closed = True
            self.saveSettings()
            self.close()
            self.bus.deregister(self)
            
        elif id in (Action.UP, Action.DOWN, Action.PAGE_UP, Action.PAGE_DOWN, Action.HOME, Action.END):

            if self.lastFocusId == ID_GROUPS_LISTBOX:
                self.onGroupSelect()
            
            elif self.lastFocusId == ID_PROGRAMS_LISTBOX:
                self.onTitleSelect()
        
        elif id in (Action.ACTION_NEXT_ITEM, Action.ACTION_PREV_ITEM,):
            log.debug('next/prev: ' + toolkit.toString(action))
            
            if self.lastFocusId == ID_GROUPS_LISTBOX:
                self.selectListItemAtIndex(self.groupsListbox, [0, self.groupsListbox.size()-1][id == Action.ACTION_NEXT_ITEM])
                self.onGroupSelect()
            
            elif self.lastFocusId == ID_PROGRAMS_LISTBOX:
                self.selectListItemAtIndex(self.programsListbox, [0, self.programsListbox.size()-1][id == Action.ACTION_NEXT_ITEM])
                self.onTitleSelect()
            
        elif id == ID_GROUPS_LISTBOX:
            pass #log.debug('groups action!')
        else:
            log.debug('uncaught action id %s' % id)