Add some parental control improvements (made by Tode)
[enigma2.git] / lib / python / Screens / VirtualKeyBoard.py
index 53970ab862ddf14f56d4d3a587ff447411e3a83a..7846e4b85dc5aeb0165472e8005bdc9acb9dd85d 100755 (executable)
-# -*- coding: iso-8859-1 -*-\r
-from Components.Language import language\r
-from Components.ActionMap import ActionMap\r
-from Components.Label import Label\r
-from Components.Pixmap import Pixmap\r
-from Components.MenuList import MenuList\r
-from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest\r
-from enigma import eListboxPythonMultiContent, gFont, loadPNG, RT_HALIGN_CENTER, RT_VALIGN_CENTER\r
-from Screen import Screen\r
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE\r
-\r
-key_backspace = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_backspace.png"))\r
-key_bg = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_bg.png"))\r
-key_clr = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_clr.png"))\r
-key_esc = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_esc.png"))\r
-key_ok = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_ok.png"))\r
-key_sel = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_sel.png"))\r
-key_shift = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift.png"))\r
-key_shift_sel = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift_sel.png"))\r
-key_space = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_space.png"))\r
-\r
-class VirtualKeyBoardList(MenuList):\r
-       def __init__(self, list, enableWrapAround=False):\r
-               MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)\r
-               self.l.setFont(0, gFont("Regular", 22))\r
-               self.l.setItemHeight(45)\r
-\r
-def VirtualKeyBoardEntryComponent(keys, selectedKey,shiftMode=False):\r
-       res = [ (keys) ]\r
-       \r
-       x = 0\r
-       count = 0\r
-       if shiftMode:\r
-               shiftkey_png = key_shift_sel\r
-       else:\r
-               shiftkey_png = key_shift\r
-       for key in keys:\r
-               if key == "EXIT":\r
-                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_esc))\r
-               elif key == "BACKSPACE":\r
-                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_backspace))\r
-               elif key == "CLEAR":\r
-                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_clr))\r
-               elif key == "SHIFT":\r
-                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=shiftkey_png))\r
-               elif key == "SPACE":\r
-                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_space))\r
-               elif key == "OK":\r
-                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_ok))\r
-               #elif key == "<-":\r
-               #       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_left))\r
-               #elif key == "->":\r
-               #       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_right))\r
-               \r
-               else:\r
-                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_bg))\r
-                       res.append(MultiContentEntryText(pos=(x, 0), size=(45, 45), font=0, text=key.encode("utf-8"), flags=RT_HALIGN_CENTER | RT_VALIGN_CENTER))\r
-               \r
-               if selectedKey == count:\r
-                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_sel))\r
-               \r
-               x += 45\r
-               count += 1\r
-       \r
-       return res\r
-\r
-\r
-class VirtualKeyBoard(Screen):\r
-\r
-       def __init__(self, session, title="", text=""):\r
-               Screen.__init__(self, session)\r
-               self.keys_list = []\r
-               self.shiftkeys_list = []\r
-               self.lang = language.getLanguage()\r
-               if self.lang == 'de_DE':\r
-                       self.keys_list = [\r
-                               [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],\r
-                               [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"ü", u"+"],\r
-                               [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ö", u"ä", u"#"],\r
-                               [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],\r
-                               [u"SHIFT", u"SPACE", u"@", u"ß", u"OK"]]\r
-                       \r
-                       self.shiftkeys_list = [\r
-                               [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],\r
-                               [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"Ü", u"*"],\r
-                               [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ö", u"Ä", u"'"],\r
-                               [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],\r
-                               [u"SHIFT", u"SPACE", u"?", u"\\", u"OK"]]\r
-                       \r
-               elif self.lang == 'es_ES':\r
-                       #still missing keys (u"ùÙ")\r
-                       self.keys_list = [\r
-                               [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],\r
-                               [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"ú", u"+"],\r
-                               [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ó", u"á", u"#"],\r
-                               [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],\r
-                               [u"SHIFT", u"SPACE", u"@", u"£", u"à", u"é", u"è", u"í", u"ì", u"ñ", u"ò", u"OK"]]\r
-                       \r
-                       self.shiftkeys_list = [\r
-                               [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],\r
-                               [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"Ú", u"*"],\r
-                               [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ó", u"Á", u"'"],\r
-                               [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],\r
-                               [u"SHIFT", u"SPACE", u"?", u"\\", u"À", u"É", u"È",  u"Í", u"Ì", u"Ñ", u"Ò", u"OK"]]\r
-                               \r
-               elif self.lang in ['sv_SE', 'fi_FI']:\r
-                       self.keys_list = [\r
-                               [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],\r
-                               [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"é", u"+"],\r
-                               [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ö", u"ä", u"#"],\r
-                               [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],\r
-                               [u"SHIFT", u"SPACE", u"@", u"ß", u"å", u"OK"]]\r
-                               \r
-                       self.shiftkeys_list = [\r
-                               [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],\r
-                               [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"É", u"*"],\r
-                               [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ö", u"Ä", u"'"],\r
-                               [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],\r
-                               [u"SHIFT", u"SPACE", u"?", u"\\", u"Å", u"OK"]]\r
-               else:\r
-                       self.keys_list = [\r
-                               [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],\r
-                               [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"+", u"@"],\r
-                               [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"#", u"\\"],\r
-                               [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],\r
-                               [u"SHIFT", u"SPACE", u"OK"]]\r
-                       \r
-                       self.shiftkeys_list = [\r
-                               [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],\r
-                               [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"*"],\r
-                               [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"'", u"?"],\r
-                               [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],\r
-                               [u"SHIFT", u"SPACE", u"OK"]]\r
-               \r
-               self.shiftMode = False\r
-               self.text = text\r
-               self.selectedKey = 0\r
-               \r
-               self["header"] = Label(title)\r
-               self["text"] = Label(self.text)\r
-               self["list"] = VirtualKeyBoardList([])\r
-               \r
-               self["actions"] = ActionMap(["OkCancelActions", "WizardActions", "ColorActions"],\r
-                       {\r
-                               "ok": self.okClicked,\r
-                               "cancel": self.exit,\r
-                               "left": self.left,\r
-                               "right": self.right,\r
-                               "up": self.up,\r
-                               "down": self.down,\r
-                               "red": self.backClicked,\r
-                               "green": self.ok\r
-                       }, -2)\r
-               \r
-               self.onLayoutFinish.append(self.buildVirtualKeyBoard)\r
-\r
-       def buildVirtualKeyBoard(self, selectedKey=0):\r
-               list = []\r
-               \r
-               if self.shiftMode:\r
-                       self.k_list = self.shiftkeys_list\r
-                       for keys in self.k_list:\r
-                               if selectedKey < 12 and selectedKey > -1:\r
-                                       list.append(VirtualKeyBoardEntryComponent(keys, selectedKey,True))\r
-                               else:\r
-                                       list.append(VirtualKeyBoardEntryComponent(keys, -1,True))\r
-                               selectedKey -= 12\r
-               else:\r
-                       self.k_list = self.keys_list\r
-                       for keys in self.k_list:\r
-                               if selectedKey < 12 and selectedKey > -1:\r
-                                       list.append(VirtualKeyBoardEntryComponent(keys, selectedKey))\r
-                               else:\r
-                                       list.append(VirtualKeyBoardEntryComponent(keys, -1))\r
-                               selectedKey -= 12\r
-               \r
-               self["list"].setList(list)\r
-\r
-       \r
-       def backClicked(self):\r
-               self.text = self["text"].getText()[:-1]\r
-               self["text"].setText(self.text)\r
-                       \r
-       def okClicked(self):\r
-               if self.shiftMode:\r
-                       list = self.shiftkeys_list\r
-               else:\r
-                       list = self.keys_list\r
-               \r
-               selectedKey = self.selectedKey\r
-\r
-               for x in list:\r
-                       if selectedKey < 12:\r
-                               text = x[selectedKey]\r
-                               break\r
-                       else:\r
-                               selectedKey -= 12\r
-\r
-               text = text.encode("utf-8")\r
-\r
-               if text == "EXIT":\r
-                       self.close(None)\r
-               \r
-               elif text == "BACKSPACE":\r
-                       self.text = self["text"].getText()[:-1]\r
-                       self["text"].setText(self.text)\r
-               \r
-               elif text == "CLEAR":\r
-                       self.text = ""\r
-                       self["text"].setText(self.text)\r
-               \r
-               elif text == "SHIFT":\r
-                       if self.shiftMode:\r
-                               self.shiftMode = False\r
-                       else:\r
-                               self.shiftMode = True\r
-                       \r
-                       self.buildVirtualKeyBoard(self.selectedKey)\r
-               \r
-               elif text == "SPACE":\r
-                       self.text += " "\r
-                       self["text"].setText(self.text)\r
-               \r
-               elif text == "OK":\r
-                       self.close(self["text"].getText())\r
-               \r
-               else:\r
-                       self.text = self["text"].getText()\r
-                       self.text += text\r
-                       self["text"].setText(self.text)\r
-\r
-       def ok(self):\r
-               self.close(self["text"].getText())\r
-\r
-       def exit(self):\r
-               self.close(None)\r
-\r
-       def left(self):\r
-               self.selectedKey -= 1\r
-               \r
-               if self.selectedKey == -1:\r
-                       self.selectedKey = 11\r
-               elif self.selectedKey == 11:\r
-                       self.selectedKey = 23\r
-               elif self.selectedKey == 23:\r
-                       self.selectedKey = 35\r
-               elif self.selectedKey == 35:\r
-                       self.selectedKey = 47\r
-               elif self.selectedKey == 47:\r
-                       self.selectedKey = 59\r
-               \r
-               self.showActiveKey()\r
-\r
-       def right(self):\r
-               self.selectedKey += 1\r
-               \r
-               if self.selectedKey == 12:\r
-                       self.selectedKey = 0\r
-               elif self.selectedKey == 24:\r
-                       self.selectedKey = 12\r
-               elif self.selectedKey == 36:\r
-                       self.selectedKey = 24\r
-               elif self.selectedKey == 48:\r
-                       self.selectedKey = 36\r
-               elif self.selectedKey == 60:\r
-                       self.selectedKey = 48\r
-               \r
-               self.showActiveKey()\r
-\r
-       def up(self):\r
-               self.selectedKey -= 12\r
-               \r
-               if self.selectedKey < 0:\r
-                       self.selectedKey += 60\r
-               \r
-               self.showActiveKey()\r
-\r
-       def down(self):\r
-               self.selectedKey += 12\r
-               \r
-               if self.selectedKey > 59:\r
-                       self.selectedKey -= 60\r
-               \r
-               self.showActiveKey()\r
-\r
-       def showActiveKey(self):\r
-               self.buildVirtualKeyBoard(self.selectedKey)\r
+# -*- coding: iso-8859-1 -*-
+from Components.Language import language
+from Components.ActionMap import ActionMap
+from Components.Label import Label
+from Components.Pixmap import Pixmap
+from Components.MenuList import MenuList
+from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
+from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_CENTER, RT_VALIGN_CENTER
+from Screen import Screen
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
+from Tools.LoadPixmap import LoadPixmap
+
+class VirtualKeyBoardList(MenuList):
+       def __init__(self, list, enableWrapAround=False):
+               MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
+               self.l.setFont(0, gFont("Regular", 28))
+               self.l.setItemHeight(45)
+
+def VirtualKeyBoardEntryComponent(keys, selectedKey,shiftMode=False):
+       key_backspace = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_backspace.png"))
+       key_bg = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_bg.png"))
+       key_clr = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_clr.png"))
+       key_esc = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_esc.png"))
+       key_ok = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_ok.png"))
+       key_sel = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_sel.png"))
+       key_shift = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_shift.png"))
+       key_shift_sel = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_shift_sel.png"))
+       key_space = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_space.png"))
+       res = [ (keys) ]
+       
+       x = 0
+       count = 0
+       if shiftMode:
+               shiftkey_png = key_shift_sel
+       else:
+               shiftkey_png = key_shift
+       for key in keys:
+               width = None
+               if key == "EXIT":
+                       width = key_esc.size().width()
+                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_esc))
+               elif key == "BACKSPACE":
+                       width = key_backspace.size().width()
+                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_backspace))
+               elif key == "CLEAR":
+                       width = key_clr.size().width()
+                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_clr))
+               elif key == "SHIFT":
+                       width = shiftkey_png.size().width()
+                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=shiftkey_png))
+               elif key == "SPACE":
+                       width = key_space.size().width()
+                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_space))
+               elif key == "OK":
+                       width = key_ok.size().width()
+                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_ok))
+               #elif key == "<-":
+               #       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_left))
+               #elif key == "->":
+               #       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_right))
+               
+               else:
+                       width = key_bg.size().width()
+                       res.extend((
+                               MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_bg),
+                               MultiContentEntryText(pos=(x, 0), size=(width, 45), font=0, text=key.encode("utf-8"), flags=RT_HALIGN_CENTER | RT_VALIGN_CENTER)
+                       ))
+               
+               if selectedKey == count:
+                       width = key_sel.size().width()
+                       res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_sel))
+
+               if width is not None:
+                       x += width
+               else:
+                       x += 45
+               count += 1
+       
+       return res
+
+
+class VirtualKeyBoard(Screen):
+
+       def __init__(self, session, title="", text=""):
+               Screen.__init__(self, session)
+               self.keys_list = []
+               self.shiftkeys_list = []
+               self.lang = language.getLanguage()
+               if self.lang == 'de_DE':
+                       self.keys_list = [
+                               [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
+                               [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"ü", u"+"],
+                               [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ö", u"ä", u"#"],
+                               [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],
+                               [u"SHIFT", u"SPACE", u"@", u"ß", u"OK"]]
+                       
+                       self.shiftkeys_list = [
+                               [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],
+                               [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"Ü", u"*"],
+                               [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ö", u"Ä", u"'"],
+                               [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],
+                               [u"SHIFT", u"SPACE", u"?", u"\\", u"OK"]]
+                       
+               elif self.lang == 'es_ES':
+                       #still missing keys (u"ùÙ")
+                       self.keys_list = [
+                               [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
+                               [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"ú", u"+"],
+                               [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ó", u"á", u"#"],
+                               [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],
+                               [u"SHIFT", u"SPACE", u"@", u"£", u"à", u"é", u"è", u"í", u"ì", u"ñ", u"ò", u"OK"]]
+                       
+                       self.shiftkeys_list = [
+                               [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],
+                               [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"Ú", u"*"],
+                               [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ó", u"Á", u"'"],
+                               [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],
+                               [u"SHIFT", u"SPACE", u"?", u"\\", u"À", u"É", u"È",  u"Í", u"Ì", u"Ñ", u"Ò", u"OK"]]
+                               
+               elif self.lang in ('sv_SE', 'fi_FI'):
+                       self.keys_list = [
+                               [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
+                               [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"é", u"+"],
+                               [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ö", u"ä", u"#"],
+                               [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],
+                               [u"SHIFT", u"SPACE", u"@", u"ß", u"å", u"OK"]]
+                               
+                       self.shiftkeys_list = [
+                               [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],
+                               [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"É", u"*"],
+                               [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ö", u"Ä", u"'"],
+                               [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],
+
+                               [u"SHIFT", u"SPACE", u"?", u"\\", u"Å", u"OK"]]
+               else:
+                       self.keys_list = [
+                               [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
+                               [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"+", u"@"],
+                               [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"#", u"\\"],
+                               [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],
+                               [u"SHIFT", u"SPACE", u"OK"]]
+                       
+                       self.shiftkeys_list = [
+                               [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],
+                               [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"*"],
+                               [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"'", u"?"],
+                               [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],
+                               [u"SHIFT", u"SPACE", u"OK"]]
+               
+               self.shiftMode = False
+               self.text = text
+               self.selectedKey = 0
+               
+               self["header"] = Label(title)
+               self["text"] = Label(self.text)
+               self["list"] = VirtualKeyBoardList([])
+               
+               self["actions"] = ActionMap(["OkCancelActions", "WizardActions", "ColorActions"],
+                       {
+                               "ok": self.okClicked,
+                               "cancel": self.exit,
+                               "left": self.left,
+                               "right": self.right,
+                               "up": self.up,
+                               "down": self.down,
+                               "red": self.backClicked,
+                               "green": self.ok
+                       }, -2)
+               
+               self.onLayoutFinish.append(self.buildVirtualKeyBoard)
+       
+               self.max_key=47+len(self.keys_list[4])
+
+       def buildVirtualKeyBoard(self, selectedKey=0):
+               list = []
+               
+               if self.shiftMode:
+                       self.k_list = self.shiftkeys_list
+                       for keys in self.k_list:
+                               if selectedKey < 12 and selectedKey > -1:
+                                       list.append(VirtualKeyBoardEntryComponent(keys, selectedKey,True))
+                               else:
+                                       list.append(VirtualKeyBoardEntryComponent(keys, -1,True))
+                               selectedKey -= 12
+               else:
+                       self.k_list = self.keys_list
+                       for keys in self.k_list:
+                               if selectedKey < 12 and selectedKey > -1:
+                                       list.append(VirtualKeyBoardEntryComponent(keys, selectedKey))
+                               else:
+                                       list.append(VirtualKeyBoardEntryComponent(keys, -1))
+                               selectedKey -= 12
+               
+               self["list"].setList(list)
+
+       
+       def backClicked(self):
+               self.text = self["text"].getText()[:-1]
+               self["text"].setText(self.text)
+                       
+       def okClicked(self):
+               if self.shiftMode:
+                       list = self.shiftkeys_list
+               else:
+                       list = self.keys_list
+               
+               selectedKey = self.selectedKey
+
+               text = None
+
+               for x in list:
+                       if selectedKey < 12:
+                               if selectedKey < len(x):
+                                       text = x[selectedKey]
+                               break
+                       else:
+                               selectedKey -= 12
+
+               if text is None:
+                       return
+
+               text = text.encode("utf-8")
+
+               if text == "EXIT":
+                       self.close(None)
+               
+               elif text == "BACKSPACE":
+                       self.text = self["text"].getText()[:-1]
+                       self["text"].setText(self.text)
+               
+               elif text == "CLEAR":
+                       self.text = ""
+                       self["text"].setText(self.text)
+               
+               elif text == "SHIFT":
+                       if self.shiftMode:
+                               self.shiftMode = False
+                       else:
+                               self.shiftMode = True
+                       
+                       self.buildVirtualKeyBoard(self.selectedKey)
+               
+               elif text == "SPACE":
+                       self.text += " "
+                       self["text"].setText(self.text)
+               
+               elif text == "OK":
+                       self.close(self["text"].getText())
+               
+               else:
+                       self.text = self["text"].getText()
+                       self.text += text
+                       self["text"].setText(self.text)
+
+       def ok(self):
+               self.close(self["text"].getText())
+
+       def exit(self):
+               self.close(None)
+
+       def left(self):
+               self.selectedKey -= 1
+               
+               if self.selectedKey == -1:
+                       self.selectedKey = 11
+               elif self.selectedKey == 11:
+                       self.selectedKey = 23
+               elif self.selectedKey == 23:
+                       self.selectedKey = 35
+               elif self.selectedKey == 35:
+                       self.selectedKey = 47
+               elif self.selectedKey == 47:
+                       self.selectedKey = self.max_key
+               
+               self.showActiveKey()
+
+       def right(self):
+               self.selectedKey += 1
+               
+               if self.selectedKey == 12:
+                       self.selectedKey = 0
+               elif self.selectedKey == 24:
+                       self.selectedKey = 12
+               elif self.selectedKey == 36:
+                       self.selectedKey = 24
+               elif self.selectedKey == 48:
+                       self.selectedKey = 36
+               elif self.selectedKey > self.max_key:
+                       self.selectedKey = 48
+               
+               self.showActiveKey()
+
+       def up(self):
+               self.selectedKey -= 12
+               
+               if (self.selectedKey < 0) and (self.selectedKey > (self.max_key-60)):
+                       self.selectedKey += 48
+               elif self.selectedKey < 0:
+                       self.selectedKey += 60  
+               
+               self.showActiveKey()
+
+       def down(self):
+               self.selectedKey += 12
+               
+               if (self.selectedKey > self.max_key) and (self.selectedKey > 59):
+                       self.selectedKey -= 60
+               elif self.selectedKey > self.max_key:
+                       self.selectedKey -= 48
+               
+               self.showActiveKey()
+
+       def showActiveKey(self):
+               self.buildVirtualKeyBoard(self.selectedKey)