allows to configure the path for timeshift recordings via gui, by Moritz Venn. closes...
[enigma2.git] / lib / python / Screens / LocationBox.py
index e41601a94147e5b23e04bfe7e14c533ea37e4f65..68d4f772ca09b79ce78d36ffed764e2a2155a59f 100644 (file)
@@ -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",
@@ -498,6 +498,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)
+