whitespace cleanup
[enigma2.git] / lib / python / Screens / LanguageSelection.py
index 1d2fd78..87fbc11 100644 (file)
@@ -10,22 +10,24 @@ from Components.config import config
 class LanguageSelection(Screen):
        def __init__(self, session):
                Screen.__init__(self, session)
 class LanguageSelection(Screen):
        def __init__(self, session):
                Screen.__init__(self, session)
-               
+
+               self.oldActiveLanguage = language.getActiveLanguage()
+
                self.list = []
                self["list"] = LanguageList(self.list)
                self.updateList()
                self.onLayoutFinish.append(self.selectActiveLanguage)
                self.list = []
                self["list"] = LanguageList(self.list)
                self.updateList()
                self.onLayoutFinish.append(self.selectActiveLanguage)
-                               
+
                self["actions"] = ActionMap(["OkCancelActions", "DirectionActions"], 
                {
                        "ok": self.save,
                self["actions"] = ActionMap(["OkCancelActions", "DirectionActions"], 
                {
                        "ok": self.save,
-                       "cancel": self.close,
+                       "cancel": self.cancel,
                        "up": self.up,
                        "down": self.down,
                        "left": self.left,
                        "right": self.right
                }, -1)
                        "up": self.up,
                        "down": self.down,
                        "left": self.left,
                        "right": self.right
                }, -1)
-               
+
        def selectActiveLanguage(self):
                activeLanguage = language.getActiveLanguage()
                pos = 0
        def selectActiveLanguage(self):
                activeLanguage = language.getActiveLanguage()
                pos = 0
@@ -34,11 +36,15 @@ class LanguageSelection(Screen):
                                self["list"].instance.moveSelectionTo(pos)
                                break
                        pos += 1
                                self["list"].instance.moveSelectionTo(pos)
                                break
                        pos += 1
-               
+
        def save(self):
                self.run()
                self.close()
        def save(self):
                self.run()
                self.close()
-       
+
+       def cancel(self):
+               language.activateLanguage(self.oldActiveLanguage)
+               self.close()
+
        def run(self):
                language.activateLanguage(self["list"].l.getCurrentSelection()[0])
                config.osd.language.value = self["list"].l.getCurrentSelection()[0]
        def run(self):
                language.activateLanguage(self["list"].l.getCurrentSelection()[0])
                config.osd.language.value = self["list"].l.getCurrentSelection()[0]
@@ -54,14 +60,14 @@ class LanguageSelection(Screen):
                else:
                        for x in language.getLanguageList():
                                self.list.append(LanguageEntryComponent(file = x[1][3].lower(), name = _(x[1][0]), index = x[0]))
                else:
                        for x in language.getLanguageList():
                                self.list.append(LanguageEntryComponent(file = x[1][3].lower(), name = _(x[1][0]), index = x[0]))
-               self.list.sort(key=lambda x: x[1][7])
+               #self.list.sort(key=lambda x: x[1][7])
                self["list"].l.setList(self.list)
 
        def up(self):
                self["list"].instance.moveSelection(self["list"].instance.moveUp)
                self.run()
                self.updateList()
                self["list"].l.setList(self.list)
 
        def up(self):
                self["list"].instance.moveSelection(self["list"].instance.moveUp)
                self.run()
                self.updateList()
-               
+
        def down(self):
                self["list"].instance.moveSelection(self["list"].instance.moveDown)
                self.run()
        def down(self):
                self["list"].instance.moveSelection(self["list"].instance.moveDown)
                self.run()
@@ -71,8 +77,8 @@ class LanguageSelection(Screen):
                self["list"].instance.moveSelection(self["list"].instance.pageUp)
                self.run()
                self.updateList()
                self["list"].instance.moveSelection(self["list"].instance.pageUp)
                self.run()
                self.updateList()
-               
+
        def right(self):
                self["list"].instance.moveSelection(self["list"].instance.pageDown)
                self.run()
        def right(self):
                self["list"].instance.moveSelection(self["list"].instance.pageDown)
                self.run()
-               self.updateList()
\ No newline at end of file
+               self.updateList()