some service scan improovements
[enigma2.git] / lib / python / Screens / LanguageSelection.py
index 7492e3ff6b468c020c56443f777798ba6e977df1..0fe53d654da7caa5828df63134e93603af583ac2 100644 (file)
@@ -2,22 +2,22 @@ from Screen import Screen
 
 from Components.ActionMap import ActionMap
 from Components.Language import language
-from Components.LanguageList import *
 from Components.config import config
 from Components.Sources.List import List
+from Components.Label import Label
+from Components.Pixmap import Pixmap
 
-from Tools.Directories import *
+from Screens.Rc import Rc
 
-from enigma import eListboxPythonMultiContent, loadPNG, eListbox, gFont, RT_HALIGN_LEFT
+from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+
+from Tools.LoadPixmap import LoadPixmap
 
 def LanguageEntryComponent(file, name, index):
-       res = [ index ]
-       res.append((eListboxPythonMultiContent.TYPE_TEXT, 80, 10, 200, 50, 0, RT_HALIGN_LEFT ,name))
-       png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "countries/" + file + ".png"))
+       png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "countries/" + file + ".png"))
        if png == None:
-               png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "countries/missing.png"))
-       res.append((eListboxPythonMultiContent.TYPE_PIXMAP, 10, 5, 60, 40, png))
-       
+               png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "countries/missing.png"))
+       res = (index, name, png)
        return res
 
 class LanguageSelection(Screen):
@@ -27,7 +27,7 @@ class LanguageSelection(Screen):
                self.oldActiveLanguage = language.getActiveLanguage()
 
                self.list = []
-               self["languages"] = List(self.list, item_height=50, fonts = [gFont("Regular", 20)])
+               self["languages"] = List(self.list)
                self["languages"].onSelectionChanged.append(self.changed)
 
                self.updateList()
@@ -76,9 +76,9 @@ class LanguageSelection(Screen):
                        self.list.append(LanguageEntryComponent("en", _("English"), "en_EN"))
                else:
                        for x in language.getLanguageList():
-                               self.list.append(LanguageEntryComponent(file = x[1][3].lower(), name = _(x[1][0]), index = x[0]))
+                               self.list.append(LanguageEntryComponent(file = x[1][2].lower(), name = _(x[1][0]), index = x[0]))
                #self.list.sort(key=lambda x: x[1][7])
-               
+
                print "updateList"
                if first_time:
                        self["languages"].list = self.list
@@ -89,3 +89,27 @@ class LanguageSelection(Screen):
        def changed(self):
                self.run()
                self.updateList()
+
+class LanguageWizard(LanguageSelection, Rc):
+       def __init__(self, session):
+               LanguageSelection.__init__(self, session)
+               Rc.__init__(self)
+               self.onLayoutFinish.append(self.selectKeys)
+                               
+               self["wizard"] = Pixmap()
+               self["text"] = Label()
+               self.setText()
+               
+       def selectKeys(self):
+               self.clearSelectedKeys()
+               self.selectKey("UP")
+               self.selectKey("DOWN")
+               
+       def changed(self):
+               self.run()
+               self.updateList()
+               self.setText()
+               
+       def setText(self):
+               self["text"].setText(_("Please use the UP and DOWN keys to select your language. Afterwards press the OK button."))
+