green -> blue
[enigma2.git] / lib / python / Screens / MovieSelection.py
index e0bd4ab30789aff027b013f7c1c89db4048cc4d1..a2ccb79a4b10b9c0a04e9a433a4a94a0b7f1b98b 100644 (file)
@@ -7,13 +7,14 @@ from Components.DiskInfo import DiskInfo
 from Components.Pixmap import Pixmap
 from Components.Label import Label
 from Components.PluginComponent import plugins
-from Components.config import config, ConfigSubsection, ConfigInteger, configfile
+from Components.config import config, ConfigSubsection, ConfigText, ConfigInteger, configfile
 from Components.Sources.ServiceEvent import ServiceEvent
 
 from Plugins.Plugin import PluginDescriptor
 
 from Screens.MessageBox import MessageBox
 from Screens.ChoiceBox import ChoiceBox
+from Screens.LocationBox import LocationBox
 from Screens.HelpMenu import HelpableScreen
 
 from Tools.Directories import *
@@ -25,6 +26,8 @@ config.movielist = ConfigSubsection()
 config.movielist.moviesort = ConfigInteger(default=MovieList.SORT_RECORDED)
 config.movielist.listtype = ConfigInteger(default=MovieList.LISTTYPE_ORIGINAL)
 config.movielist.description = ConfigInteger(default=MovieList.HIDE_DESCRIPTION)
+# FIXME: see if this is always accessible by InfoBarGenerics
+config.movielist.last_videodir = ConfigText(default=resolveFilename(SCOPE_HDD))
 
 class MovieContextMenu(Screen):
        def __init__(self, session, csel, service):
@@ -129,7 +132,7 @@ class SelectionEventInfo:
                self["Service"] = ServiceEvent()
                self.list.connectSelChanged(self.__selectionChanged)
                self.timer = eTimer()
-               self.timer.timeout.get().append(self.updateEventInfo)
+               self.timer.callback.append(self.updateEventInfo)
                self.onShown.append(self.__selectionChanged)
 
        def __selectionChanged(self):
@@ -150,13 +153,13 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo):
                self.tags = [ ]
                self.selected_tags = None
 
-               self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + resolveFilename(SCOPE_HDD))
+               self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + config.movielist.last_videodir.value)
 
                self.movemode = False
                self.bouquet_mark_edit = False
 
                self.delayTimer = eTimer()
-               self.delayTimer.timeout.get().append(self.updateHDDData)
+               self.delayTimer.callback.append(self.updateHDDData)
 
                self["waitingtext"] = Label(_("Please wait... Loading list..."))
 
@@ -183,6 +186,13 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo):
                #self["freeDiskSpace"] = DiskInfo(resolveFilename(SCOPE_HDD), DiskInfo.FREE, update=False)
                self["freeDiskSpace"] = self.diskinfo = DiskInfo(resolveFilename(SCOPE_HDD), DiskInfo.FREE, update=False)
 
+               if config.usage.setup_level.index >= 2: # expert+
+                       self["InfobarActions"] = HelpableActionMap(self, "InfobarActions", 
+                               {
+                                       "showMovies": (self.doPathSelect, _("select the movie path")),
+                               })
+
+
                self["MovieSelectionActions"] = HelpableActionMap(self, "MovieSelectionActions",
                        {
                                "contextMenu": (self.doContext, _("menu")),
@@ -316,8 +326,25 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo):
                title = _("Recorded files...")
                if self.selected_tags is not None:
                        title += " - " + ','.join(self.selected_tags)
+               if config.usage.setup_level.index >= 2: # expert+
+                       title += "  " + config.movielist.last_videodir.value
                self.setTitle(title)
 
+       def doPathSelect(self):
+               self.session.openWithCallback(
+                       self.gotFilename,
+                       LocationBox,
+                       _("Please select the movie path..."),
+                       currDir = config.movielist.last_videodir.value
+               )
+
+       def gotFilename(self, res):
+               if res is not None and res is not config.movielist.last_videodir.value:
+                       config.movielist.last_videodir.value = res
+                       self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + res)
+                       self.reloadList()
+                       self.updateTags()
+
        def showAll(self):
                self.selected_tags = None
                self.reloadList()