add possibility to choose the finished timer timerlist position in usage config
authorghost <andreas.monzner@multimedia-labs.de>
Fri, 18 Mar 2011 00:03:09 +0000 (01:03 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Fri, 18 Mar 2011 00:03:09 +0000 (01:03 +0100)
refs bug #713

data/setup.xml
lib/python/Components/UsageConfig.py
lib/python/Screens/TimerEdit.py

index c5eb07f..5f7cbf6 100755 (executable)
@@ -32,6 +32,7 @@
                        <item level="1" text="Alternative radio mode">config.usage.e1like_radio_mode</item>
                        <item level="1" text="Action on long powerbutton press">config.usage.on_long_powerpress</item>
                        <item level="1" text="Action on short powerbutton press">config.usage.on_short_powerpress</item>
                        <item level="1" text="Alternative radio mode">config.usage.e1like_radio_mode</item>
                        <item level="1" text="Action on long powerbutton press">config.usage.on_long_powerpress</item>
                        <item level="1" text="Action on short powerbutton press">config.usage.on_short_powerpress</item>
+                       <item level="1" text="Position of finished Timers in Timerlist">config.usage.timerlist_finished_timer_position</item>
                        <item level="0" text="Infobar timeout">config.usage.infobar_timeout</item>
                        <item level="1" text="12V output" requires="12V_Output">config.usage.output_12V</item>
                        <item level="0" text="Show event-progress in channel selection">config.usage.show_event_progress_in_servicelist</item>
                        <item level="0" text="Infobar timeout">config.usage.infobar_timeout</item>
                        <item level="1" text="12V output" requires="12V_Output">config.usage.output_12V</item>
                        <item level="0" text="Show event-progress in channel selection">config.usage.show_event_progress_in_servicelist</item>
index a265a16..acbc342 100644 (file)
@@ -113,6 +113,8 @@ def InitUsageConfig():
                ("step", _("Singlestep (GOP)")),
                ("last", _("Last speed")) ])
 
                ("step", _("Singlestep (GOP)")),
                ("last", _("Last speed")) ])
 
+       config.usage.timerlist_finished_timer_position = ConfigSelection(default = "beginning", choices = [("beginning", _("at beginning")), ("end", _("at end"))])
+
        def updateEnterForward(configElement):
                if not configElement.value:
                        configElement.value = [2]
        def updateEnterForward(configElement):
                if not configElement.value:
                        configElement.value = [2]
index bf60496..6e8859e 100644 (file)
@@ -13,6 +13,7 @@ from ServiceReference import ServiceReference
 from TimerEntry import TimerEntry, TimerLog
 from Tools.BoundFunction import boundFunction
 from time import time
 from TimerEntry import TimerEntry, TimerLog
 from Tools.BoundFunction import boundFunction
 from time import time
+from timer import TimerEntry
 
 class TimerEditList(Screen):
        EMPTY = 0
 
 class TimerEditList(Screen):
        EMPTY = 0
@@ -172,11 +173,20 @@ class TimerEditList(Screen):
                        self.key_blue_choice = self.EMPTY
 
        def fillTimerList(self):
                        self.key_blue_choice = self.EMPTY
 
        def fillTimerList(self):
+               #helper function to move finished timers to end of list
+               def eol_compare(x, y):
+                       if x[0].state != y[0].state and x[0].state == TimerEntry.StateEnded or y[0].state == TimerEntry.StateEnded:
+                               return cmp(x[0].state, y[0].state)
+                       return cmp(x[0].begin, x[1].begin)
+
                list = self.list
                del list[:]
                list.extend([(timer, False) for timer in self.session.nav.RecordTimer.timer_list])
                list.extend([(timer, True) for timer in self.session.nav.RecordTimer.processed_timers])
                list = self.list
                del list[:]
                list.extend([(timer, False) for timer in self.session.nav.RecordTimer.timer_list])
                list.extend([(timer, True) for timer in self.session.nav.RecordTimer.processed_timers])
-               list.sort(key = lambda x: x[0].begin)
+               if config.usage.timerlist_finished_timer_position.index: #end of list
+                       list.sort(cmp = eol_compare)
+               else:
+                       list.sort(key = lambda x: x[0].begin)
 
        def showLog(self):
                cur=self["timerlist"].getCurrent()
 
        def showLog(self):
                cur=self["timerlist"].getCurrent()