def __init__(self, session, type=type, player=None): MediaBrowser.__init__(self, session, type=type, player=player) self["needle"] = EnhancedInput() self.skinName = "MediaBrowserSearch" self._setList(MediaBrowserSearchList(type=type)) self["numberactions"] = NumberActionMap(["NumberActions"], { "1": self._keyNumberGlobal, "2": self._keyNumberGlobal, "3": self._keyNumberGlobal, "4": self._keyNumberGlobal, "5": self._keyNumberGlobal, "6": self._keyNumberGlobal, "7": self._keyNumberGlobal, "8": self._keyNumberGlobal, "9": self._keyNumberGlobal, "0": self._keyNumberGlobal }) self["inputactions"] = ActionMap(["InputActions"], { "backspace": self._actionBackspace, "delete": self._actionDelete, "ascii": self._actionAscii, }) self._keyboardMode = eRCInput.getInstance().getKeyboardMode() eRCInput.getInstance().setKeyboardMode(eRCInput.kmAscii) self.__searchTimer = eTimer() self.__searchTimer_conn = self.__searchTimer.timeout.connect(self._onSearchTimeout) self.onClose.append(self.__onClose)
def __runEmu(self): print "[GnuBoy] - __runEmu", self.__rom eRCInput.getInstance().lock() fbClass.getInstance().lock() com = "export LANG=" + language.getLanguage() + ".UTF-8;" com += "/usr/bin/sdlgnuboy-start '%s';" % self.__rom self.__container.execute(com)
def __runEmu(self): print "[DosBox] - __runEmu" eRCInput.getInstance().lock() fbClass.getInstance().lock() com = "export LANG=" + language.getLanguage() + ".UTF-8;" com += "/usr/bin/dosbox-start;" self.__container.execute(com)
def runPlugin(self, pluginname): eDBoxLCD.getInstance().lock() eRCInput.getInstance().lock() fbClass.getInstance().lock() print "executing:", ("pluginlauncher -x %s" % pluginname) if self.container.execute("pluginlauncher -x %s" % pluginname): self.finishedExecution(None)
def _cb_stop_browser(self): self._close_timer.stop() try: if self._cb_set_title in vbcfg.g_main.vbhandler.onSetTitleCB: vbcfg.g_main.vbhandler.onSetTitleCB.remove(self._cb_set_title) except Exception: pass try: if self._cb_close_window in vbcfg.g_main.vbhandler.onCloseCB: vbcfg.g_main.vbhandler.onCloseCB.remove(self._cb_close_window) except Exception: pass self.toggle_top() from enigma import gMainDC gMainDC.getInstance().setResolution(self.WIDTH, self.HEIGHT) vbcfg.setPosition(vbcfg.g_position) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() getDesktop(0).paint() self.is_browser_opened = False vbcfg.LOG("Stop Browser") self.setTitle(_("BrowserMain")) if self.m_url is not None: self.keyCancel() if vbcfg.g_service: self.session.nav.playService(vbcfg.g_service) else: self.keyRight() self.keyLeft()
def close_vkb(self, data=""): fbClass.getInstance().lock() eRCInput.getInstance().lock() if strIsEmpty(data): data = "" VBController.command("BROWSER_VKB_CLOSE", data)
def _CB_BROWSER_MENU_OPEN(self, result, packet): if vbcfg.g_browser and vbcfg.g_browser.is_browser_opened: vbcfg.setPosition(vbcfg.g_position) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() vbcfg.g_browser.toggle_browser(packet, self.current_title) return (True, None)
def onDeselect(self, session): eRCInput.getInstance().setKeyboardMode(self._keyboardMode) self.marked_pos = 0 self.offset = 0 if self.help_window: session.deleteDialog(self.help_window) self.help_window = None ConfigElement.onDeselect(self, session)
def onSelect(self, session): self.allmarked = (self.value != "") self._keyboardMode = eRCInput.getInstance().getKeyboardMode() eRCInput.getInstance().setKeyboardMode(eRCInput.kmAscii) if session is not None: from Screens.NumericalTextInputHelpDialog import NumericalTextInputHelpDialog self.help_window = session.instantiateDialog(NumericalTextInputHelpDialog, self) self.help_window.show()
def __runEmu(self): print "[Vice] - __runEmu", self.__emu eRCInput.getInstance().lock() fbClass.getInstance().lock() com = "export LANG=" + language.getLanguage() + ".UTF-8;" com += "/usr/bin/vice-start '%s'" %self.__emu if self.__rom != "": com += " '%s'" %self.__rom self.__container.execute(com)
def __runEmu(self,rom): print "[Snes] - __runEmu", rom eDBoxLCD.getInstance().lock() eRCInput.getInstance().lock() fbClass.getInstance().lock() com = "export LANG=" + language.getLanguage() + ".UTF-8;" com += "/usr/bin/snes9x-sdl-start '%s';" %rom self.__container.execute(com)
def keyCancel(self): if self.is_browser_opened: fbClass.getInstance().lock() eRCInput.getInstance().lock() self.toggle_top() VBController.command("BROWSER_MENU_CLOSE") return self._cmd_Exit()
def _CB_BROWSER_VKB_OPEN(self, result, packet): if vbcfg.g_browser and vbcfg.g_browser.is_browser_opened: vbcfg.setPosition(vbcfg.g_position) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() if strIsEmpty(packet): packet = "" self._session.openWithCallback(self.close_vkb, VirtualKeyBoard, title=("Please enter URL here"), text=str(packet)) return (True, None)
def finished(self,retval): fbClass.getInstance().unlock() eRCInput.getInstance().unlock() eDBoxLCD.getInstance().unlock() if self.faked_lcd: remove("/dev/dbox/lcd0") rmdir("/dev/dbox") self.close()
def keyRun(self): entry = self["installedimages"].getCurrent()[0] #if self.oldref == None: # self.stopService() excute_cmd('snes_init') excute_cmd('cp /etc/fb.snes /etc/fb.modes') fbClass.getInstance().lock() eRCInput.getInstance().lock() self.session.openWithCallback(self.myback, GoMain, entry) excute_cmd('rm -R /etc/fb.modes')
def finishedExecution(self, retval = 1): print "PluginRunner retval:", retval fbClass.getInstance().unlock() eRCInput.getInstance().unlock() eDBoxLCD.getInstance().unlock() if retval is None or retval != 1: self.session.openWithCallback( self.finishedExecution, MessageBox, _("Error executing plugin") % param ) else: self.close()
def finished(self,retval): fbClass.getInstance().unlock() eRCInput.getInstance().unlock() eDBoxLCD.getInstance().unlock() if self.faked_lcd: remove("/dev/dbox/lcd0") rmdir("/dev/dbox") #force redraw dsk = getDesktop(0) dsk.resize(dsk.size()) self.close()
def __init__(self): assert not HdmiCec.instance, "only one HdmiCec instance is allowed!" HdmiCec.instance = self eHdmiCEC.getInstance().messageReceived.get().append(self.messageReceived) config.misc.standbyCounter.addNotifier(self.onEnterStandby, initial_call = False) config.misc.DeepStandby.addNotifier(self.onEnterDeepStandby, initial_call = False) self.setFixedPhysicalAddress(config.hdmicec.fixed_physical_address.getValue()) self.volumeForwardingEnabled = False self.volumeForwardingDestination = 0 eRCInput.getInstance().pyKeyEvent.get().append(self.keyEvent) config.hdmicec.volume_forwarding.addNotifier(self.configVolumeForwarding) if config.hdmicec.handle_deepstandby_events.getValue(): if not getFPWasTimerWakeup(): self.wakeupMessages()
def cancel(self): # overwritten from InputBox rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmNone) self.do_preview_timer.stop() self.do_search_timer.stop() self.close(False,False,False,False,False)
def execEnd(self): rcinput = eRCInput.getInstance() if self.vumachine == "ultimo": rcinput.setKeyboardMode(rcinput.kmAscii) else: rcinput.setKeyboardMode(rcinput.kmNone) self.timer.callback.remove(self.timeout)
def execBegin(self): rcinput = eRCInput.getInstance() if not config.misc.remotecontrol_text_support.getValue(): rcinput.setKeyboardMode(rcinput.kmAscii) else: rcinput.setKeyboardMode(rcinput.kmNone) self.timer.callback.append(self.timeout)
def execBegin(self): rcinput = eRCInput.getInstance() #### Fix number edit in setting menu when firm is in Meoboot from Tools.Directories import fileExists if not fileExists("/.meoinfo"): rcinput.setKeyboardMode(rcinput.kmAscii) ############################################################ self.timer.callback.append(self.timeout)
def command(opcodestr, data = ""): cmd_fd = None vbcfg.DEBUG("send ipc: [%s]" % opcodestr) try: send_data = VBController.assamble(opcodestr, data) if not os.path.exists(vbcfg.CONTROLFILE): raise Exception("no found controller file.") cmd_fd = os.open(vbcfg.CONTROLFILE, os.O_WRONLY) if cmd_fd is None: raise Exception("fail to open controller file.") os.write(cmd_fd, send_data) except Exception, err: vbcfg.ERR("VBHController: %s" % err) vbcfg.setPosition(vbcfg.g_position) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() return False
def execBegin(self): rcinput = eRCInput.getInstance() try: vumachine = file("/proc/stb/info/vumodel").read().strip() if vumachine == "ultimo" or vumachine == "zero": rcinput.setKeyboardMode(rcinput.kmNone) else: rcinput.setKeyboardMode(rcinput.kmAscii) except: rcinput.setKeyboardMode(rcinput.kmAscii) self.timer.callback.append(self.timeout)
def runapp(self): service = self.session.nav.getCurrentService() info = service and service.info() txtpid = info and "%d" %(info.getInfo(iServiceInformation.sTXTPID)) or "" stream = service and service.stream() demux = stream and stream.getStreamingData() demux = demux and demux.get("demux", -1) demux = demux > -1 and "%d" %(demux) or "" eDBoxLCD.getInstance().lock() eRCInput.getInstance().lock() fbClass.getInstance().lock() self.faked_lcd = not path.exists("/dev/dbox") if self.faked_lcd: mkdir("/dev/dbox") symlink("/dev/null", "/dev/dbox/lcd0") if self.container.execute("/usr/bin/tuxtxt " + demux + " " + txtpid): self.finished(-1)
def _cb_start_browser(self, data=None, mode=0, opcode='BROWSER_OPENURL'): if not vbcfg.g_main.check_browser(): if self.m_url is not None: if vbcfg.g_service: self.session.nav.playService(vbcfg.g_service) return vbcfg.LOG("open url: %s %d" % (data, mode)) if strIsEmpty(data): return try: if self._cb_set_title not in vbcfg.g_main.vbhandler.onSetTitleCB: vbcfg.g_main.vbhandler.onSetTitleCB.append(self._cb_set_title) except Exception: pass try: if self._cb_close_window not in vbcfg.g_main.vbhandler.onCloseCB: vbcfg.g_main.vbhandler.onCloseCB.append(self._cb_close_window) except Exception: pass vbcfg.g_position = vbcfg.getPosition() fbClass.getInstance().lock() eRCInput.getInstance().lock() self.toggle_top() ret = VBController.command(opcode, data) self._current_url = data if ret: self.is_browser_opened = True else: self.is_browser_opened = False vbcfg.ERR("Failed to open url: %s" % data) vbcfg.g_main.vbhandler.soft_volume = -1
def keySave(self): rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmNone) retList = [] for idx in range(len(self.list)): if None != self.list[idx]['validator']: sts,msg = self.list[idx]['validator'](self["input_%d"%idx].getText()) if not sts: self.session.open(MessageBox, msg, type=MessageBox.TYPE_ERROR) self.idx = idx self.activeInput = "input_%d"%idx self.setMarker() return retList.append(self["input_%d"%idx].getText()) self.close(retList)
def __init__(self, session, title="", windowTitle=_("Input"), useableChars=None, **kwargs): Screen.__init__(self, session) myNumericalTextInput.__init__(self, nextFunc=None, handleTimeout=False) self.session = session self["text"] = Label(title) self["input"] = Input(**kwargs) self.onShown.append(boundFunction(self.setTitle, windowTitle)) if useableChars is not None: self["input"].setUseableChars(useableChars) self["actions"] = NumberActionMap( [ "WizardActions", "InputBoxActions", "InputAsciiActions", "KeyboardInputActions" ], { "gotAsciiCode": self.gotAsciiCode, "ok": self.go, "back": self.cancel, "left": self.keyLeft, "right": self.keyRight, "home": self.keyHome, "end": self.keyEnd, "deleteForward": self.keyDelete, "deleteBackward": self.keyBackspace, "tab": self.keyTab, "toggleOverwrite": self.keyInsert, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) if self["input"].type == Input.TEXT: rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmAscii) self.onLayoutFinish.append(self.NumDlgInit)
def keySave(self): rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmNone) retList = [] for idx in range(len(self.list)): if None != self.list[idx]['validator']: sts, msg = self.list[idx]['validator'](self["input_%d" % idx].getText()) if not sts: self.session.open(MessageBox, msg, type=MessageBox.TYPE_ERROR) self.idx = idx self.activeInput = "input_%d" % idx self.setMarker() return retList.append(self["input_%d" % idx].getText()) self.close(retList)
def __init__(self, session, char=u'ABCDEFGHIJKLMNOPQRSTUVWXYZ'): rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmAscii) self.numericalTextInput = NumericalTextInput() self.numericalTextInput.setUseableChars(char) self["NumberActions"] = NumberActionMap( ["NumberActions", "InputAsciiActions"], { "gotAsciiCode": self._keyAsciiCode, "1": self._keyNumberGlobal, "2": self._keyNumberGlobal, "3": self._keyNumberGlobal, "4": self._keyNumberGlobal, "5": self._keyNumberGlobal, "6": self._keyNumberGlobal, "7": self._keyNumberGlobal, "8": self._keyNumberGlobal, "9": self._keyNumberGlobal, "0": self._onKey0 }, -1) self.onClose.append(self.__onClose)
def __init__(self, session, title = "", windowTitle = _("Input"), useableChars = None, **kwargs): Screen.__init__(self, session) myNumericalTextInput.__init__(self, nextFunc = None, handleTimeout = False) self.session = session self["text"] = Label(title) self["input"] = Input(**kwargs) self.onShown.append(boundFunction(self.setTitle, windowTitle)) if useableChars is not None: self["input"].setUseableChars(useableChars) self["actions"] = NumberActionMap(["WizardActions", "InputBoxActions", "InputAsciiActions", "KeyboardInputActions"], { "gotAsciiCode": self.gotAsciiCode, "ok": self.go, "back": self.cancel, "left": self.keyLeft, "right": self.keyRight, "home": self.keyHome, "end": self.keyEnd, "deleteForward": self.keyDelete, "deleteBackward": self.keyBackspace, "tab": self.keyTab, "toggleOverwrite": self.keyInsert, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) if self["input"].type == Input.TEXT: rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmAscii) self.onLayoutFinish.append(self.NumDlgInit)
def remapRemoteControl(self, device): filename = rc_model.getRcPositions() domRemote = self.loadRemoteControl(filename) logRemaps = [] remapButtons = {} if domRemote is not None: rc = domRemote.find("rc") if rc is not None: for button in rc.findall("button"): keyid = KEYIDS.get(button.attrib.get("keyid")) remap = KEYIDS.get(button.attrib.get("remap")) if keyid is not None and remap is not None: logRemaps.append((button.attrib.get("keyid"), button.attrib.get("remap"))) remapButtons[keyid] = remap if len(logRemaps): print("[InputDevice] Remapping remote control buttons for '%s':" % filename) for remap in logRemaps: print("[InputDevice] Remapping '%s' to '%s'." % (remap[0], remap[1])) for evdev, evdevinfo in iInputDevices.Devices.items(): if evdevinfo["type"] == "remote": res = eRCInput.getInstance().setKeyMapping( evdevinfo["name"], remapButtons) resStr = { eRCInput.remapOk: "Remap completed okay.", eRCInput.remapUnsupported: "Error: Remapping not supported on device!", eRCInput.remapFormatErr: "Error: Remap map in incorrect format!", eRCInput.remapNoSuchDevice: "Error: Unknown device!", }.get(res, "Error: Unknown error!") print( "[InputDevice] Remote remap evdev='%s', name='%s': %s" % (evdev, evdevinfo["name"], resStr))
def RCLock(): print "[KodiLauncher] RCLock" eRCInput.getInstance().lock()
def loadRemoteControl(self, filename): print("[InputDevice] Loading remote control '%s'." % filename) rcs = fileReadXML(filename, source=MODULE_NAME) rcButtons = {} if rcs: rc = rcs.find("rc") if rc: logRemaps = [] remapButtons = {} placeHolder = 0 rcButtons["keyIds"] = [] rcButtons["image"] = rc.attrib.get("image") if config.crash.debugRemoteControls.value: print("[InputDevice] Remote control image file '%s'." % rcButtons["image"]) for button in rc.findall("button"): id = button.attrib.get("id", "KEY_RESERVED") remap = button.attrib.get("remap") keyId = KEYIDS.get(id) remapId = KEYIDS.get(remap) if keyId is not None and remapId is not None: logRemaps.append((id, remap)) remapButtons[keyId] = remapId keyId = remapId if keyId == 0: placeHolder -= 1 keyId = placeHolder rcButtons["keyIds"].append(keyId) rcButtons[keyId] = {} rcButtons[keyId]["id"] = id rcButtons[keyId]["label"] = button.attrib.get("label") rcButtons[keyId]["pos"] = [ int(x.strip()) for x in button.attrib.get("pos", "0").split(",") ] rcButtons[keyId]["title"] = button.attrib.get("title") rcButtons[keyId]["shape"] = button.attrib.get("shape") rcButtons[keyId]["coords"] = [ int(x.strip()) for x in button.attrib.get("coords", "0").split(",") ] if config.crash.debugRemoteControls.value: print( "[InputDevice] Remote control button id='%s', keyId='%s', label='%s', pos='%s', title='%s', shape='%s', coords='%s'." % (id, keyId, rcButtons[keyId]["label"], rcButtons[keyId]["pos"], rcButtons[keyId]["title"], rcButtons[keyId]["shape"], rcButtons[keyId]["coords"])) if logRemaps: for remap in logRemaps: print("[InputDevice] Remapping '%s' to '%s'." % (remap[0], remap[1])) for evdev, evdevinfo in sorted( iInputDevices.Devices.items()): if evdevinfo["type"] == "remote": result = eRCInput.getInstance().setKeyMapping( evdevinfo["name"], remapButtons) resStr = { eRCInput.remapOk: "Remap completed okay.", eRCInput.remapUnsupported: "Error: Remapping not supported on device!", eRCInput.remapFormatErr: "Error: Remap map in incorrect format!", eRCInput.remapNoSuchDevice: "Error: Unknown device!", }.get(result, "Error: Unknown error!") print( "[InputDevice] Remote remap evdev='%s', name='%s': %s" % (evdev, evdevinfo["name"], resStr)) return rcButtons
def setKeyboardModeNone(self): eRCInput.getInstance().setKeyboardMode(eRCInput.kmNone)
def execBegin(self): rcinput = eRCInput.getInstance() #---> #- rcinput.setKeyboardMode(rcinput.kmAscii) #---< self.timer.callback.append(self.timeout)
def setKeyboardMode(self): rcinput = eRCInput.getInstance() if self[self.activeInput].type == Input.TEXT: rcinput.setKeyboardMode(rcinput.kmAscii) else: rcinput.setKeyboardMode(rcinput.kmNone)
def dvbapp_unlock(): cbcfg.DEBUG("dvbapp_unlock") # fbClass.getInstance().unlock() global _g_locked _g_locked = False eRCInput.getInstance().unlock()
def __onClose(self): eRCInput.getInstance().setKeyboardMode(self._keyboardMode)
def execBegin(self): rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmAscii) self.timer.callback.append(self.timeout)
def asciiOff(self): rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmNone)
def saveKeyboardMode(self): rcinput = eRCInput.getInstance() self.keyboardMode = rcinput.getKeyboardMode()
def restoreKeyboardMode(self): if self.keyboardMode is not None: eRCInput.getInstance().setKeyboardMode(self.keyboardMode)
def hkeys(self): self.keyhandler.stop() fbClass.getInstance().unlock() eRCInput.getInstance().unlock() self. keyCancel()
def dvbapp_lock(): cbcfg.DEBUG("dvbapp_lock") # fbClass.getInstance().lock() global _g_locked _g_locked = True eRCInput.getInstance().lock()
def execBegin(self): rcinput = eRCInput.getInstance() rcinput.setKeyboardMode( rcinput.kmAscii if not config.misc.remotecontrol_text_support.value else rcinput.kmNone) self.timer.callback.append(self.timeout)
def RCUnlock(): print("[KodiLauncher] RCUnlock") eRCInput.getInstance().unlock()
def __onClose(self): if self.started: rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(self.keyboardMode)
def go(self): rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmNone) self.session.deleteDialog(self.help_window) self.help_window = None self.close(self["input"].getText())
def osd_lock(): fbClass.getInstance().lock() eRCInput.getInstance().lock()
def cancel(self): rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmNone) self.session.deleteDialog(self.help_window) self.help_window = None self.close(None)
def execEnd(self): rcinput = eRCInput.getInstance() #---> #- rcinput.setKeyboardMode(rcinput.kmNone) #---< self.timer.callback.remove(self.timeout)
def setKeyboardModeNone(self): rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmNone)
def execEnd(self): rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmNone) self.timer.callback.remove(self.timeout)
def keyCancel(self): rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmNone) self.close(None)
def setKeyboardModeAscii(self): rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmAscii)
def saveKeyboardMode(self): self.keyboardMode = eRCInput.getInstance().getKeyboardMode()
def restoreKeyboardMode(self): rcinput = eRCInput.getInstance() if self.keyboardMode is not None: rcinput.setKeyboardMode(self.keyboardMode)
def setKeyboardModeAscii(self): eRCInput.getInstance().setKeyboardMode(eRCInput.kmAscii)