prevent endless loop
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Sun, 11 Jun 2006 22:16:21 +0000 (22:16 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Sun, 11 Jun 2006 22:16:21 +0000 (22:16 +0000)
lib/python/Screens/ChoiceBox.py

index 522ee3c57c9b268c1b92b4b6bcfc9bd97fd84681..9711da2dc5680670ed0a422ec923d00554b28f76 100644 (file)
@@ -61,14 +61,16 @@ class ChoiceBox(Screen):
        def up(self):
                while 1:
                        self["list"].instance.moveSelection(self["list"].instance.moveUp)
-                       if self["list"].l.getCurrentSelection()[0][0] != "--":
+                       if self["list"].l.getCurrentSelection()[0][0] != "--" or self["list"].l.getCurrentSelectionIndex() == 0:
                                break
                
        def down(self):
                while 1:
                        self["list"].instance.moveSelection(self["list"].instance.moveDown)
-                       if self["list"].l.getCurrentSelection()[0][0] != "--":
-                               break   
+                       if self["list"].l.getCurrentSelection()[0][0] != "--" or self["list"].l.getCurrentSelectionIndex() == len(self["list"].list) - 1:
+                               break
+
+
        def keyNumberGlobal(self, number):
                print "pressed", number
                if self.keymap.has_key(str(number)):