save and restore root
authorRonny Strutz <ronny.strutz@multimedia-labs.de>
Tue, 15 Nov 2005 16:14:45 +0000 (16:14 +0000)
committerRonny Strutz <ronny.strutz@multimedia-labs.de>
Tue, 15 Nov 2005 16:14:45 +0000 (16:14 +0000)
lib/python/Screens/ChannelSelection.py

index 6c8164b..d256d3e 100644 (file)
@@ -63,6 +63,7 @@ class ChannelSelection(Screen):
        def lastService(self):
                self.lastServiceTimer.stop()
                #zap to last running tv service
        def lastService(self):
                self.lastServiceTimer.stop()
                #zap to last running tv service
+               self.setRoot(eServiceReference(config.tv.lastroot.value))
                self.session.nav.playService(eServiceReference(config.tv.lastservice.value))
        
        def __init__(self, session):
                self.session.nav.playService(eServiceReference(config.tv.lastservice.value))
        
        def __init__(self, session):
@@ -71,7 +72,7 @@ class ChannelSelection(Screen):
                #config for lastservice
                config.tv = ConfigSubsection();
                config.tv.lastservice = configElement("config.tv.lastservice", configText, "", 0);
                #config for lastservice
                config.tv = ConfigSubsection();
                config.tv.lastservice = configElement("config.tv.lastservice", configText, "", 0);
-
+               config.tv.lastroot = configElement("config.tv.lastroot", configText, "", 0);
                
                self.entry_marked = False
                self.movemode = False
                
                self.entry_marked = False
                self.movemode = False
@@ -86,7 +87,9 @@ class ChannelSelection(Screen):
                self["key_blue"] = Button("Favourites")
                
                self["list"] = ServiceList()
                self["key_blue"] = Button("Favourites")
                
                self["list"] = ServiceList()
-               self.setRoot(eServiceReference("""1:0:1:0:0:0:0:0:0:0:(type == 1)"""))
+               
+               if config.tv.lastroot.value == "":
+                       self.setRoot(eServiceReference("""1:0:1:0:0:0:0:0:0:0:(type == 1)"""))
                
                #self["okbutton"] = Button("ok", [self.channelSelected])
 
                
                #self["okbutton"] = Button("ok", [self.channelSelected])
 
@@ -182,6 +185,7 @@ class ChannelSelection(Screen):
                                        self.mutableList = list.startEdit()
                                else:
                                        self.mutableList = None
                                        self.mutableList = list.startEdit()
                                else:
                                        self.mutableList = None
+                       self.saveRoot(root)
                        self["list"].setRoot(root)
 
        def clearMarks(self):
                        self["list"].setRoot(root)
 
        def clearMarks(self):
@@ -242,6 +246,11 @@ class ChannelSelection(Screen):
                list = self["list"]
                list.setMode(list.MODE_FAVOURITES)
 
                list = self["list"]
                list.setMode(list.MODE_FAVOURITES)
 
+       def saveRoot(self, root):
+               if root is not None:
+                       config.tv.lastroot.value = root.toString()
+                       config.tv.lastroot.save()
+
        def saveChannel(self):
                ref = self.session.nav.getCurrentlyPlayingServiceReference()
                if ref is not None:
        def saveChannel(self):
                ref = self.session.nav.getCurrentlyPlayingServiceReference()
                if ref is not None: