fix selection when delete latest timer in list
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 20 Jan 2006 23:00:24 +0000 (23:00 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 20 Jan 2006 23:00:24 +0000 (23:00 +0000)
lib/python/Components/TimerList.py
lib/python/Screens/TimerEdit.py

index d79187d..8bb6a0d 100644 (file)
@@ -76,7 +76,16 @@ class TimerList(HTMLComponent, GUIComponent):
                self.instance = eListbox(parent)
                self.instance.setContent(self.l)
                self.instance.setItemHeight(70)
                self.instance = eListbox(parent)
                self.instance.setContent(self.l)
                self.instance.setItemHeight(70)
-       
+
+       def moveToIndex(self, index):
+               self.instance.moveSelectionTo(index)
+
+       def getCurrentIndex(self):
+               return self.instance.getCurrentIndex()
+
+       def moveDown(self):
+               self.instance.moveSelection(self.instance.moveDown)
+
        def GUIdelete(self):
                self.instance.setContent(None)
                self.instance = None
        def GUIdelete(self):
                self.instance.setContent(None)
                self.instance = None
index 560ec94..c0896f4 100644 (file)
@@ -48,8 +48,13 @@ class TimerEditList(Screen):
                #self.session.open(TimerEdit, self["timerlist"].getCurrent()[0])
                
        def removeTimer(self):
                #self.session.open(TimerEdit, self["timerlist"].getCurrent()[0])
                
        def removeTimer(self):
-               # FIXME doesn't work...
-               self.session.nav.RecordTimer.removeEntry(self["timerlist"].getCurrent()[0])
+               list = self["timerlist"]
+               currentIndex = list.getCurrentIndex()
+               list.moveDown()
+               if list.getCurrentIndex() == currentIndex:
+                       currentIndex -= 1
+                       list.moveToIndex(currentIndex)
+               self.session.nav.RecordTimer.removeEntry(list.getCurrent()[0])
                self.refill()
        
        def refill(self):
                self.refill()
        
        def refill(self):