#
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 2 Jul 2008 12:05:57 +0000 (12:05 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 2 Jul 2008 12:05:57 +0000 (12:05 +0000)
# Some Bugfixes related to locationstuff.patch
#
# ritzMo:
#  - fix a missing member in ConfigLocations (argument was ignord but
# expected later in the code)
#  - take care of the fact that an instant record might not be saved in
# default record location (fixes error when no hdd installed)
#  - remove overly complex Screen.close override in LocationBox
#  - fix deathscreen in LocationBox context menu
# Anders Holst:
#  - fix deathscreen when default record location not in bookmarks when
# editing timers which would be stored there
#  - don't ignore inhibitDirs if inhibitMounts is unset
#  - hide potentially dangerous folders for all users in MovieLocationBox
#  (previously / was hidden for userlevel < expert)
#

lib/python/Components/FileList.py
lib/python/Components/config.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/LocationBox.py
lib/python/Screens/TimerEntry.py

index 5824747..3e38bd0 100644 (file)
@@ -127,8 +127,8 @@ class FileList(MenuList):
 
                if directory is None and self.showMountpoints: # present available mountpoints
                        for p in harddiskmanager.getMountedPartitions():
-                               path = os_path.join(p.mountpoint,"")
-                               if not self.inhibitMounts or ((not path in self.inhibitMounts) and (not self.inParentDirs(path, self.inhibitDirs))):
+                               path = os_path.join(p.mountpoint, "")
+                               if path not in self.inhibitMounts and not self.inParentDirs(path, self.inhibitDirs):
                                        self.list.append(FileEntryComponent(name = p.description, absolute = path, isDir = True))
                        files = [ ]
                        directories = [ ]
index 529b602..8cb7098 100644 (file)
@@ -935,6 +935,7 @@ class ConfigSet(ConfigElement):
 class ConfigLocations(ConfigElement):
        def __init__(self, default = [], visible_width = False):
                ConfigElement.__init__(self)
+               self.visible_width = visible_width
                self.pos = -1
                self.default = default
                self.locations = []
index 85f3420..3a735de 100644 (file)
@@ -31,7 +31,7 @@ from Screens.TimeDateInput import TimeDateInput
 from ServiceReference import ServiceReference
 
 from Tools import Notifications
-from Tools.Directories import SCOPE_HDD, resolveFilename
+from Tools.Directories import SCOPE_HDD, resolveFilename, pathExists
 
 from enigma import eTimer, eServiceCenter, eDVBServicePMTHandler, iServiceInformation, \
        iPlayableService, eServiceReference, eDVBResourceManager, iFrontendInformation, eEPGCache
@@ -1487,9 +1487,13 @@ class InfoBarInstantRecord:
                        self.session.nav.RecordTimer.timeChanged(self.recording[self.selectedEntry])
 
        def instantRecord(self):
+               dir = config.movielist.last_videodir.value
+               if not pathExists(dir):
+                       dir = resolveFilename(SCOPE_HDD)
                try:
-                       stat = os_stat(resolveFilename(SCOPE_HDD))
+                       stat = os_stat(dir)
                except:
+                       # XXX: this message is a little odd as we might be recording to a remote device
                        self.session.open(MessageBox, _("No HDD found or HDD not initialized!"), MessageBox.TYPE_ERROR)
                        return
 
index 132f140..6d36033 100644 (file)
@@ -325,12 +325,17 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen):
                else:
                        return self["booklist"].getCurrent()
 
-       def selectConfirmed(self, res):
-               if res:
+       def selectConfirmed(self, ret):
+               if ret:
                        ret = ''.join([self.getPreferredFolder(), self.filename])
-                       if self.realBookmarks and self.autoAdd and not ret in self.bookmarks:
-                               self.bookmarks.append(self.getPreferredFolder())
-                               self.bookmarks.sort()
+                       if self.realBookmarks:
+                               if self.autoAdd and not ret in self.bookmarks:
+                                       self.bookmarks.append(self.getPreferredFolder())
+                                       self.bookmarks.sort()
+
+                               if self.bookmarks != self.realBookmarks.value:
+                                       self.realBookmarks.value = self.bookmarks
+                                       self.realBookmarks.save()
                        self.close(ret)
 
        def select(self):
@@ -355,16 +360,10 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen):
                                        _("There might not be enough Space on the selected Partition.\nDo you really want to continue?"),
                                        type = MessageBox.TYPE_YESNO
                                )
-                               # No minimum free Space means we can safely close
+                       # No minimum free Space means we can safely close
                        else:
                                self.selectConfirmed(True)
 
-       def close(self, ret):
-               if ret and self.realBookmarks and self.bookmarks != self.realBookmarks.value:
-                       self.realBookmarks.value = self.bookmarks
-                       self.realBookmarks.save()
-               Screen.close(self, ret)
-
        def changeName(self):
                if self.filename != "":
                        # TODO: Add Information that changing extension is bad? disallow?
@@ -402,13 +401,13 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen):
                        menu = []
                        if self.currList == "filelist":
                                menu.append((_("switch to bookmarks"), self.switchToBookList))
-                               menu.append((_("add bookmark"), self.AddRemoveBookmark))
+                               menu.append((_("add bookmark"), self.addRemoveBookmark))
                                if self.editDir:
                                        menu.append((_("create directory"), self.createDir))
                                        menu.append((_("remove directory"), self.removeDir))
                        else:
                                menu.append((_("switch to filelist"), self.switchToFileList))
-                               menu.append((_("remove bookmark"), self.AddRemoveBookmark))
+                               menu.append((_("remove bookmark"), self.addRemoveBookmark))
 
                        self.session.openWithCallback(
                                self.menuCallback,
@@ -501,7 +500,5 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen):
 
 class MovieLocationBox(LocationBox):
        def __init__(self, session, text, dir, minFree = None):
-               inhibitMounts = []
-               if config.usage.setup_level.index < 2: # -expert
-                       inhibitMounts.append("/")
-               LocationBox.__init__(self, session, text = text, currDir = dir, bookmarks = config.movielist.videodirs, autoAdd = True, editDir = True, inhibitMounts = inhibitMounts, minFree = minFree)
+               inhibitDirs = ["/bin", "/boot", "/dev", "/etc", "/lib", "/proc", "/sbin", "/sys", "/usr", "/var"]
+               LocationBox.__init__(self, session, text = text, currDir = dir, bookmarks = config.movielist.videodirs, autoAdd = True, editDir = True, inhibitDirs = inhibitDirs, minFree = minFree)
index b490f6d..ca1a392 100644 (file)
@@ -99,10 +99,11 @@ class TimerEntry(Screen, ConfigListScreen):
                        self.timerentry_enddate = ConfigDateTime(default = self.timer.end, formatstring =  _("%d.%B %Y"), increment = 86400)
                        self.timerentry_endtime = ConfigClock(default = self.timer.end)
 
+                       default = self.timer.dirname or resolveFilename(SCOPE_HDD)
                        tmp = config.movielist.videodirs.value
-                       if self.timer.dirname and not self.timer.dirname in tmp:
-                               tmp.append(self.timer.dirname)
-                       self.timerentry_dirname = ConfigSelection(default = self.timer.dirname or resolveFilename(SCOPE_HDD), choices = tmp)
+                       if default not in tmp:
+                               tmp.append(default)
+                       self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)
 
                        self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)