X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/eea4ecaf18d01dbdbe1590bc7b6e4c6f9da1fe8b..f16e3ef9d1cf770517a6b21cc80884ea845d7ed4:/lib/python/Screens/LocationBox.py diff --git a/lib/python/Screens/LocationBox.py b/lib/python/Screens/LocationBox.py index 68d4f772..29d94f55 100644 --- a/lib/python/Screens/LocationBox.py +++ b/lib/python/Screens/LocationBox.py @@ -163,11 +163,11 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen): }) # Run some functions when shown - self.onShown.extend([ + self.onShown.extend(( boundFunction(self.setTitle, windowTitle), self.updateTarget, self.showHideRename, - ]) + )) self.onLayoutFinish.append(self.switchToFileListOnStart) @@ -241,7 +241,7 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen): ) def createDirCallback(self, res): - if res is not None and len(res): + if res: path = os.path.join(self["filelist"].current_directory, res) if not pathExists(path): if not createDir(path): @@ -289,6 +289,11 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen): else: self["filelist"].refresh() self.removeBookmark(name, True) + val = self.realBookmarks and self.realBookmarks.value + if val and name in val: + val.remove(name) + self.realBookmarks.value = val + self.realBookmarks.save() def up(self): self[self.currList].up() @@ -326,7 +331,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 +395,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, @@ -449,7 +459,7 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen): def selectByStart(self): # Don't do anything on initial call - if not len(self.quickselect): + if not self.quickselect: return # Don't select if no dir @@ -498,16 +508,12 @@ 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) + self.skinName = "LocationBox" 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__( @@ -519,8 +525,9 @@ class TimeshiftLocationBox(LocationBox): autoAdd = True, editDir = True, inhibitDirs = inhibitDirs, - minFree = 1024 # XXX: the same requirement is hardcoded in servicedvb.cpp + minFree = 1024 # the same requirement is hardcoded in servicedvb.cpp ) + self.skinName = "LocationBox" def cancel(self): config.usage.timeshift_path.cancel()