X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/51550aa81c726aedfa7159af0e67f8bcd5fb8a2f..954ca139746278ae94ba5a5b0aaccbf5a2dcd13b:/lib/python/Screens/LocationBox.py diff --git a/lib/python/Screens/LocationBox.py b/lib/python/Screens/LocationBox.py index e41601a9..389d3624 100644 --- a/lib/python/Screens/LocationBox.py +++ b/lib/python/Screens/LocationBox.py @@ -125,7 +125,7 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen): "up": self.up, "down": self.down, "ok": (self.ok, _("select")), - "back": (self.cancel, _("cancel")), + "back": (self.cancel, _("Cancel")), }, -2) self["ColorActions"] = LocationBoxActionMap(self, "ColorActions", @@ -326,7 +326,7 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen): def selectConfirmed(self, ret): if ret: - ret = ''.join([self.getPreferredFolder(), self.filename]) + ret = ''.join((self.getPreferredFolder(), self.filename)) if self.realBookmarks: if self.autoAdd and not ret in self.bookmarks: self.bookmarks.append(self.getPreferredFolder()) @@ -390,23 +390,28 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen): # Write Combination of Folder & Filename when Folder is valid currFolder = self.getPreferredFolder() if currFolder is not None: - self["target"].setText(''.join([currFolder, self.filename])) + self["target"].setText(''.join((currFolder, self.filename))) # Display a Warning otherwise else: self["target"].setText(_("Invalid Location")) def showMenu(self): if not self.userMode and self.realBookmarks: - menu = [] if self.currList == "filelist": - menu.append((_("switch to bookmarks"), self.switchToBookList)) - menu.append((_("add bookmark"), self.addRemoveBookmark)) + menu = [ + (_("switch to bookmarks"), self.switchToBookList), + (_("add bookmark"), self.addRemoveBookmark) + ] if self.editDir: - menu.append((_("create directory"), self.createDir)) - menu.append((_("remove directory"), self.removeDir)) + menu.extend(( + (_("create directory"), self.createDir), + (_("remove directory"), self.removeDir) + )) else: - menu.append((_("switch to filelist"), self.switchToFileList)) - menu.append((_("remove bookmark"), self.addRemoveBookmark)) + menu = ( + (_("switch to filelist"), self.switchToFileList) + (_("remove bookmark"), self.addRemoveBookmark) + ) self.session.openWithCallback( self.menuCallback, @@ -498,6 +503,37 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen): return str(type(self)) + "(" + self.text + ")" class MovieLocationBox(LocationBox): + skinName = "LocationBox" + def __init__(self, session, text, dir, minFree = None): 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) + +class TimeshiftLocationBox(LocationBox): + + skinName = "LocationBox" # XXX: though we could use a custom skin or inherit the hardcoded one we stick with the original :-) + + def __init__(self, session): + inhibitDirs = ["/bin", "/boot", "/dev", "/etc", "/lib", "/proc", "/sbin", "/sys", "/usr", "/var"] + LocationBox.__init__( + self, + session, + text = _("Where to save temporary timeshift recordings?"), + currDir = config.usage.timeshift_path.value, + bookmarks = config.usage.allowed_timeshift_paths, + autoAdd = True, + editDir = True, + inhibitDirs = inhibitDirs, + minFree = 1024 # XXX: the same requirement is hardcoded in servicedvb.cpp + ) + + def cancel(self): + config.usage.timeshift_path.cancel() + LocationBox.cancel(self) + + def selectConfirmed(self, ret): + if ret: + config.usage.timeshift_path.value = self.getPreferredFolder() + config.usage.timeshift_path.save() + LocationBox.selectConfirmed(self, ret) +