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 __init__(self, session, title = "", windowTitle = _("Input"), useableChars = None, **kwargs): Screen.__init__(self, session, windowTitle=windowTitle) self["text"] = Label(title) self["input"] = Input(**kwargs) self["input"].onInputUpdate.append(self._onInputUpdate) 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) self._help_window = None if self["input"].type == Input.TEXT: self.onExecBegin.append(self.setKeyboardModeAscii) else: self.onExecBegin.append(self.setKeyboardModeNone) self.onClose.append(self.__onClose) self.onShow.append(self.__onShow) self.onHide.append(self.__onHide)
def __init__(self, session, title = "", windowTitle = _("Input"), useableChars = None, **kwargs): Screen.__init__(self, session) self["text"] = Label(title) self["input"] = Input(**kwargs) self["VKeyIcon"] = Pixmap() self["help_text"] = Label(_("use virtual keyboard for text input")) 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, "showVirtualKeyboard": self.virtualKeyBoard, "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: if config.misc.remotecontrol_text_support.value: self.onExecBegin.append(self.setKeyboardModeNone) else: self.onExecBegin.append(self.setKeyboardModeAscii) else: self.onExecBegin.append(self.setKeyboardModeNone)
def __init__(self, session, args=None): self.skin = Ipkremove.skin Screen.__init__(self, session) self["list"] = FileList( "/", matchingPattern="^.*\.(ipk|png|avi|mp3|mpeg|ts)") self["pixmap"] = Pixmap() self["text"] = Input("1234", maxSize=True, type=Input.NUMBER) self["actions"] = NumberActionMap( ["WizardActions", "InputActions"], { "ok": self.close, "back": self.close, "left": self.keyLeft, "right": self.keyRight, }, -1) title = _("Ipkremove") self.setTitle(title) self.onShown.append(self.openTest)
def __init__(self, session, title='', windowTitle=None, useableChars=None, **kwargs): Screen.__init__(self, session) self['text'] = Label(title) self['input'] = Input(**kwargs) if windowTitle is None: windowTitle = _('Input') 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: if config.misc.remotecontrol_text_support.value: self.onExecBegin.append(self.setKeyboardModeNone) else: self.onExecBegin.append(self.setKeyboardModeAscii) else: self.onExecBegin.append(self.setKeyboardModeNone) return
def __init__(self, session, basemins=5): Screen.__init__(self, session) self['minutes'] = Input(str(basemins), type=Input.NUMBER) self['actions'] = NumberActionMap(['InputActions', 'MinuteInputActions', 'TextEntryActions', 'KeyboardInputActions'], {'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, 'left': self.left, 'right': self.right, 'home': self.home, 'end': self.end, 'deleteForward': self.deleteForward, 'deleteBackward': self.deleteBackward, 'up': self.up, 'down': self.down, 'ok': self.ok, 'cancel': self.cancel })
def __init__(self, session): Screen.__init__(self, session) self["red"] = Pixmap() self["green"] = Pixmap() self["yellow"] = Pixmap() self["blue"] = Pixmap() self["red_text"] = Label() self["green_text"] = Label() self["yellow_text"] = Label() self["blue_text"] = Label() self["current_status"] = Label() self.is_active = self.session.nav.SleepTimer.isActive() if self.is_active: self["current_status"].setText( _("Timer status:") + " " + _("Enabled")) else: self["current_status"].setText( _("Timer status:") + " " + _("Disabled")) if self.is_active: self.time = self.session.nav.SleepTimer.getCurrentSleepTime() else: self.time = config.SleepTimer.defaulttime.value self["input"] = Input(text=str(self.time), maxSize=False, type=Input.NUMBER) self.status = True self.updateColors() self["pretext"] = Label(_("Shutdown Dreambox after")) self["aftertext"] = Label(_("minutes")) self["actions"] = NumberActionMap( [ "SleepTimerEditorActions", "TextEntryActions", "KeyboardInputActions" ], { "exit": self.cancel, "select": self.select, "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, "selectLeft": self.selectLeft, "selectRight": self.selectRight, "left": self.selectLeft, "right": self.selectRight, "home": self.selectHome, "end": self.selectEnd, "deleteForward": self.deleteForward, "deleteBackward": self.deleteBackward, "disableTimer": self.disableTimer, "toggleAction": self.toggleAction, "toggleAsk": self.toggleAsk, "useServiceTime": self.useServiceTime }, -1)
def __init__(self, session, params={}): # Skin generator maxWidth = 0 pX = 40 pY = 60 dY = 10 skinItems = '' self.icons = [] self.list = params['list'] self.withAcceptButton = params.get('with_accept_button', False) self.statusText = params.get('status_text', '') statusTextHight = params.get('status_text_hight', 80) # calcl maxWidth size for idx in range(len(self.list)): item = self.list[idx] if item['label_size'][0] > maxWidth: maxWidth = item['label_size'][0] if item['input_size'][0] > maxWidth: maxWidth = item['input_size'][0] maxWidth += pX * 2 if len(self.statusText): skinItems = '<widget name="statustext" position="10,%d" zPosition="2" size="%d,%d" valign="center" halign="center" font="Regular;22" transparent="1" />' % (pY + dY, maxWidth - 20, statusTextHight) pY += statusTextHight + dY * 2 for idx in range(len(self.list)): item = self.list[idx] if 'icon_path' in item: self["cover_%d" % idx] = Cover2() self.icons.append({'name': "cover_%d" % idx, 'path': item['icon_path']}) else: self["text_%d" % idx] = Label(item.get('title', '')) self["input_%d" % idx] = Input(**item['input']) self["border_%d" % idx] = Label("") if item.get('useable_chars', None) is not None: self["input_%d" % idx].setUseableChars(item['useable_chars']) if 'icon_path' in item: skinItems += '<widget name="cover_%d" position="%d,%d" size="%d,%d" zPosition="8" />' % (idx, (maxWidth - item['label_size'][0]) / 2, pY, item['label_size'][0], item['label_size'][1]) else: skinItems += '<widget name="text_%d" position="%d,%d" size="%d,%d" font="%s" zPosition="2" />' % (idx, 10, pY, item['label_size'][0], item['label_size'][1], item['label_font']) pY += dY + item['label_size'][1] skinItems += '<widget name="input_%d" position="%d,%d" size="%d,%d" font="%s" zPosition="2" />' % (idx, pX, pY, item['input_size'][0], item['input_size'][1], item['input_font']) skinItems += '<widget name="border_%d" position="%d,%d" size="%d,%d" font="%s" zPosition="1" transparent="0" backgroundColor="#331F93B9" />' % (idx, pX - 5, pY - 5, item['input_size'][0] + 10, item['input_size'][1] + 10, item['input_font']) if 0 == idx: self['marker'] = Cover3() skinItems += '<widget name="marker" zPosition="2" position="10,%d" size="16,16" transparent="1" alphatest="blend" />' % (pY + (item['input_size'][1] - 16) / 2) skinItems += '<widget name="marker_%d" zPosition="1" position="10,%d" size="16,16" transparent="1" alphatest="blend" />' % (idx, pY + (item['input_size'][1] - 16) / 2) self['marker_%d' % idx] = Cover3() pY += dY * 2 + item['input_size'][1] if self.withAcceptButton: skinItems += '<widget name="accept_button" position="10,%d" zPosition="2" size="%d,50" valign="center" halign="center" font="Regular;22" foregroundColor="#00FFFFFF" backgroundColor="#320F0F0F" />' % (pY, maxWidth - 20) pY += dY * 2 + 50 self.skin = """ <screen name="IPTVMultipleInputBox" position="center,center" size="%d,%d" title="%s"> <widget name="key_red" position="10,10" zPosition="2" size="%d,35" valign="center" halign="left" font="Regular;22" transparent="1" foregroundColor="red" /> <widget name="key_ok" position="10,10" zPosition="2" size="%d,35" valign="center" halign="center" font="Regular;22" transparent="1" foregroundColor="white" /> <widget name="key_green" position="10,10" zPosition="2" size="%d,35" valign="center" halign="right" font="Regular;22" transparent="1" foregroundColor="green" /> %s </screen> """ % (maxWidth, pY, params.get('title', _("Input")), maxWidth - 20, maxWidth - 20, maxWidth - 20, skinItems) self["key_green"] = Label(params.get('accep_label', _("Save"))) self["key_ok"] = Label(_("OK")) self["key_red"] = Label(_("Cancel")) if len(self.statusText): self["statustext"] = Label(str(self.statusText)) if self.withAcceptButton: self["accept_button"] = Label(params.get('accep_label', _("Verify"))) self.params = params Screen.__init__(self, session) self.onShown.append(self.onStart) self.onClose.append(self.__onClose) self["actions"] = NumberActionMap(["ColorActions", "WizardActions", "InputBoxActions", "InputAsciiActions", "KeyboardInputActions"], { "gotAsciiCode": self.gotAsciiCode, "green": self.keySave, "ok": self.keyOK, "red": self.keyCancel, "back": self.keyCancel, "left": self.keyLeft, "right": self.keyRight, "up": self.keyUp, "down": self.keyDown, "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) self.idx = 0 self.activeInput = "input_0" self.markerPixmap = [LoadPixmap(GetIconDir('radio_button_on.png')), LoadPixmap(GetIconDir('radio_button_off.png'))] self.started = False
def __init__(self, session, title="", **kwargs): Screen.__init__(self, session) self.setTitle(_("Virtual keyboard")) self.keys_list = [] self.shiftkeys_list = [] self.lang = language.getLanguage() self.nextLang = None self.shiftMode = False self.selectedKey = 0 self.smsChar = None self.sms = NumericalTextInput(self.smsOK) self.key_bg = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_bg.png")) self.key_sel = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_sel.png")) self.key_backspace = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_backspace.png")) self.key_all = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_all.png")) self.key_clr = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_clr.png")) self.key_esc = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_esc.png")) self.key_ok = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_ok.png")) self.key_shift = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_shift.png")) self.key_shift_sel = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_shift_sel.png")) self.key_space = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_space.png")) self.key_left = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_left.png")) self.key_right = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_right.png")) self.keyImages = { "BACKSPACE": self.key_backspace, "ALL": self.key_all, "EXIT": self.key_esc, "OK": self.key_ok, "SHIFT": self.key_shift, "SPACE": self.key_space, "LEFT": self.key_left, "RIGHT": self.key_right } self.keyImagesShift = { "BACKSPACE": self.key_backspace, "CLEAR": self.key_clr, "EXIT": self.key_esc, "OK": self.key_ok, "SHIFT": self.key_shift_sel, "SPACE": self.key_space, "LEFT": self.key_left, "RIGHT": self.key_right } self["country"] = StaticText("") self["header"] = Label(title) self["text"] = Input(currPos=len(kwargs.get("text", "").decode("utf-8",'ignore')), allMarked=False, **kwargs) self["list"] = VirtualKeyBoardList([]) self["actions"] = NumberActionMap(["OkCancelActions", "WizardActions", "ColorActions", "KeyboardInputActions", "InputBoxActions", "InputAsciiActions"], { "gotAsciiCode": self.keyGotAscii, "ok": self.okClicked, "cancel": self.exit, "left": self.left, "right": self.right, "up": self.up, "down": self.down, "red": self.exit, "green": self.ok, "yellow": self.switchLang, "blue": self.shiftClicked, "deleteBackward": self.backClicked, "deleteForward": self.forwardClicked, "back": self.exit, "pageUp": self.cursorRight, "pageDown": self.cursorLeft, "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, }, -2) self.setLang() self.onExecBegin.append(self.setKeyboardModeAscii) self.onLayoutFinish.append(self.buildVirtualKeyBoard) self.onClose.append(self.__onClose)
def __init__(self, session, title=_("Virtual KeyBoard Text:"), text="", maxSize=False, visible_width=False, type=Input.TEXT, currPos=0, allMarked=False): Screen.__init__(self, session) HelpableScreen.__init__(self) self.setTitle(_("Virtual keyboard")) prompt = title # Title should only be used for screen titles! self.key_bg = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_bg.png")) self.key_sel = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_sel.png")) self.key_longl_sel = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_longl_sel.png")) self.key_longm_sel = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_longm_sel.png")) self.key_longr_sel = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_longr_sel.png")) key_longl_bg = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_longl_bg.png")) key_longm_bg = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_longm_bg.png")) key_longr_bg = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_longr_bg.png")) key_red_bg = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_red.png")) key_green_bg = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_green.png")) key_yellow_bg = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_yellow.png")) key_blue_bg = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_blue.png")) key_backspace = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_backspace.png")) key_enter = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_enter.png")) key_first = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_first.png")) key_last = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_last.png")) key_left = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_left.png")) key_right = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_right.png")) key_shift0 = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_shift0.png")) key_shift1 = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_shift1.png")) key_shift2 = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_shift2.png")) key_shift3 = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_shift3.png")) # self.key_space = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_space.png")) key_space_alt = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "buttons/vkey_space_alt.png")) self.key_sel_width = self.key_sel.size().width() self.keyBackgrounds = { "EXIT": key_red_bg, "OK": key_green_bg, "ENTER": key_green_bg, "LOC": key_yellow_bg, "SHFT": key_blue_bg, "LongL": key_longl_bg, "LongM": key_longm_bg, "LongR": key_longr_bg } self.keyImages = [{ "BACKSPACE": key_backspace, "ENTER": key_enter, "FIRST": key_first, "LAST": key_last, "LEFT": key_left, "RIGHT": key_right, "SHIFT": key_shift0, "SPACE": key_space_alt }, { "BACKSPACE": key_backspace, "ENTER": key_enter, "FIRST": key_first, "LAST": key_last, "LEFT": key_left, "RIGHT": key_right, "SHIFT": key_shift1, "SPACE": key_space_alt }, { "BACKSPACE": key_backspace, "ENTER": key_enter, "FIRST": key_first, "LAST": key_last, "LEFT": key_left, "RIGHT": key_right, "SHIFT": key_shift2, "SPACE": key_space_alt }, { "BACKSPACE": key_backspace, "ENTER": key_enter, "FIRST": key_first, "LAST": key_last, "LEFT": key_left, "RIGHT": key_right, "SHIFT": key_shift3, "SPACE": key_space_alt }] self.shiftMsgs = [ _("Lower case"), _("Upper case"), _("Special 1"), _("Special 2") ] self.english = [ [ [u"`", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"-", u"=", u"BACKSPACE"], [u"FIRST", u"q", u"w", u"e", u"r", u"t", u"y", u"u", u"i", u"o", u"p", u"[", u"]", u"\\"], [u"LAST", u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u";", u"'", u"", u"ENTER"], [u"SHIFT", u"z", u"x", u"c", u"v", u"b", u"n", u"m", u",", u".", u"/", u"", u"", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE"] ], [ [u"~", u"!", u"@", u"#", u"$", u"%", u"^", u"&", u"*", u"(", u")", u"_", u"+", u"BACKSPACE"], [u"FIRST", u"Q", u"W", u"E", u"R", u"T", u"Y", u"U", u"I", u"O", u"P", u"{", u"}", u"|"], [u"LAST", u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u":", u"\"", u"", u"ENTER"], [u"SHIFT", u"Z", u"X", u"C", u"V", u"B", u"N", u"M", u"<", u">", u"?", u"", u"", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE"] ] ] self.english_EN_US = [ [ [u"`", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"-", u"=", u"BACKSPACE"], [u"FIRST", u"q", u"w", u"e", u"r", u"t", u"y", u"u", u"i", u"o", u"p", u"[", u"]", u"\\"], [u"LAST", u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u";", u"'", u"LongL__ENTER__HIDE", u"LongR__Enter"], [u"LongL__Shift", u"LongR__SHIFT__HIDE", u"z", u"x", u"c", u"v", u"b", u"n", u"m", u",", u".", u"/", u"LongL__SHIFT__HIDE", u"LongR__Shift"], [u"LongL__Esc", u"LongR__ESC__HIDE", u"Loc", u"All", u"LongL__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongR__SPACE__HIDE", u"LEFT", u"RIGHT", u"LongL__CLR__HIDE", u"LongR__Clr"] ], [ [u"~", u"!", u"@", u"#", u"$", u"%", u"^", u"&", u"*", u"(", u")", u"_", u"+", u"BACKSPACE"], [u"FIRST", u"Q", u"W", u"E", u"R", u"T", u"Y", u"U", u"I", u"O", u"P", u"{", u"}", u"|"], [u"LAST", u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u":", u"\"", u"LongL__ENTER__HIDE", u"LongR__Enter"], [u"LongL__Shift", u"LongR__SHIFT__HIDE", u"Z", u"X", u"C", u"V", u"B", u"N", u"M", u"<", u">", u"?", u"LongL__SHIFT__HIDE", u"LongR__Shift"], [u"LongL__Esc", u"LongR__ESC__HIDE", u"Loc", u"All", u"LongL__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongR__SPACE__HIDE", u"LEFT", u"RIGHT", u"LongL__CLR__HIDE", u"LongR__Clr"] ] ] self.french = [ [ [u"\u00B2", u"&", u"\u00E9", u"\"", u"'", u"(", u"-", u"\u00E8", u"_", u"\u00E7", u"\u00E0", u")", u"=", u"BACKSPACE"], [u"FIRST", u"a", u"z", u"e", u"r", u"t", u"y", u"u", u"i", u"o", u"p", u"$", u"[", u"]"], [u"LAST", u"q", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"m", u"\u00F9", u"*", u"ENTER"], [u"SHIFT", u"<", u"w", u"x", u"c", u"v", u"b", u"n", u",", u";", u":", u"!", u"\u20AC", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE", u"#", u"@", u"`"] ], [ [u"", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"\u00B0", u"+", u"BACKSPACE"], [u"FIRST", u"A", u"Z", u"E", u"R", u"T", u"Y", u"U", u"I", u"O", u"P", u"\u00A3", u"{", u"}"], [u"LAST", u"Q", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"M", u"%", u"\u00B5", u"ENTER"], [u"SHIFT", u">", u"W", u"X", u"C", u"V", u"B", u"N", u"?", u".", u"/", u"\u00A7", u"\u00A6", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE", u"~", u"^", u"\\"] ], [ [u"", u"", u"\u00E2", u"\u00EA", u"\u00EE", u"\u00F4", u"\u00FB", u"\u00E4", u"\u00EB", u"\u00EF", u"\u00F6", u"\u00FC", u"", u"BACKSPACE"], [u"FIRST", u"", u"\u00E0", u"\u00E8", u"\u00EC", u"\u00F2", u"\u00F9", u"\u00E1", u"\u00E9", u"\u00ED", u"\u00F3", u"\u00FA", u"", u""], [u"LAST", u"", u"\u00C2", u"\u00CA", u"\u00CE", u"\u00D4", u"\u00DB", u"\u00C4", u"\u00CB", u"\u00CF", u"\u00D6", u"\u00DC", u"", u"ENTER"], [u"SHIFT", u"", u"\u00C0", u"\u00C8", u"\u00CC", u"\u00D2", u"\u00D9", u"\u00C1", u"\u00C9", u"\u00CD", u"\u00D3", u"\u00DA", u"", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE"] ] ] self.german = [ [ [u"", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"\u00DF", u"'", u"BACKSPACE"], [u"FIRST", u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"\u00FC", u"[", u"]"], [u"LAST", u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"\u00F6", u"\u00E4", u"+", U"ENTER"], [u"SHIFT", u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"#", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE", u"|", u"\\", u"\u00B5"] ], [ [u"\u00B0", u"!", u"\"", u"\u00A7", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"?", u"`", u"BACKSPACE"], [u"FIRST", u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"\u00DC", u"{", u"}"], [u"LAST", u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"\u00D6", u"\u00C4", u"*", U"ENTER"], [u"SHIFT", u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"@", U"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE", u"\u20AC", u"\u00B2", u"\u00B3"] ] ] self.latvian = [ [ [u"`", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"-", u"=", u"BACKSPACE"], [u"FIRST", u"q", u"w", u"e", u"r", u"t", u"y", u"u", u"i", u"o", u"p", u"[", u"]", u"\\"], [u"LAST", u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u";", u"'", u"LongL__ENTER__HIDE", u"LongR__Enter"], [u"LongL__Shift", u"LongR__SHIFT__HIDE", u"z", u"x", u"c", u"v", u"b", u"n", u"m", u",", u".", u"/", u"LongL__SHIFT__HIDE", u"LongR__Shift"], [u"LongL__Esc", u"LongR__ESC__HIDE", u"Loc", u"All", u"LongL__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongR__SPACE__HIDE", u"LEFT", u"RIGHT", u"LongL__CLR__HIDE", u"LongR__Clr"] ], [ [u"~", u"!", u"@", u"#", u"$", u"%", u"^", u"&", u"*", u"(", u")", u"_", u"+", u"BACKSPACE"], [u"FIRST", u"Q", u"W", u"E", u"R", u"T", u"Y", u"U", u"I", u"O", u"P", u"{", u"}", u"|"], [u"LAST", u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u":", u"\"", u"LongL__ENTER__HIDE", u"LongR__Enter"], [u"LongL__Shift", u"LongR__SHIFT__HIDE", u"Z", u"X", u"C", u"V", u"B", u"N", u"M", u"<", u">", u"?", u"LongL__SHIFT__HIDE", u"LongR__Shift"], [u"LongL__Esc", u"LongR__ESC__HIDE", u"Loc", u"All", u"LongL__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongR__SPACE__HIDE", u"LEFT", u"RIGHT", u"LongL__CLR__HIDE", u"LongR__Clr"] ], [ [u"\u00b4", u"\u00b9", u"\u00b2", u"\u00b3", u"\u20ac", u"\u00bd", u"\u00be", u"\u007b", u"\u005b", u"\u005d", u"\u007d ", u"\u005c", u"\u2013", u"BACKSPACE"], [u"FIRST", u"q", u"\u0113", u"\u0112", u"\u0157", u"\u0156", u"\u016B", u"\u016A", u"\u012B", u"\u012A", u"\u014D", u"\u014C", u"\u00ab", u"\u00bb"], [u"LAST", u"\u0101", u"\u0100", u"\u0161", u"\u0160", u"\u0123", u"\u0122", u"\u0137", u"\u0136", u"\u013C", u"\u013B", u"\u003b", u"LongL__ENTER__HIDE", u"LongR__Enter"], [u"LongL__Shift", u"LongR__SHIFT__HIDE", u"\u017E", u"\u017D", u"\u010D", u"\u010C", u"b", u"\u0146", u"\u0145", u"\u0060", u"\u00b7", u"\u002f", u"LongL__SHIFT__HIDE", u"LongR__Shift"], [u"LongL__Esc", u"LongR__ESC__HIDE", u"Loc", u"All", u"LongL__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongR__SPACE__HIDE", u"LEFT", u"RIGHT", u"LongL__CLR__HIDE", u"LongR__Clr"] ] ] self.russian = [ [ [u"\u0451", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"-", u"=", u"BACKSPACE"], [u"FIRST", u"\u0439", u"\u0446", u"\u0443", u"\u043A", u"\u0435", u"\u043D", u"\u0433", u"\u0448", u"\u0449", u"\u0437", u"\u0445", u"\u044A", u"\u00A7"], [u"LAST", u"\u0444", u"\u044B", u"\u0432", u"\u0430", u"\u043F", u"\u0440", u"\u043E", u"\u043B", u"\u0434", u"\u0436", u"\u044D", u"\\", u"ENTER"], [u"SHIFT", u"\u044F", u"\u0447", u"\u0441", u"\u043C", u"\u0438", u"\u0442", u"\u044C", u"\u0431", u"\u044E", u".", u"@", u"&", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE", u"<"] ], [ [u"\u0401", u"!", u"\"", u"\u2116", u";", u"%", u":", u"?", u"*", u"(", u")", u"_", u"+", u"BACKSPACE"], [u"FIRST", u"\u0419", u"\u0426", u"\u0423", u"\u041A", u"\u0415", u"\u041D", u"\u0413", u"\u0428", u"\u0429", u"\u0417", u"\u0425", u"\u042A", u"\u20BD"], [u"LAST", u"\u0424", u"\u042B", u"\u0412", u"\u0410", u"\u041F", u"\u0420", u"\u041E", u"\u041B", u"\u0414", u"\u0416", u"\u042D", u"/", u"ENTER"], [u"SHIFT", u"\u042F", u"\u0427", u"\u0421", u"\u041C", u"\u0418", u"\u0422", u"\u042C", u"\u0411", u"\u042E", u",", u"#", u"$", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE", u">"] ] ] self.scandinavian = [ [ [u"\u00A7", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"+", u"@", u"BACKSPACE"], [u"FIRST", u"q", u"w", u"e", u"r", u"t", u"y", u"u", u"i", u"o", u"p", u"\u00E5", u"[", u"]"], [u"LAST", u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"\u00F6", u"\u00E4", u"'", u"ENTER"], [u"SHIFT", u"<", u"z", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"\u00AB", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE"] ], [ [u"\u00BD", u"!", u"\"", u"#", u"\u00A4", u"%", u"&", u"/", u"(", u")", u"=", u"?", u"|", u"BACKSPACE"], [u"FIRST", u"Q", u"W", u"E", u"R", u"T", u"Y", u"U", u"I", u"O", u"P", u"\u00C5", u"{", u"}"], [u"LAST", u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"\u00D6", u"\u00C4", u"*", u"ENTER"], [u"SHIFT", u">", u"Z", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"\u00BB", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE"] ], [ [u"", u"\u00E2", u"\u00EA", u"\u00EE", u"\u00F4", u"\u00FB", u"\u00E4", u"\u00EB", u"\u00EF", u"\u00F6", u"\u00FC", u"\u00E3", u"\u00F5", u"BACKSPACE"], [u"FIRST", u"\u00E0", u"\u00E8", u"\u00EC", u"\u00F2", u"\u00F9", u"\u00E1", u"\u00E9", u"\u00ED", u"\u00F3", u"\u00FA", u"", u"", u""], [u"LAST", u"\u00C2", u"\u00CA", u"\u00CE", u"\u00D4", u"\u00DB", u"\u00C4", u"\u00CB", u"\u00CF", u"\u00D6", u"\u00DC", u"\u00C3", u"\u00D5", u"ENTER"], [u"SHIFT", u"\u00C0", u"\u00C8", u"\u00CC", u"\u00D2", u"\u00D9", u"\u00C1", u"\u00C9", u"\u00CD", u"\u00D3", u"\u00DA", u"", u"", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE"] ] ] self.spanish = [ [ [u"\\", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"'", u"\u00A1", u"BACKSPACE"], [u"FIRST", u"q", u"w", u"e", u"r", u"t", u"y", u"u", u"i", u"o", u"p", u"@", u"+", u"\u00E7"], [u"LAST", u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"\u00F1", u"[", u"]", u"ENTER"], [u"SHIFT", u"<", u"z", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"\u20AC", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE", u"", u"\u00E1", u"\u00E9", u"\u00ED", u"\u00F3", u"\u00FA", u"\u00FC"] ], [ [u"|", u"!", u"\"", u"\u00B7", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"?", u"\u00BF", u"BACKSPACE"], [u"FIRST", u"Q", u"W", u"E", u"R", u"T", u"Y", u"U", u"I", u"O", u"P", u"#", u"*", u"\u00C7"], [u"LAST", u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"\u00D1", u"{", u"}", u"ENTER"], [u"SHIFT", u">", u"Z", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"\u00AC", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE", u"", u"\u00C1", u"\u00C9", u"\u00CD", u"\u00D3", u"\u00DA", u"\u00DC"] ] ] self.locales = { "ar_BH": [_("Arabic"), _("Bahrain"), self.arabic(self.english)], "ar_EG": [_("Arabic"), _("Egypt"), self.arabic(self.english)], "ar_JO": [_("Arabic"), _("Jordan"), self.arabic(self.english)], "ar_KW": [_("Arabic"), _("Kuwait"), self.arabic(self.english)], "ar_LB": [_("Arabic"), _("Lebanon"), self.arabic(self.english)], "ar_OM": [_("Arabic"), _("Oman"), self.arabic(self.english)], "ar_QA": [_("Arabic"), _("Qatar"), self.arabic(self.english)], "ar_SA": [_("Arabic"), _("Saudi Arabia"), self.arabic(self.english)], "ar_SY": [_("Arabic"), _("Syrian Arab Republic"), self.arabic(self.english)], "ar_AE": [_("Arabic"), _("United Arab Emirates"), self.arabic(self.english)], "ar_YE": [_("Arabic"), _("Yemen"), self.arabic(self.english)], "cs_CZ": [_("Czech"), _("Czechia"), [ [ [u";", u"+", u"\u011B", u"\u0161", u"\u010D", u"\u0159", u"\u017E", u"\u00FD", u"\u00E1", u"\u00ED", u"\u00E9", u"=", u"", u"BACKSPACE"], [u"FIRST", u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"\u00FA", u")", u""], [u"LAST", u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"\u016F", u"\u00A7", u"", u"ENTER"], [u"SHIFT", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"\u0148", u"", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"LongL__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongR__SPACE__HIDE", u"ALL", u"CLR", u"DEL"] ], [ [u".", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"%", u"", u"BACKSPACE"], [u"FIRST", u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"/", u"(", u""], [u"LAST", u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"\"", u"!", u"'", u"ENTER"], [u"SHIFT", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u"?", u":", u"_", u"\u0147", u"", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"LongL__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongR__SPACE__HIDE", u"ALL", u"CLR", u"DEL"] ], [ [u"", u"~", u"\u011A", u"\u0160", u"\u010C", u"\u0158", u"\u017D", u"\u00DD", u"\u00C1", u"\u00CD", u"\u00C9", u"`", u"", u"BACKSPACE"], [u"FIRST", u"\\", u"|", u"\u20AC", u"\u0165", u"\u0164", u"", u"", u"", u"\u00F3", u"\u00D3", u"\u00DA", u"\u00F7", u"\u00D7"], [u"LAST", u"", u"\u0111", u"\u00D0", u"[", u"]", u"\u010F", u"\u010E", u"\u0142", u"\u0141", u"\u016E", u"$", u"\u00DF", u"ENTER"], [u"SHIFT", u"", u"#", u"&", u"@", u"{", u"}", u"", u"<", u">", u"*", u"", u"\u00A4", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"LongL__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongM__SPACE__HIDE", u"LongR__SPACE__HIDE", u"ALL", u"CLR", u"DEL"] ] ]], "nl_NL": [_("Dutch"), _("Netherlands"), self.dutch(self.english)], "en_AU": [_("English"), _("Australian"), self.australian(self.english)], "en_GB": [_("English"), _("United Kingdom"), self.unitedKingdom(self.english)], "en_US": [_("English"), _("United States"), self.english_EN_US], "en_EN": [_("English"), _("Various"), self.english_EN_US], "et_EE": [_("Estonian"), _("Estonia"), self.estonian(self.scandinavian)], "fi_FI": [_("Finnish"), _("Finland"), self.finnish(self.scandinavian)], "fr_BE": [_("French"), _("Belgian"), self.belgian(self.french)], "fr_FR": [_("French"), _("France"), self.french], "de_CH": [_("German"), _("Switzerland"), self.swiss(self.german)], "de_DE": [_("German"), _("Germany"), self.german], "el_GR": [_("Greek (Modern)"), _("Greece"), [ [ [u"`", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"-", u"=", u"BACKSPACE"], [u"FIRST", u";", u"\u03C2", u"\u03B5", u"\u03C1", u"\u03C4", u"\u03C5", u"\u03B8", u"\u03B9", u"\u03BF", u"\u03C0", u"[", u"]", u"/"], [u"LAST", u"\u03B1", u"\u03C3", u"\u03B4", u"\u03C6", u"\u03B3", u"\u03B7", u"\u03BE", u"\u03BA", u"\u03BB", u"", u"'", u"\\", u"ENTER"], [u"SHIFT", u"<", u"\u03B6", u"\u03C7", u"\u03C8", u"\u03C9", u"\u03B2", u"\u03BD", u"\u03BC", u",", ".", u"\u03CA", u"\u03CB", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE", u"\u03AC", u"\u03AD", u"\u03AE", u"\u03AF", u"\u03CC", u"\u03CD", u"\u03CE"] ], [ [u"~", u"!", u"@", u"#", u"$", u"%", u"^", u"&", u"*", u"(", u")", u"_", u"+", u"BACKSPACE"], [u"FIRST", u":", u"", u"\u0395", u"\u03A1", u"\u03A4", u"\u03A5", u"\u0398", u"\u0399", u"\u039F", u"\u03A0", u"{", u"}", u"?"], [u"LAST", u"\u0391", u"\u03A3", u"\u0394", u"\u03A6", u"\u0393", u"\u0397", u"\u039E", u"\u039A", u"\u039B", u"", u"\"", u"|", u"ENTER"], [u"SHIFT", u">", u"\u0396", u"\u03A7", u"\u03A8", u"\u03A9", u"\u0392", u"\u039D", u"\u039C", u"<", u">", u"\u03AA", u"\u03AB", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE", u"\u0386", u"\u0388", u"\u0389", u"\u038A", u"\u038C", u"\u038E", u"\u038F"] ], [ [u"", u"", u"\u00B2", u"\u00B3", u"\u00A3", u"\u00A7", u"\u00B6", u"\u20AC", u"\u00A4", u"\u00A6", u"\u00B0", u"\u00B1", u"\u00BD", u"BACKSPACE"], [u"FIRST", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"", u""], [u"LAST", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"ENTER"], [u"SHIFT", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE"] ] ]], "lv_LV": [_("Latvian"), _("Latvia"), self.latvian], "lt_LT": [_("Lithuanian"), _("Lithuania"), self.lithuanian(self.english)], "nb_NO": [_("Norwegian"), _("Norway"), self.norwegian(self.scandinavian)], "fa_IR": [_("Persian"), _("Iran, Islamic Republic"), self.persian(self.english)], "pl_PL": [_("Polish"), _("Poland"), self.polish(self.english)], "ru_RU": [_("Russian"), _("Russian Federation"), self.russian], "sk_SK": [_("Slovak"), _("Slovakia"), [ [ [u"~", u"!", u"@", u"#", u"$", u"%", u"^", u"&", u"*", u"(", u")", u"\u00E1", u"\u00E4", u"BACKSPACE"], [u"FIRST", u"q", u"w", u"e", u"r", u"t", u"y", u"u", u"i", u"o", u"p", u"\u010D", u"\u010F", u"\u00E9"], [u"LAST", u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"\u00ED", u"\u013A", u"\u013E", u"ENTER"], [u"SHIFT", u"<", u"z", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"\u0148", u"\u00F3", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE", u"\u00F4", u"\u0155", u"\u0161", u"\u0165", u"\u00FA", u"\u00FD", u"\u017E"] ], [ [u"`", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"\u00C1", u"\u00C4", u"BACKSPACE"], [u"FIRST", u"Q", u"W", u"E", u"R", u"T", u"Y", u"U", u"I", u"O", u"P", u"\u010C", u"\u010E", u"\u00C9"], [u"LAST", u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"\u00CD", u"\u0139", u"\u013D", u"ENTER"], [u"SHIFT", u">", u"Z", u"X", u"C", u"V", u"B", u"N", u"M", u"?", u":", u"\u0147", u"\u00D3", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE", u"\u00D4", u"\u0154", u"\u0160", u"\u0164", u"\u00DA", u"\u00DD", u"\u017D"] ], [ [u"", u"", u"\u00A7", u"\u00B0", u"\u00A4", u"\u20AC", u"\u00DF", u"\u0111", u"\u0110", u"\u0142", u"\u0141", u"", u"", u"BACKSPACE"], [u"FIRST", u"", u"", u"'", u"\"", u"+", u"-", u"\u00D7", u"\u00F7", u"=", u"_", u"~", u"", u""], [u"LAST", u"", u"", u"/", u"\\", u";", u"[", u"]", u"{", u"}", u"|", u"", u"", u"ENTER"], [u"SHIFT", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE"] ] ]], "es_ES": [_("Spanish"), _("Spain"), self.spanish], "sv_SE": [_("Swedish"), _("Sweden"), self.swedish(self.scandinavian)], "th_TH": [_("Thai"), _("Thailand"), [ [ [u"", u"", u"\u0E45", u"\u0E20", u"\u0E16", u"\u0E38", u"\u0E36", u"\u0E04", u"\u0E15", u"\u0E08", u"\u0E02", u"\u0E0A", u"", u"BACKSPACE"], [u"FIRST", u"\u0E46", u"\u0E44", u"\u0E33", u"\u0E1E", u"\u0E30", u"\u0E31", u"\u0E35", u"\u0E23", u"\u0E19", u"\u0E22", u"\u0E1A", u"\u0E25", u""], [u"LAST", u"\u0E1F", u"\u0E2B", u"\u0E01", u"\u0E14", u"\u0E40", u"\u0E49", u"\u0E48", u"\u0E32", u"\u0E2A", u"\u0E27", u"\u0E07", u"\u0E03", u"OK"], [u"SHIFT", u"\u0E1C", u"\u0E1B", u"\u0E41", u"\u0E2D", u"\u0E34", u"\u0E37", u"\u0E17", u"\u0E21", u"\u0E43", u"\u0E1D", u"", u"", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE"] ], [ [u"", u"", u"\u0E51", u"\u0E52", u"\u0E53", u"\u0E54", u"\u0E39", u"\u0E55", u"\u0E56", u"\u0E57", u"\u0E58", u"\u0E59", u"", u"BACKSPACE"], [u"FIRST", u"\u0E50", u"", u"\u0E0E", u"\u0E11", u"\u0E18", u"\u0E4D", u"\u0E4A", u"\u0E13", u"\u0E2F", u"\u0E0D", u"\u0E10", u"\u0E05", u""], [u"LAST", u"\u0E24", u"\u0E06", u"\u0E0F", u"\u0E42", u"\u0E0C", u"\u0E47", u"\u0E4B", u"\u0E29", u"\u0E28", u"\u0E0B", u"", u"\u0E3F", u"OK"], [u"SHIFT", u"", u"", u"\u0E09", u"\u0E2E", u"\u0E3A", u"\u0E4C", u"", u"\u0E12", u"\u0E2C", u"\u0E26", u"", u"", u"SHIFT"], [u"EXIT", u"LOC", u"LEFT", u"RIGHT", u"ALL", u"CLR", u"SPACE"] ] ]], "uk_UA": [_("Ukrainian"), _("Ukraine"), self.ukranian(self.russian)] } self["actions"] = HelpableNumberActionMap(self, "VirtualKeyBoardActions", { "cancel": (self.cancel, _("Cancel any text changes and exit")), "save": (self.enter, _("Enter text and exit")), "locale": (self.localeMenu, _("Select the virtual keyboard locale from a menu")), "shift": (self.shiftClicked, _("Select the virtual keyboard shifted character set")), "select": (self.processSelect, _("Select the character or action under the virtual keyboard cursor")), "up": (self.up, _("Move the virtual keyboard cursor up")), "left": (self.left, _("Move the virtual keyboard cursor left")), "right": (self.right, _("Move the virtual keyboard cursor right")), "down": (self.down, _("Move the virtual keyboard cursor down")), "first": (self.cursorFirst, _("Move the text buffer cursor to the first character")), "prev": (self.cursorLeft, _("Move the text buffer cursor left")), "next": (self.cursorRight, _("Move the text buffer cursor right")), "last": (self.cursorLast, _("Move the text buffer cursor to the last character")), "toggleOverwrite": (self.keyToggleOW, _("Toggle new text inserts before or overwrites existing text")), "backspace": (self.backClicked, _("Delete the character to the left of text buffer cursor")), "delete": (self.forwardClicked, _("Delete the character under the text buffer cursor")), "1": (self.keyNumberGlobal, _("Number or SMS style data entry")), "2": (self.keyNumberGlobal, _("Number or SMS style data entry")), "3": (self.keyNumberGlobal, _("Number or SMS style data entry")), "4": (self.keyNumberGlobal, _("Number or SMS style data entry")), "5": (self.keyNumberGlobal, _("Number or SMS style data entry")), "6": (self.keyNumberGlobal, _("Number or SMS style data entry")), "7": (self.keyNumberGlobal, _("Number or SMS style data entry")), "8": (self.keyNumberGlobal, _("Number or SMS style data entry")), "9": (self.keyNumberGlobal, _("Number or SMS style data entry")), "0": (self.keyNumberGlobal, _("Number or SMS style data entry")), "gotAsciiCode": (self.keyGotAscii, _("Keyboard data entry")) }, -2, description=_("Virtual KeyBoard Functions")) self.lang = language.getLanguage() self["prompt"] = Label(prompt) self["text"] = Input(text=text, maxSize=maxSize, visible_width=visible_width, type=type, currPos=len(text.decode("utf-8", "ignore")), allMarked=allMarked) self["list"] = VirtualKeyBoardList([]) self["mode"] = Label(_("INS")) self["locale"] = Label(_("Locale") + ": " + self.lang) self["language"] = Label(_("Language") + ": " + self.lang) self["key_info"] = StaticText(_("INFO")) self["key_red"] = StaticText(_("Exit")) self["key_green"] = StaticText(_("Enter")) self["key_yellow"] = StaticText(_("Select locale")) self["key_blue"] = StaticText(self.shiftMsgs[1]) self["key_help"] = StaticText(_("HELP")) width, self.height = skin.parameters.get("VirtualKeyBoard", (45, 45)) self.width = self.key_bg and self.key_bg.size().width() or width self.shiftColors = skin.parameters.get("VirtualKeyBoardShiftColors", (0x00ffffff, 0x00ffffff, 0x0000ffff, 0x00ff00ff)) # Ensure there is a color for each shift level! self.language = None self.location = None self.keyList = [] self.previousSelectedKey = [] self.shiftLevels = 0 self.shiftLevel = 0 self.keyboardWidth = 0 self.keyboardHeight = 0 self.maxKey = 0 self.overwrite = False self.selectedKey = None self.sms = NumericalTextInput(self.smsGotChar) self.smsChar = None self.setLocale() self.onExecBegin.append(self.setKeyboardModeAscii) self.onLayoutFinish.append(self.buildVirtualKeyBoard)
def __init__(self, text="", maxSize=False, visible_width=False, type=Input.TEXT): Input.__init__(self, text, maxSize, visible_width, type)
def __init__(self, text="", maxSize=False, visible_width=False, type=Input.TEXT): Input.__init__(self, text, maxSize, visible_width, type)
def __init__(self, session, args=0): global x, y self.skin = dreamIRCMainMenu.skin Screen.__init__(self, session) self.menu = args self.pipe = MessagePipe() self.account = AccountManager(self.session) self.list = [] self.menuList = [] self.connected = False self["buddy"] = BuddyWindow("") self["chat"] = ChatWindow("") self["input"] = Input("") self["buddy.desc"] = Label(_("User Online")) self["input.desc"] = Label( _("Type your text here and press OK to send:")) self["chat.desc"] = ChanName(_("ChatBox")) self["connect.desc"] = Label(_("Connect")) self["disconnect.desc"] = Label(_("Disconnect")) self["settings.desc"] = Label(_("Settings")) if y >= 720: self["blue.desc"] = Label(_("virtual Keyboard")) else: self["blue.desc"] = Label(_("virtual Keyb.")) self["green.pic"] = Pixmap() self["red.pic"] = Pixmap() self["yellow.pic"] = Pixmap() self["blue.pic"] = Pixmap() self["actions"] = NumberActionMap( [ "dreamIRCActions", "InputBoxActions", "InputAsciiActions", "KeyboardInputActions" ], { "gotAsciiCode": self.gotAsciiCode, "red": self.redPressed, "green": self.greenPressed, "yellow": self.yellowPressed, "blue": self.bluePressed, "ok": self.go, "cancel": self.closePlugin, "back": self.closePlugin, "right": self.keyRight, "left": self.keyLeft, "up": self["chat"].pageUp, "down": self["chat"].pageDown, "buddyUp": self["buddy"].pageUp, "buddyDown": self["buddy"].pageDown, "home": self.keyHome, "end": self.keyEnd, "delete": self.keyDelete, "deleteForward": self.keyDeleteForward, "deleteBackward": self.keyDeleteBackward, "tab": self.keyTab, "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) rcinput = eRCInput.getInstance() rcinput.setKeyboardMode(rcinput.kmAscii) self.checkStatus()
def __init__(self, *args, **kwargs): self.e2iTimeoutCallback = None Input.__init__(self, *args, **kwargs)
def __init__(self, session, title='', **kwargs): Screen.__init__(self, session) self.setTitle(_('Virtual keyboard')) self.keys_list = [] self.shiftkeys_list = [] self.lang = language.getLanguage() self.nextLang = None self.shiftMode = False self.selectedKey = 0 self.smsChar = None self.sms = NumericalTextInput(self.smsOK) self.key_bg = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/vkey_bg.png')) self.key_sel = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/vkey_sel.png')) self.key_backspace = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/vkey_backspace.png')) self.key_all = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/vkey_all.png')) self.key_clr = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/vkey_clr.png')) self.key_esc = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/vkey_esc.png')) self.key_ok = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/vkey_ok.png')) self.key_shift = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/vkey_shift.png')) self.key_shift_sel = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/vkey_shift_sel.png')) self.key_space = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/vkey_space.png')) self.key_left = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/vkey_left.png')) self.key_right = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/vkey_right.png')) self.keyImages = { 'BACKSPACE': self.key_backspace, 'ALL': self.key_all, 'EXIT': self.key_esc, 'OK': self.key_ok, 'SHIFT': self.key_shift, 'SPACE': self.key_space, 'LEFT': self.key_left, 'RIGHT': self.key_right } self.keyImagesShift = { 'BACKSPACE': self.key_backspace, 'CLEAR': self.key_clr, 'EXIT': self.key_esc, 'OK': self.key_ok, 'SHIFT': self.key_shift_sel, 'SPACE': self.key_space, 'LEFT': self.key_left, 'RIGHT': self.key_right } self['country'] = StaticText('') self['header'] = Label(title) self['text'] = Input(currPos=len( kwargs.get('text', '').decode('utf-8', 'ignore')), allMarked=False, **kwargs) self['list'] = VirtualKeyBoardList([]) self['actions'] = NumberActionMap( [ 'OkCancelActions', 'WizardActions', 'ColorActions', 'KeyboardInputActions', 'InputBoxActions', 'InputAsciiActions' ], { 'gotAsciiCode': self.keyGotAscii, 'ok': self.okClicked, 'cancel': self.exit, 'left': self.left, 'right': self.right, 'up': self.up, 'down': self.down, 'red': self.exit, 'green': self.ok, 'yellow': self.switchLang, 'blue': self.shiftClicked, 'deleteBackward': self.backClicked, 'deleteForward': self.forwardClicked, 'back': self.exit, 'pageUp': self.cursorRight, 'pageDown': self.cursorLeft, '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 }, -2) self.setLang() self.onExecBegin.append(self.setKeyboardModeAscii) self.onLayoutFinish.append(self.buildVirtualKeyBoard) self.onClose.append(self.__onClose)
def __init__(self, session, fullscreen = False, url = None, isHbbtv = False, isTransparent = False, hbbtvMenu = None): size = getDesktop(0).size() width = int(size.width() * 0.9) fwidth = int(size.width()) height = int(size.height() * 0.85) fheight = int(size.height()) Browser.skin = """ <screen name="Browser" position="center,center" size="%(w)d,%(h)d" title="Web Browser" backgroundColor="#FF000000"> <widget name="cursor" position="0,0" size="19,30" zPosition="1" alphatest="on"/> <widget name="url" position="0,0" zPosition="2" size="%(w)d,25" font="Regular;20" halign="left" valign="bottom" backgroundColor="background"/> <widget name="loading" position="%(loadingX)d,0" zPosition="3" size="150,25" font="Regular;20" halign="right" valign="bottom" backgroundColor="background"/> <widget name="urlList" position="0,30" zPosition="2" size="%(w)d,150" backgroundColor="background"/> <widget name="text" position="%(textX)d,100" size="350,40" font="Regular;20" zPosition="2" halign="center" valign="center" backgroundColor="background"/> <widget source="webnavigation" render="WebView" position="0,25" zPosition="0" size="%(w)d,%(mainH)d" transparent="1"/> <widget source="canvas" render="Canvas" position="0,25" zPosition="1" size="%(w)d,%(mainH)d" backgroundColor="#FF000000" transparent="1" alphatest="on"/> <group name="_buttonBar"> <widget name="buttonBar" position="0,%(btnBarY)d" size="%(w)d,30" zPosition="0" backgroundColor="background" transparent="0" /> <ePixmap pixmap="skin_default/buttons/button_red_off.png" position="5,%(btnY)d" size="15,16" alphatest="on" /> <widget source="button_red" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_red.png" position="5,%(btnY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="red" position="25,%(btnTxtY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1" /> <ePixmap pixmap="skin_default/buttons/button_green_off.png" position="195,%(btnY)d" size="15,16" alphatest="on" /> <widget source="button_green" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_green.png" position="195,%(btnY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="green" position="215,%(btnTxtY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> <ePixmap pixmap="skin_default/buttons/button_yellow_off.png" position="385,%(btnY)d" size="15,16" alphatest="on" /> <widget source="button_yellow" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_yellow.png" position="385,%(btnY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="yellow" position="405,%(btnTxtY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> <ePixmap pixmap="skin_default/buttons/button_blue_off.png" position="585,%(btnY)d" size="15,16" alphatest="on" /> <widget source="button_blue" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_blue.png" position="585,%(btnY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="blue" position="605,%(btnTxtY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> </group> <widget name="statuslabel" position="%(notifX)d,%(btnTxtY)d" size="350,20" font="Regular;18" zPosition="3" halign="right" valign="center" backgroundColor="background" /> </screen> """ %{ "w" : width, "h" : height, "loadingX" : width-150, "textX" : (width - 375) / 2, "mainH" : height-55, "btnY" : height-22, "btnTxtY" : height-24, "btnBarY" : height - 30, "notifX" : width-350 } Browser.skinFullscreen = """ <screen name="BrowserFullscreen" flags="wfNoBorder" position="center,center" size="%(w)d,%(h)d" title="Web Browser" backgroundColor="#FF000000"> <widget name="cursor" position="0,0" size="19,30" zPosition="1" alphatest="on"/> <widget name="url" position="75,75" zPosition="2" size="%(urlW)d,25" font="Regular;20" halign="left" valign="bottom" backgroundColor="background"/> <widget name="loading" position="%(loadingX)d,%(loadingY)d" zPosition="2" size="200,50" font="Regular;20" halign="center" valign="center" backgroundColor="background"/> <widget name="urlList" position="75,100" zPosition="2" size="%(urlW)d,150" backgroundColor="background" transparent="0" /> <widget name="text" position="%(textX)d,100" size="350,40" font="Regular;20" zPosition="2" halign="center" valign="center" backgroundColor="background" transparent="0" /> <widget source="webnavigation" render="WebView" position="0,0" zPosition="0" size="%(w)d,%(h)d" transparent="1"/> <widget source="canvas" render="Canvas" position="0,0" zPosition="1" size="%(w)d,%(h)d" backgroundColor="#FF000000" transparent="1" alphatest="on"/> <group name="_buttonBar"> <widget name="buttonBar" position="%(btnBarX)d,%(btnBarY)d" size="200,110" zPosition="0" backgroundColor="background" transparent="0" /> <widget source="button_red_off" render="Pixmap" pixmap="skin_default/buttons/button_red_off.png" position="%(btnX)d,%(btnRedY)d" size="15,16" zPosition="1" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget source="button_red" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_red.png" position="%(btnX)d,%(btnRedY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="red" position="%(btnTxtX)d,%(btnRedY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> <widget source="button_green_off" render="Pixmap" pixmap="skin_default/buttons/button_green_off.png" position="%(btnX)d,%(btnGreenY)d" size="15,16" zPosition="1" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget source="button_green" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_green.png" position="%(btnX)d,%(btnGreenY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="green" position="%(btnTxtX)d,%(btnGreenY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> <widget source="button_yellow_off" render="Pixmap" pixmap="skin_default/buttons/button_yellow_off.png" position="%(btnX)d,%(btnYellowY)d" size="15,16" zPosition="1" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget source="button_yellow" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_yellow.png" position="%(btnX)d,%(btnYellowY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="yellow" position="%(btnTxtX)d,%(btnYellowY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> <widget source="button_blue_off" render="Pixmap" pixmap="skin_default/buttons/button_blue_off.png" position="%(btnX)d,%(btnBlueY)d" size="15,16" zPosition="1" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget source="button_blue" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_blue.png" position="%(btnX)d,%(btnBlueY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="blue" position="%(btnTxtX)d,%(btnBlueY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> </group> <widget name="statuslabel" position="%(notifX)d,%(loadingY)d" size="350,50" zPosition="1" font="Regular;18" halign="center" valign="center" backgroundColor="background" transparent="0" /> </screen> """ %{ "w" : fwidth, "h" : fheight, "urlW": fwidth - 150, "loadingY" : fheight - 125, "loadingX" : ( fwidth / 2 ) - 75, "textX" : (fwidth - 375) / 2, "mainH" : fheight-55, "btnBarX": fwidth - 75 - 200, "btnBarY": fheight - 75 - 108, "btnX" : fwidth - 75 - 190, "btnTxtX" : fwidth - 75 - 165, "btnRedY" : fheight - 75 - 100, "btnGreenY" : fheight - 75 - 75, "btnYellowY" : fheight - 75 - 50, "btnBlueY" : fheight - 75 - 25, "notifX" : ( fwidth / 2 ) - 175, } self.__isHbbtv = isHbbtv if self.__isHbbtv: isTransparent = fullscreen = True self.__hbbtvMenu = hbbtvMenu self.__isTransparent = isTransparent self.__fullscreen = fullscreen if self.__fullscreen: Browser.skin = Browser.skinFullscreen Screen.__init__(self, session) HelpableScreen.__init__(self) if self.__fullscreen: self.skinName = "BrowserFullscreen" self.__startUrl = url self["loading"] = Label("") self.urlInput = EnhancedInput() self["url"] = self.urlInput self.textInput = Input() self["text"] = self.textInput self.textInput.hide() self.statuslabel = Label("") self["statuslabel"] = self.statuslabel self.statuslabel.hide(); self.urlInputEnabled = False self.webnavigation = WebNavigation() self.webnavigation.zoomFactor = 1.0 self.__onStoragePathChanged() self["webnavigation"] = self.webnavigation self.__urlList = MenuList([], enableWrapAround = True, content = eListboxPythonStringContent) self["urlList"] = self.__urlList self.canvas = CanvasSource() self["canvas"] = self.canvas self["buttonBar"] = Label("") self["button_red_off"] = Boolean(True) self["button_green_off"] = Boolean(True) self["button_yellow_off"] = Boolean(True) self["button_blue_off"] = Boolean(True) self["button_red"] = Boolean(True) self["button_green"] = Boolean(False) self["button_yellow"] = Boolean(True) self["button_blue"] = Boolean(True) self["red"] = Label(_("Mouse Off")) self["green"] = Label("") self["yellow"] = Label(_("Navigation")) self["blue"] = Label(_("Pagescroll")) self["cursor"] = Pixmap() self.__cursorPos = ePoint(50,50) self.__mouseMode = False self.__db = BrowserDB.getInstance() self.pageTitle = "" self.__urlSuggestionTimer = eTimer() self.__urlSuggestionTimer_conn = self.__urlSuggestionTimer.timeout.connect(self.__onSuggestionTimeout) self.__inputTimer = eTimer() self.__inputTimer_conn = self.__inputTimer.timeout.connect(self.onInputTimer) self.__statusTimer = eTimer() self.__statusTimer_conn = self.__statusTimer.timeout.connect(self.__hideStatus) self.__scrollMode = False self.__zoomMode = False self.__isInput = False self.__hasSslErrors = False self.__handledUnsupportedContent = False self.__currentPEM = None self.__currentUser = None self.__currentPass = None self.__currentRealm = None self.__keyboardMode = eRCInput.getInstance().getKeyboardMode() self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onExecEnd = [] self.onPageLoadFinished = [] self.onActionTv = [] self.onActionRecord = [] self.onUrlChanged = [] self["helpableactions"] = HelpableActionMap(self, "BrowserActions", { "exit": (self.__actionExit, _("Close the browser")), "url": (self.__actionEnterUrl, _("Enter web address or search term")), "back": self.__actionBack, "forward": self.__actionForward, "left": self.__actionLeft, "right": self.__actionRight, "up": self.__actionUp, "down": self.__actionDown, "pageUp": (self.__actionPageUp, _("Page Up / Zoom in")), "pageDown": (self.__actionPageDown, _("Page Down / Zoom out")), "seekBack": boundFunction(self.__actionNavigate, eWebView.navMediaRewind), "seekFwd": boundFunction(self.__actionNavigate, eWebView.navMediaFastForward), "tab": (boundFunction(self.__actionNavigate, eWebView.navTab), _("Tab")), "backspace": (self.__actionBackspace, _("Backspace / Navigate back")), "backtab": boundFunction(self.__actionNavigate, eWebView.navBacktab), "delete": (self.__actionDelete, _("Delete / Navigate forward")), "ascii": self.__actionAscii, "text" : (self.__actionVirtualAscii, _("Open Virtual Keyboard")), "ok" : self.__actionOk, "enter" : self.__actionEnter, "menu" : (self.__actionMenu, _("Menu")), "fullscreen" : self.__actionFullscreen, "play" : self.__actionPlay, "pause" : self.__actionPause, "playpause" : self.__actionPlayPause, "stop" : self.actionStop, "tv" : self.__actionTv, "record" : self.__actionRecord, }, -2) self["coloractions"] = ActionMap(["ColorActions"], { "red" : self.__actionRed, "green" : self.__actionGreen, "yellow" : self.__actionYellow, "blue" : self.__actionBlue, }) 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 })
class Browser(Screen, HelpableScreen): def __init__(self, session, fullscreen = False, url = None, isHbbtv = False, isTransparent = False, hbbtvMenu = None): size = getDesktop(0).size() width = int(size.width() * 0.9) fwidth = int(size.width()) height = int(size.height() * 0.85) fheight = int(size.height()) Browser.skin = """ <screen name="Browser" position="center,center" size="%(w)d,%(h)d" title="Web Browser" backgroundColor="#FF000000"> <widget name="cursor" position="0,0" size="19,30" zPosition="1" alphatest="on"/> <widget name="url" position="0,0" zPosition="2" size="%(w)d,25" font="Regular;20" halign="left" valign="bottom" backgroundColor="background"/> <widget name="loading" position="%(loadingX)d,0" zPosition="3" size="150,25" font="Regular;20" halign="right" valign="bottom" backgroundColor="background"/> <widget name="urlList" position="0,30" zPosition="2" size="%(w)d,150" backgroundColor="background"/> <widget name="text" position="%(textX)d,100" size="350,40" font="Regular;20" zPosition="2" halign="center" valign="center" backgroundColor="background"/> <widget source="webnavigation" render="WebView" position="0,25" zPosition="0" size="%(w)d,%(mainH)d" transparent="1"/> <widget source="canvas" render="Canvas" position="0,25" zPosition="1" size="%(w)d,%(mainH)d" backgroundColor="#FF000000" transparent="1" alphatest="on"/> <group name="_buttonBar"> <widget name="buttonBar" position="0,%(btnBarY)d" size="%(w)d,30" zPosition="0" backgroundColor="background" transparent="0" /> <ePixmap pixmap="skin_default/buttons/button_red_off.png" position="5,%(btnY)d" size="15,16" alphatest="on" /> <widget source="button_red" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_red.png" position="5,%(btnY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="red" position="25,%(btnTxtY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1" /> <ePixmap pixmap="skin_default/buttons/button_green_off.png" position="195,%(btnY)d" size="15,16" alphatest="on" /> <widget source="button_green" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_green.png" position="195,%(btnY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="green" position="215,%(btnTxtY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> <ePixmap pixmap="skin_default/buttons/button_yellow_off.png" position="385,%(btnY)d" size="15,16" alphatest="on" /> <widget source="button_yellow" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_yellow.png" position="385,%(btnY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="yellow" position="405,%(btnTxtY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> <ePixmap pixmap="skin_default/buttons/button_blue_off.png" position="585,%(btnY)d" size="15,16" alphatest="on" /> <widget source="button_blue" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_blue.png" position="585,%(btnY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="blue" position="605,%(btnTxtY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> </group> <widget name="statuslabel" position="%(notifX)d,%(btnTxtY)d" size="350,20" font="Regular;18" zPosition="3" halign="right" valign="center" backgroundColor="background" /> </screen> """ %{ "w" : width, "h" : height, "loadingX" : width-150, "textX" : (width - 375) / 2, "mainH" : height-55, "btnY" : height-22, "btnTxtY" : height-24, "btnBarY" : height - 30, "notifX" : width-350 } Browser.skinFullscreen = """ <screen name="BrowserFullscreen" flags="wfNoBorder" position="center,center" size="%(w)d,%(h)d" title="Web Browser" backgroundColor="#FF000000"> <widget name="cursor" position="0,0" size="19,30" zPosition="1" alphatest="on"/> <widget name="url" position="75,75" zPosition="2" size="%(urlW)d,25" font="Regular;20" halign="left" valign="bottom" backgroundColor="background"/> <widget name="loading" position="%(loadingX)d,%(loadingY)d" zPosition="2" size="200,50" font="Regular;20" halign="center" valign="center" backgroundColor="background"/> <widget name="urlList" position="75,100" zPosition="2" size="%(urlW)d,150" backgroundColor="background" transparent="0" /> <widget name="text" position="%(textX)d,100" size="350,40" font="Regular;20" zPosition="2" halign="center" valign="center" backgroundColor="background" transparent="0" /> <widget source="webnavigation" render="WebView" position="0,0" zPosition="0" size="%(w)d,%(h)d" transparent="1"/> <widget source="canvas" render="Canvas" position="0,0" zPosition="1" size="%(w)d,%(h)d" backgroundColor="#FF000000" transparent="1" alphatest="on"/> <group name="_buttonBar"> <widget name="buttonBar" position="%(btnBarX)d,%(btnBarY)d" size="200,110" zPosition="0" backgroundColor="background" transparent="0" /> <widget source="button_red_off" render="Pixmap" pixmap="skin_default/buttons/button_red_off.png" position="%(btnX)d,%(btnRedY)d" size="15,16" zPosition="1" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget source="button_red" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_red.png" position="%(btnX)d,%(btnRedY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="red" position="%(btnTxtX)d,%(btnRedY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> <widget source="button_green_off" render="Pixmap" pixmap="skin_default/buttons/button_green_off.png" position="%(btnX)d,%(btnGreenY)d" size="15,16" zPosition="1" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget source="button_green" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_green.png" position="%(btnX)d,%(btnGreenY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="green" position="%(btnTxtX)d,%(btnGreenY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> <widget source="button_yellow_off" render="Pixmap" pixmap="skin_default/buttons/button_yellow_off.png" position="%(btnX)d,%(btnYellowY)d" size="15,16" zPosition="1" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget source="button_yellow" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_yellow.png" position="%(btnX)d,%(btnYellowY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="yellow" position="%(btnTxtX)d,%(btnYellowY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> <widget source="button_blue_off" render="Pixmap" pixmap="skin_default/buttons/button_blue_off.png" position="%(btnX)d,%(btnBlueY)d" size="15,16" zPosition="1" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget source="button_blue" zPosition="2" render="Pixmap" pixmap="skin_default/buttons/button_blue.png" position="%(btnX)d,%(btnBlueY)d" size="15,16" alphatest="on"> <convert type="ConditionalShowHide" /> </widget> <widget name="blue" position="%(btnTxtX)d,%(btnBlueY)d" size="160,25" zPosition="1" font="Regular;18" halign="left" valign="top" backgroundColor="background" transparent="1"/> </group> <widget name="statuslabel" position="%(notifX)d,%(loadingY)d" size="350,50" zPosition="1" font="Regular;18" halign="center" valign="center" backgroundColor="background" transparent="0" /> </screen> """ %{ "w" : fwidth, "h" : fheight, "urlW": fwidth - 150, "loadingY" : fheight - 125, "loadingX" : ( fwidth / 2 ) - 75, "textX" : (fwidth - 375) / 2, "mainH" : fheight-55, "btnBarX": fwidth - 75 - 200, "btnBarY": fheight - 75 - 108, "btnX" : fwidth - 75 - 190, "btnTxtX" : fwidth - 75 - 165, "btnRedY" : fheight - 75 - 100, "btnGreenY" : fheight - 75 - 75, "btnYellowY" : fheight - 75 - 50, "btnBlueY" : fheight - 75 - 25, "notifX" : ( fwidth / 2 ) - 175, } self.__isHbbtv = isHbbtv if self.__isHbbtv: isTransparent = fullscreen = True self.__hbbtvMenu = hbbtvMenu self.__isTransparent = isTransparent self.__fullscreen = fullscreen if self.__fullscreen: Browser.skin = Browser.skinFullscreen Screen.__init__(self, session) HelpableScreen.__init__(self) if self.__fullscreen: self.skinName = "BrowserFullscreen" self.__startUrl = url self["loading"] = Label("") self.urlInput = EnhancedInput() self["url"] = self.urlInput self.textInput = Input() self["text"] = self.textInput self.textInput.hide() self.statuslabel = Label("") self["statuslabel"] = self.statuslabel self.statuslabel.hide(); self.urlInputEnabled = False self.webnavigation = WebNavigation() self.webnavigation.zoomFactor = 1.0 self.__onStoragePathChanged() self["webnavigation"] = self.webnavigation self.__urlList = MenuList([], enableWrapAround = True, content = eListboxPythonStringContent) self["urlList"] = self.__urlList self.canvas = CanvasSource() self["canvas"] = self.canvas self["buttonBar"] = Label("") self["button_red_off"] = Boolean(True) self["button_green_off"] = Boolean(True) self["button_yellow_off"] = Boolean(True) self["button_blue_off"] = Boolean(True) self["button_red"] = Boolean(True) self["button_green"] = Boolean(False) self["button_yellow"] = Boolean(True) self["button_blue"] = Boolean(True) self["red"] = Label(_("Mouse Off")) self["green"] = Label("") self["yellow"] = Label(_("Navigation")) self["blue"] = Label(_("Pagescroll")) self["cursor"] = Pixmap() self.__cursorPos = ePoint(50,50) self.__mouseMode = False self.__db = BrowserDB.getInstance() self.pageTitle = "" self.__urlSuggestionTimer = eTimer() self.__urlSuggestionTimer_conn = self.__urlSuggestionTimer.timeout.connect(self.__onSuggestionTimeout) self.__inputTimer = eTimer() self.__inputTimer_conn = self.__inputTimer.timeout.connect(self.onInputTimer) self.__statusTimer = eTimer() self.__statusTimer_conn = self.__statusTimer.timeout.connect(self.__hideStatus) self.__scrollMode = False self.__zoomMode = False self.__isInput = False self.__hasSslErrors = False self.__handledUnsupportedContent = False self.__currentPEM = None self.__currentUser = None self.__currentPass = None self.__currentRealm = None self.__keyboardMode = eRCInput.getInstance().getKeyboardMode() self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onExecEnd = [] self.onPageLoadFinished = [] self.onActionTv = [] self.onActionRecord = [] self.onUrlChanged = [] self["helpableactions"] = HelpableActionMap(self, "BrowserActions", { "exit": (self.__actionExit, _("Close the browser")), "url": (self.__actionEnterUrl, _("Enter web address or search term")), "back": self.__actionBack, "forward": self.__actionForward, "left": self.__actionLeft, "right": self.__actionRight, "up": self.__actionUp, "down": self.__actionDown, "pageUp": (self.__actionPageUp, _("Page Up / Zoom in")), "pageDown": (self.__actionPageDown, _("Page Down / Zoom out")), "seekBack": boundFunction(self.__actionNavigate, eWebView.navMediaRewind), "seekFwd": boundFunction(self.__actionNavigate, eWebView.navMediaFastForward), "tab": (boundFunction(self.__actionNavigate, eWebView.navTab), _("Tab")), "backspace": (self.__actionBackspace, _("Backspace / Navigate back")), "backtab": boundFunction(self.__actionNavigate, eWebView.navBacktab), "delete": (self.__actionDelete, _("Delete / Navigate forward")), "ascii": self.__actionAscii, "text" : (self.__actionVirtualAscii, _("Open Virtual Keyboard")), "ok" : self.__actionOk, "enter" : self.__actionEnter, "menu" : (self.__actionMenu, _("Menu")), "fullscreen" : self.__actionFullscreen, "play" : self.__actionPlay, "pause" : self.__actionPause, "playpause" : self.__actionPlayPause, "stop" : self.actionStop, "tv" : self.__actionTv, "record" : self.__actionRecord, }, -2) self["coloractions"] = ActionMap(["ColorActions"], { "red" : self.__actionRed, "green" : self.__actionGreen, "yellow" : self.__actionYellow, "blue" : self.__actionBlue, }) 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 }) def execEnd(self): Screen.execEnd(self) for fnc in self.onExecEnd: fnc() def setBackgroundTransparent(self, enabled): self.webnavigation.setBackgroundTransparent(enabled) def __setKeyBoardModeAscii(self): eRCInput.getInstance().setKeyboardMode(eRCInput.kmAscii) def __unsetKeyBoardModeAscii(self): eRCInput.getInstance().setKeyboardMode(self.__keyboardMode) def __setStatus(self, text): print "[Browser].__setStatus" self.statuslabel.setText(text) self.statuslabel.show() self.__statusTimer.startLongTimer(3) def __hideStatus(self): self["statuslabel"].hide() self.__statusTimer.stop() def __setMouseMode(self, enabled): self.__mouseMode = enabled if enabled: self.__setCursor() self["cursor"].show() self["red"].setText("Mouse On") self.__clearCanvas() else: self["cursor"].hide() self["red"].setText("Mouse Off") def __actionExit(self): if self.__isHbbtv: self.__actionExitCB(True) return self.session.openWithCallback(self.__actionExitCB, MessageBox, _("Do you really want to exit the browser?"), type = MessageBox.TYPE_YESNO) def __actionExitCB(self, confirmed): if confirmed: self.__urlSuggestionTimer.stop() self.__inputTimer.stop() if not self.__isHbbtv: config.plugins.WebBrowser.lastvisited.value = self.webnavigation.url config.plugins.WebBrowser.lastvisited.save() self.__persistCookies() self.close() def __onFirstExecBegin(self): self["cursor"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "Extensions/Browser/cursor.png")) self.__setCursor() self.__setMouseMode(self.__mouseMode) #enable/disable transparent background self.setBackgroundTransparent(self.__isTransparent) #set Accept-Language header to current language lang = '-'.join(language.getLanguage().split('_')) self.webnavigation.setAcceptLanguage(lang) self.__registerCallbacks() self.__urlList.hide() self.__restoreCookies() if self.__fullscreen: self.__showHideBars(False) self.__showHideButtonBar(False) if self.__startUrl is None: if config.plugins.WebBrowser.startPage.value == "home": self.__actionHome() else: self.setUrl(config.plugins.WebBrowser.lastvisited.value) else: self.setUrl(self.__startUrl) def __clearCanvas(self): size = getDesktop(0).size() self.canvas.fill(0, 0, size.width(), size.height(), 0xFF000000) self.canvas.flush() def __onStoragePathChanged(self): if config.plugins.WebBrowser.storage.enabled.value: self.webnavigation.enablePersistentStorage(config.plugins.WebBrowser.storage.path.value) def __onMicroFocusChanged(self, x, y, w, h, isInput): if not self.__isHbbtv and not self.__mouseMode: self.__cursorPos.setX(x) self.__cursorPos.setY(y) if self.__isInput and not isInput: self.__unsetKeyBoardModeAscii() self.__isInput = isInput if self.__isInput: self.setKeyboardModeAscii() self.__clearCanvas() lw = 4 #line width y = y x = x - lw w = w + lw blo = y + h #bottom line offset color =0xFF9900 #line color self.canvas.fill(x, y, lw, h, color)#left line self.canvas.fill(x, blo, w, lw, color)#bottom line self.canvas.flush()#Done -> Flush def __onSuggestionTimeout(self): needle = self.urlInput.getText() if needle != "": list = self.__db.suggsetUrls(self.urlInput.getText()) list.insert(0, needle) list.insert(1, _("Search for '%s'") %needle) self.__urlList.setList(list) self.__urlList.moveToIndex(0) self.__urlList.show() else: self.__urlList.hide() def __onAuthRequired(self, token, user, password, realm): if self.__currentUser != None and self.__currentPassword != None and realm == self.__currentRealm: d = eDict() d.setString("user", self.__currentUser) d.setString("password", self.__currentPassword) self.webnavigation.setDict(token, d) self.__currentUser = None self.__currentPassword = None self.__currentRealm = None else: msgbox = self.session.openWithCallback(self.__onAuthRequiredCB, HttpAuthenticationDialog, user, password, realm) msgbox.setTitle(_("Authentication required")) def __onAuthRequiredCB(self, dict): if dict != None: self.__currentUser = dict["user"] self.__currentPassword = dict["password"] self.__currentRealm = dict["realm"] self.setUrl(self.webnavigation.url) def __onProxyAuthRequired(self, token, user, password, realm): self.onAuthRequired(token, user, password, realm) def __onDownloadRequested(self, url): print "[Browser].__onDownloadRequested '%s'" %(url) filename = url_unquote(url).split("/")[-1] localfile = "%s/%s" %(config.plugins.WebBrowser.downloadpath.value, filename) downloadManager.AddJob(DownloadJob(url, localfile, filename)) self.session.open(MessageBox, _("Download started..."), type = MessageBox.TYPE_INFO, timeout = 3) def __onUnsupportedContent(self, url, contentType): print "[Browser].__onUnsupportedContent 'url=%s; contentType='%s'" %(url, contentType) self.__handledUnsupportedContent = True if contentType.startswith("video") or contentType.startswith("audio"): list = [( _("Download"), ("download", url) ), ( _("Play"), ("play", url) )] self.session.openWithCallback(self.__onUnsupportedContentCB, ChoiceBox, title=_("You've selected a media file what do you want to do?"), list = list) else: self.__onDownloadRequested(url) def __onUnsupportedContentCB(self, answer): if answer != None: answer = answer and answer[1] if answer[0] == "download": self.__onDownloadRequested(answer[1]) else: service = eServiceReference(4097,0,answer[1]) self.session.open(MoviePlayer, service) def __actionMenu(self): if self.__isHbbtv: if self.__hbbtvMenu is not None: self.__hbbtvMenu() return self.__urlSuggestionTimer.stop() self.__inputTimer.stop() self.__urlList.hide() self.__persistCookies() self.session.openWithCallback(self.__menuCB, BrowserMenu, self.pageTitle, self.webnavigation.url) def __menuCB(self, actions = None): if actions != None: for action in actions: if action[0] == BrowserMenu.ACTION_BOOKMARK: self.setUrl(action[1]) elif action[0] == BrowserMenu.ACTION_COOKIES: self.__restoreCookies() elif action[0] == BrowserMenu.ACTION_STORAGE_PATH: self.__onStoragePathChanged() if self.skinName == "BrowserFullscreen" and not config.plugins.WebBrowser.fullscreen.value: self.__requireRestart() if self.skinName != "BrowserFullscreen" and config.plugins.WebBrowser.fullscreen.value: self.__requireRestart() def __requireRestart(self): text = _("Some of the configuration changes require a restart of the Browser.\nDo you want to restart the Browser now?") msgbox = self.session.openWithCallback(self.__requireRestartCB, MessageBox, text, type = MessageBox.TYPE_YESNO) msgbox.setTitle(_("Restart required")) def __requireRestartCB(self, confirmed): if confirmed: self.close(self.session, True, self.webnavigation.url) def __enableUrlInput(self): self.urlInputEnabled = True self.urlInput.markAll() self.__setKeyBoardModeAscii() if self.__fullscreen: self.__showHideBars() def __disableUrlInput(self, hide = True): self.urlInputEnabled = False self.__urlSuggestionTimer.stop() self.__urlList.hide() self.urlInput.markNone() if not self.__isInput: self.__unsetKeyBoardModeAscii() if self.__fullscreen and hide: self.__showHideBars(False) def __showHideButtonBar(self, visible = True): if visible: self["_buttonBar"].show() else: self["_buttonBar"].hide() used_buttons = ("button_red_off", "button_green_off", "button_yellow_off", "button_blue_off", "button_red", "button_yellow", "button_blue") for button in used_buttons: self[button].setBoolean(visible) #disable green self["button_green"].setBoolean(False) def __showHideBars(self, visible = True): if self.__fullscreen: if visible: self.urlInput.show() else: self.urlInput.hide() if not self.__isHbbtv: self.__showHideButtonBar(visible) def __registerCallbacks(self): print "[Browser].__registerCallbacks" self.webnavigation.onUrlChanged.append(self.__onUrlChanged) self.webnavigation.onTitleChanged.append(self.__onTitleChanged) self.webnavigation.onLoadProgress.append(self.__onLoadProgress) self.webnavigation.onLoadFinished.append(self.__onLoadFinished) self.webnavigation.onDownloadRequested.append(self.__onDownloadRequested) self.webnavigation.onUnsupportedContent.append(self.__onUnsupportedContent) self.webnavigation.onMicroFocusChanged.append(self.__onMicroFocusChanged) self.webnavigation.onWindowRequested.append(self.__onWindowRequested) self.webnavigation.onSslErrors.append(self.__onSslErrors) self.webnavigation.onAuthRequired.append(self.__onAuthRequired) self.webnavigation.onProxyAuthRequired.append(self.__onProxyAuthRequired) def __actionOk(self): if self.textInput.visible: self.onInputTimer() elif self.urlInputEnabled: if self.__urlList.visible and self.__urlList.getSelectedIndex() > 0: if self.__urlList.getSelectedIndex() == 1: self.__searchUsingCurrentUrlValue() self.__disableUrlInput(False) else: self.urlInput.setText(self.__urlList.getCurrent()) self.urlInput.end() self.__urlList.hide() else: self.setUrl(self.urlInput.getText()) self.__isInput = False self.__disableUrlInput(False) else: if self.__mouseMode: self.webnavigation.leftClick(self.__cursorPos) else: self.__actionNavigate(eWebView.navOpenLink) def __actionEnter(self): if self.textInput.visible or self.urlInputEnabled: self.__actionOk() else: if self.__mouseMode: self.webnavigation.leftClick(self.__cursorPos) else: self.__actionNavigate(eWebView.navOpenLink) def __actionPlay(self): self.__actionNavigate(eWebView.navMediaPlay) def __actionPause(self): self.__actionNavigate(eWebView.navMediaPause) def __actionPlayPause(self): self.__actionNavigate(eWebView.navMediaPlay) #playpause doesn't work anywhere, but play does (HBBTV) def actionStop(self): self.__actionNavigate(eWebView.navMediaStop) def __actionBack(self): if self.__isHbbtv: self.__actionNavigate(eWebView.navBack) else: self.__actionNavigate(eWebView.navBackExplicit) def __actionForward(self): if self.__isHbbtv: self.__actionNavigate(eWebView.navForward) else: self.__actionNavigate(eWebView.navForwardExplicit) def __actionBackspace(self): if self.textInput.visible: self.restartTimer() self.textInput.deleteBackward() elif self.urlInputEnabled: self.urlInput.deleteBackward() self.__onUrlInputChanged() else: if self.__isInput: self.__actionNavigate(eWebView.navBackspace) else: self.__actionBack() def __actionDelete(self): if self.textInput.visible: self.restartTimer() self.textInput.delete() elif self.urlInputEnabled: self.urlInput.delete() self.__onUrlInputChanged() else: if self.__isInput: self.__actionNavigate(eWebView.navDelete) else: self.__actionForward() def __moveCursor(self, x=0, y=0): if x != 0 or y != 0: wSize = self.webnavigation.size #horizontal if x != 0: x = self.__cursorPos.x() + x w = wSize.width() if x <= 2: x = 2 self.__scroll(0-int(config.plugins.WebBrowser.scrollOffset.value), 0) elif x >= w-2: x = w-2 self.__scroll(int(config.plugins.WebBrowser.scrollOffset.value), 0) self.__cursorPos.setX(x) #vertical if y != 0: y = self.__cursorPos.y() + y h = wSize.height() if y < 2: y = 2 self.__scroll(0, 0-int(config.plugins.WebBrowser.scrollOffset.value)) elif y > h-2: y = h-2 self.__scroll(0, int(config.plugins.WebBrowser.scrollOffset.value)) self.__cursorPos.setY(y) self.__setCursor() def __setCursor(self): wPos = self.webnavigation.position relPos = None if wPos.x() > 0 or wPos.y() > 0: relPos = ePoint(self.__cursorPos.x() + wPos.x(), self.__cursorPos.y() + wPos.y()) else: relPos = self.__cursorPos self["cursor"].move(relPos) def __actionLeft(self): if self.urlInputEnabled: self.urlInput.left() elif self.__scrollMode: self.__scroll(0-int(config.plugins.WebBrowser.scrollOffset.value), 0) elif self.textInput.visible: self.restartTimer() self.textInput.left() else: if self.__mouseMode: self.__moveCursor(x=-10) else: self.__actionNavigate(eWebView.navLeft) def __actionRight(self): if self.urlInputEnabled: self.urlInput.right() elif self.__scrollMode: self.__scroll(int(config.plugins.WebBrowser.scrollOffset.value), 0) elif self.textInput.visible: self.restartTimer() self.textInput.right() else: if self.__mouseMode: self.__moveCursor(x=10) else: self.__actionNavigate(eWebView.navRight) def __actionUp(self): if self.urlInputEnabled: if self.__urlList.visible: self.__urlList.up() elif self.__scrollMode: self.__scroll(0, 0-int(config.plugins.WebBrowser.scrollOffset.value)) elif self.textInput.visible: self.restartTimer() self.textInput.up() else: if self.__mouseMode: self.__moveCursor(y=-10) else: self.__actionNavigate(eWebView.navUp) def __actionDown(self): if self.urlInputEnabled: if self.__urlList.visible: self.__urlList.down() #else: # self.urlInput.down() elif self.__scrollMode: self.__scroll(0, int(config.plugins.WebBrowser.scrollOffset.value)) elif self.textInput.visible: self.restartTimer() self.textInput.down() else: if self.__mouseMode: self.__moveCursor(y=10) else: self.__actionNavigate(eWebView.navDown) def __actionTv(self): for fnc in self.onActionTv: if fnc() is True: #Function told us to stop handling return def __actionRecord(self): for fnc in self.onActionRecord: if fnc() is True: #Function told us to stop handling return def __scroll(self, dx, dy): self.webnavigation.scroll(dx, dy) def __actionRed(self): if self.__isHbbtv: self.__actionNavigate(eWebView.navRed) else: self.__setMouseMode(not self.__mouseMode) def __actionGreen(self): self.__actionNavigate(eWebView.navGreen) def __actionYellow(self): if self.__isHbbtv: self.__actionNavigate(eWebView.navYellow) else: self.__scrollMode = not self.__scrollMode enDis = _("disabled") mode = _("Navigation") if self.__scrollMode: enDis = _("enabled") mode = _("Scrolling") text = _("Scroll mode is now %s") %enDis self["yellow"].setText(mode) self.__setStatus(text) def __actionBlue(self): if self.__isHbbtv: self.__actionNavigate(eWebView.navBlue) else: self.__zoomMode = not self.__zoomMode enDis = _("disabled") mode = _("Pagescroll") if self.__zoomMode: enDis = _("enabled") mode = _("Zoom") text = _("Zoom mode is now %s") %enDis self["blue"].setText(mode) self.__setStatus(text) def restartTimer(self): self.__inputTimer.stop() self.__inputTimer.startLongTimer(5) def __onUrlChanged(self, url): if url != None: self.__clearCanvas() self.urlInput.setText(url) self.urlInput.markNone() if self.__fullscreen and not self.__isHbbtv: self.__showHideBars() for fnc in self.onUrlChanged: fnc(url) def __onTitleChanged(self, title): if title != None: self.pageTitle = title self.setTitle("Web Browser - %s" %self.pageTitle) def __onLoadProgress(self, progress): print "[Browser].__onLoadProgress %s" %progress if(progress < 100): self["loading"].show() self["loading"].setText(_("Loading... %s%%" %progress)) else: self["loading"].hide() self["loading"].setText("") def __onLoadFinished(self, val): print "[Browser].__onLoadFinished %s" %val if val == 1: if not self.__isHbbtv: self.__db.addToHistory(HistoryItem(title = self.pageTitle, url = self.webnavigation.url)); if self.__fullscreen: self.__showHideBars(False) else: if not self.__hasSslErrors and not self.__handledUnsupportedContent: self.__handledUnsupportedContent = False for fnc in self.onPageLoadFinished: fnc() def __searchUsingCurrentUrlValue(self): needle = self.urlInput.getText() if needle != "": needle = needle.replace("http://", "").replace("https://", "").replace("ftp://", "") self.__onSearchRequested(needle) def __onSearchRequested(self, needle): if needle != "" and needle != None: needle = url_quote_plus(needle) url = "%s%s" %(config.plugins.WebBrowser.searchProvider.value, needle) self.setUrl(url) def __onWindowRequested(self, url): print "[Browser].__onWindowRequested :: '%s'" %url self.setUrl(url) def __onSslErrors(self, token, errors, pems): print "[Browser].__onSslErrors :: 'token='%s', errors='%s'" %(token, errors) self.__hasSslErrors = True cnt = 0 perrors = {} pems = list(pems) pems.sort() for bytes in pems: pem = "".join(map(chr, bytes)) if pem.strip() != "": messages = perrors.get(pem, []) messages.append(errors[cnt]) perrors[pem] = messages cnt += 1 for pem, messages in perrors.iteritems(): cert = Certificate(-1, self.__getCurrentNetloc(), pem) checkVal = self.__db.checkCert( cert ) == BrowserDB.CERT_UNKOWN if checkVal == BrowserDB.CERT_OK: print "[Browser].__onSslErrors :: netloc/pem combination known and trusted!" dict = eDict() dict.setFlag("ignore") self.webnavigation.setDict(token, dict) else: print "[Browser].__onSslErrors :: netloc/pem combination NOT known and/or trusted!" self.__currentPEM = pem errorstr = "" for m in messages: errorstr = "%s\n%s" %(m, errorstr) text = "" if checkVal == BrowserDB.CERT_UNKOWN: text = _("A certificate for the desired secure connection has the following errors:\n%s\nDo you want to add an exception for this certificate and accept connections to this host anyways?") %errorstr elif checkVal == BrowserDB.CERT_CHANGED: text = _("ATTENTION!\nPotential security breach detected!\nA certificate for the desired secure connection has CHANGED!\nIn addition it has the following errors:\n%s\nDo you want to add an exception for this certificate and accept connections to this host anyways?") %errorstr msgbox = self.session.openWithCallback( self.__onSslErrorCB, MessageBox, text, type = MessageBox.TYPE_YESNO) msgbox.setTitle(_("Certificate errors!")) def __onSslErrorCB(self, confirmed): self.__hasSslErrors = False if confirmed: print "[Browser].__onSslErrorCB :: loc='%s', PEM='%s'" %(self.__getCurrentNetloc(), self.__currentPEM) self.__db.addCert( Certificate(-1, self.__getCurrentNetloc(), self.__currentPEM) ) self.setUrl(self.webnavigation.url) def __getCurrentNetloc(self): return self.__getNetloc(self.webnavigation.url) def __getNetloc(self, url): return urlparse(url).netloc def __actionHome(self): self.setUrl(config.plugins.WebBrowser.home.value) def __actionEnterUrl(self): if self.urlInputEnabled: self.__disableUrlInput() else: self.__enableUrlInput() def setUrl(self, url): if url != None: if url.find("://") == -1: url = "http://%s" %url if url: self.webnavigation.url = url def getUserAgent(self): return self.webnavigation.useragent def setUserAgent(self, useragent): self.webnavigation.useragent = useragent def __actionAscii(self): if self.urlInputEnabled: self.urlInput.handleAscii(getPrevAsciiCode()) self.__onUrlInputChanged() elif self.__isInput: self.webnavigation.changed(WebNavigation.COMMAND_ASCII_INPUT, getPrevAsciiCode()) else: self.__actionNavigateNumber(chr(getPrevAsciiCode())) def __actionNavigateNumber(self, char): print "[Browser].__actionNavigateNumber %s" %char nav = { '0' : eWebView.nav0, '1' : eWebView.nav1, '2' : eWebView.nav2, '3' : eWebView.nav3, '4' : eWebView.nav4, '5' : eWebView.nav5, '6' : eWebView.nav6, '7' : eWebView.nav7, '8' : eWebView.nav8, '9' : eWebView.nav9, } action = nav.get(str(char), None) if action != None: if self.__mouseMode: self.__actionMouseJump(char) else: self.__actionNavigate(action) def __actionMouseJump(self, char): size = self.webnavigation.size off = 100 #offset hcenter = size.width() / 2 vcenter = size.height() / 2 roff = size.width() - off #right offset boff = size.height() - off # bottom offset offsets = { '1' : [off,off], '2' : [hcenter, off], '3' : [roff, off], '4' : [off, vcenter], '5' : [hcenter, vcenter], '6' : [roff, vcenter], '7' : [off, boff], '8' : [hcenter, boff], '9' : [roff, boff], } offset = offsets.get(str(char), None) if offset: self.__cursorPos.setX(offset[0]) self.__cursorPos.setY(offset[1]) self.__setCursor() def __actionVirtualAscii(self): self.session.openWithCallback(self.sendTextAsAscii, VirtualKeyBoard, title="Browser Input") def __actionPageUp(self): if self.__zoomMode: self.webnavigation.zoomFactor += 0.1 else: self.__actionNavigate(eWebView.navPageUp) def __actionPageDown(self): if self.__zoomMode: self.webnavigation.zoomFactor -= 0.1 else: self.__actionNavigate(eWebView.navPageDown) def sendTextAsAscii(self, text): if text != None: for c in text: self.webnavigation.changed(WebNavigation.COMMAND_ASCII_INPUT, ord(c)) def __actionNavigate(self, param): if not self.urlInputEnabled and not self.textInput.visible: self.webnavigation.changed(WebNavigation.COMMAND_NAVIGATE, param) def keyNumberGlobal(self, number): if self.urlInputEnabled: self.urlInput.number(number) self.__onUrlInputChanged() elif self.__isInput: self.textInput.show() self.restartTimer() self.textInput.number(number) else: self.__actionNavigateNumber(number) def __onUrlInputChanged(self): if not self.__urlSuggestionTimer.isActive(): self.__urlSuggestionTimer.startLongTimer(1) def onInputTimer(self): self.__inputTimer.stop() self.textInput.hide() text = self.textInput.getText() self.textInput.setText("") if text != "" and text != None: self.sendTextAsAscii(text) def __actionFullscreen(self): self.webnavigation.size = (self.width, self.height) self.webnavigation.position = (0, 0) def __restoreCookies(self): cookies = self.__db.getCookies() print "[Browser].__restoreCookies ::: restoring %s cookies" %len(cookies) rawCookies = [] for cookie in cookies: rawCookies.append( b64encode(cookie.raw) ) self.webnavigation.cookies = ','.join(rawCookies) def __persistCookies(self): rawCookies = self.webnavigation.cookies if rawCookies.strip() != "": rawCookies = rawCookies.split(",") cookies = [] cookie = None for rawCookie in rawCookies: cookie = Cookie.fromRawString(b64decode(rawCookie)) if cookie != None: cookies.append( cookie ) print "[Browser].__persistCookies ::: persisting %s cookies" %len(cookies) self.__db.persistCookies(cookies) else: print "[Browser].__persistCookies ::: NO cookies to be persisted"
def __init__(self, session, title="", text="", additionalParams={}): winWidth = 590 self.skin = '''<screen position="center,center" size="%d,500" title="" > <widget name="captcha" position="%d,%d" size="%d,%d" zPosition="2" transparent="1" alphatest="on" /> <widget name="key_red" position="10,10" zPosition="2" size="%d,35" valign="center" halign="left" font="Regular;22" transparent="1" foregroundColor="red" /> <widget name="key_ok" position="10,10" zPosition="2" size="%d,35" valign="center" halign="center" font="Regular;22" transparent="1" foregroundColor="white" /> <widget name="key_green" position="10,10" zPosition="2" size="%d,35" valign="center" halign="right" font="Regular;22" transparent="1" foregroundColor="green" /> <ePixmap pixmap="%s" position="25,195" size="542,80" zPosition="-4" alphatest="on" /> <widget name="header" position="25,160" size="500,26" transparent="1" noWrap="1" font="Regular;20" valign="top"/> <widget name="text" position="25,200" size="536,34" transparent="1" noWrap="1" font="Regular;26" valign="center" halign="right" /> <widget name="list" position="25,250" size="550,225" selectionDisabled="1" transparent="1" /> </screen> ''' % ( winWidth, 10, 55, \ winWidth - 20, 100, \ winWidth-20, \ winWidth-20, \ winWidth-20, \ GetIconDir("vk/vkey_text.png")) Screen.__init__(self, session) self.keys_list = [] self.shiftkeys_list = [] self.shiftMode = additionalParams.get('shift_mode', False) self.selectedKey = 0 self.smsChar = None self.sms = NumericalTextInput(self.smsOK) self.key_bg = LoadPixmap(GetIconDir("vk/vkey_bg.png")) self.key_sel = LoadPixmap(GetIconDir("vk/vkey_sel.png")) self.key_backspace = LoadPixmap(GetIconDir("vk/vkey_backspace.png")) self.key_all = LoadPixmap(GetIconDir("vk/vkey_all.png")) self.key_clr = LoadPixmap(GetIconDir("vk/vkey_clr.png")) self.key_esc = LoadPixmap(GetIconDir("vk/vkey_esc.png")) self.key_ok = LoadPixmap(GetIconDir("vk/vkey_ok.png")) self.key_shift = LoadPixmap(GetIconDir("vk/vkey_shift.png")) self.key_shift_sel = LoadPixmap(GetIconDir("vk/vkey_shift_sel.png")) self.key_space = LoadPixmap(GetIconDir("vk/vkey_space.png")) self.key_left = LoadPixmap(GetIconDir("vk/vkey_left.png")) self.key_right = LoadPixmap(GetIconDir("vk/vkey_right.png")) self.keyImages = { "BACKSPACE": self.key_backspace, "CLEAR": self.key_clr, "ALL": self.key_all, "EXIT": self.key_esc, "OK": self.key_ok, "SHIFT": self.key_shift, "SPACE": self.key_space, "LEFT": self.key_left, "RIGHT": self.key_right } self.keyImagesShift = { "BACKSPACE": self.key_backspace, "CLEAR": self.key_clr, "ALL": self.key_all, "EXIT": self.key_esc, "OK": self.key_ok, "SHIFT": self.key_shift_sel, "SPACE": self.key_space, "LEFT": self.key_left, "RIGHT": self.key_right } self["key_green"] = Label(_("Accept")) self["key_ok"] = Label(_("OK")) self["key_red"] = Label(_("Cancel")) self["header"] = Label(title) self["text"] = Input(text=text.decode("utf-8", 'ignore')) self["list"] = VirtualKeyBoardList([]) self["actions"] = NumberActionMap( [ "OkCancelActions", "WizardActions", "ColorActions", "KeyboardInputActions", "InputBoxActions", "InputAsciiActions" ], { "gotAsciiCode": self.keyGotAscii, "ok": self.okClicked, "cancel": self.exit, "left": self.left, "right": self.right, "up": self.up, "down": self.down, "red": self.exit, "green": self.ok, "yellow": self.switchLang, "blue": self.shiftClicked, "deleteBackward": self.backClicked, "deleteForward": self.forwardClicked, "back": self.exit, "pageUp": self.cursorRight, "pageDown": self.cursorLeft, "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, }, -2) self.startText = text self.setLang(additionalParams) self.onExecBegin.append(self.setKeyboardModeAscii) self.onLayoutFinish.append(self.buildVirtualKeyBoard) self.captchaPath = additionalParams['captcha_path'] self['captcha'] = Cover2() self.onShown.append(self.loadCaptcha)