コード例 #1
0
ファイル: detect.py プロジェクト: robwebset/script.sleep
    def onAction(self, action):
        ACTION_PREVIOUS_MENU = 10
        ACTION_NAV_BACK = 92
        if (action.getId() == ACTION_PREVIOUS_MENU) or (action.getId() == ACTION_NAV_BACK):
            log("DetectWindow: Close Action received: %s" % str(action.getId()))
            self.close()
        elif action.getButtonCode() not in [None, "", 0]:
            labelControl = self.getControl(DetectWindow.TEXT_LABEL)
            labelControl.setText(ADDON.getLocalizedString(32103))
            self.buttonCode = str(action.getButtonCode())
            log("DetectWindow: Button Code is %s" % self.buttonCode)

            # Need to make a call to the settings to enable the new value
            Settings.setKeymapData(self.buttonCode)

            # Now leave a little time before we continue, the service should pick
            # up the settings change and create a new mapping file
            monitor = xbmc.Monitor()
            monitor.waitForAbort(3)
            del monitor

            self.close()