show ChannelSelection on first run (after the start wizard)
[enigma2.git] / lib / python / Screens / InfoBarGenerics.py
index 34a4821ed692ab75639d10c0f5aecda70877ba93..7a7eb8ff78c3a9cf86cfe1de33d025980763c3c5 100644 (file)
@@ -4,7 +4,7 @@ from Components.ActionMap import NumberActionMap
 from Components.Label import *
 from Components.ProgressBar import *
 from Components.config import configfile, configsequencearg
-from Components.config import config, configElement, ConfigSubsection, configSequence
+from Components.config import config, configElement, ConfigSubsection, configSequence, configElementBoolean
 from ChannelSelection import ChannelSelection, BouquetSelector
 
 from Components.Pixmap import Pixmap, PixmapConditional
@@ -269,12 +269,17 @@ class InfoBarNumberZap:
                        self.servicelist.setCurrentSelection(service) #select the service in servicelist
                        self.servicelist.zap()
 
+config.misc.initialchannelselection = configElementBoolean("config.misc.initialchannelselection", 1);
+
 class InfoBarChannelSelection:
        """ ChannelSelection - handles the channelSelection dialog and the initial 
        channelChange actions which open the channelSelection dialog """
        def __init__(self):
                #instantiate forever
                self.servicelist = self.session.instantiateDialog(ChannelSelection)
+               
+               if config.misc.initialchannelselection.value == 1:
+                       self.onShown.append(self.firstRun)
 
                self["ChannelSelectActions"] = HelpableActionMap(self, "InfobarChannelSelection",
                        {
@@ -286,6 +291,12 @@ class InfoBarChannelSelection:
                                "historyNext": (self.historyNext, _("next channel in history"))
                        })
 
+       def firstRun(self):
+               self.onShown.remove(self.firstRun)
+               config.misc.initialchannelselection.value = 0
+               config.misc.initialchannelselection.save()
+               self.switchChannelDown()
+               
        def historyBack(self):
                self.servicelist.historyBack()
 
@@ -554,8 +565,9 @@ class InfoBarSeek:
                                if action[:5] == "seek:":
                                        time = int(action[5:])
                                        self.screen.seekRelative(time * 90000)
+                                       return 1
                                else:
-                                       HelpableActionMap.action(self, contexts, action)
+                                       return HelpableActionMap.action(self, contexts, action)
 
                self["SeekActions"] = InfoBarSeekActionMap(self, "InfobarSeekActions", 
                        {
@@ -805,12 +817,12 @@ class InfoBarSeek:
                if seekable is not None:
                        seekable.seekRelative(1, diff)
 
-from Screens.PVRState import PVRState
+from Screens.PVRState import PVRState, TimeshiftState
 
 class InfoBarPVRState:
-       def __init__(self):
+       def __init__(self, screen=PVRState):
                self.onPlayStateChanged.append(self.__playStateChanged)
-               self.pvrStateDialog = self.session.instantiateDialog(PVRState)
+               self.pvrStateDialog = self.session.instantiateDialog(screen)
                self.onShow.append(self.__mayShow)
                self.onHide.append(self.pvrStateDialog.hide)
        
@@ -823,6 +835,11 @@ class InfoBarPVRState:
                self.pvrStateDialog["state"].setText(playstateString)
                self.__mayShow()
 
+class InfoBarTimeshiftState(InfoBarPVRState):
+       def __init__(self):
+               InfoBarPVRState.__init__(self, screen=TimeshiftState)
+
+
 class InfoBarShowMovies:
 
        # i don't really like this class. 
@@ -884,6 +901,7 @@ class InfoBarTimeshift:
 
                self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
                        {
+                               iPlayableService.evStart: self.__serviceStarted,
                                iPlayableService.evSeekableStatusChanged: self.__seekableStatusChanged
                        })
        
@@ -903,7 +921,9 @@ class InfoBarTimeshift:
                        print "hu, timeshift already enabled?"
                else:
                        if not ts.startTimeshift():
+                               import time
                                self.timeshift_enabled = 1
+                               self.pvrStateDialog["timeshift"].setRelative(time.time())
                                
                                # PAUSE.
                                self.setSeekState(self.SEEK_STATE_PAUSE)
@@ -984,6 +1004,10 @@ class InfoBarTimeshift:
                print "timeshift activate:", enabled
                self["TimeshiftActivateActions"].setEnabled(enabled)
 
+       def __serviceStarted(self):
+               self.timeshift_enabled = False
+               self.__seekableStatusChanged()
+
 from RecordTimer import parseEvent
 
 class InfoBarInstantRecord: