From: ghost Date: Tue, 3 Nov 2009 18:40:57 +0000 (+0100) Subject: Merge branch 'bug_236_recordpath' into experimental X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=18469e4dedcfe75e8128b489774f79fb790a23da;hp=-c Merge branch 'bug_236_recordpath' into experimental --- 18469e4dedcfe75e8128b489774f79fb790a23da diff --combined lib/python/Components/config.py index 789ec32,450c302..876e3a3 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@@ -1,6 -1,6 +1,6 @@@ from enigma import getPrevAsciiCode from Tools.NumericalTextInput import NumericalTextInput - from Tools.Directories import resolveFilename, SCOPE_CONFIG + from Tools.Directories import resolveFilename, SCOPE_CONFIG, fileExists from Components.Harddisk import harddiskmanager from copy import copy as copy_copy from os import path as os_path @@@ -1017,42 -1017,6 +1017,42 @@@ class ConfigPassword(ConfigText) ConfigText.onDeselect(self, session) self.hidden = True +# lets the user select between [min, min+stepwidth, min+(stepwidth*2)..., maxval] with maxval <= max depending +# on the stepwidth +# min, max, stepwidth, default are int values +# wraparound: pressing RIGHT key at max value brings you to min value and vice versa if set to True +class ConfigSelectionNumber(ConfigSelection): + def __init__(self, min, max, stepwidth, default = None, wraparound = False): + self.wraparound = wraparound + if default is None: + default = min + default = str(default) + choices = [] + step = min + while step <= max: + choices.append(str(step)) + step += stepwidth + + ConfigSelection.__init__(self, choices, default) + + def getValue(self): + return int(self.text) + + def setValue(self, val): + self.text = str(val) + + def handleKey(self, key): + if not self.wraparound: + if key == KEY_RIGHT: + if len(self.choices) == (self.choices.index(self.value) + 1): + return + if key == KEY_LEFT: + if self.choices.index(self.value) == 0: + return + ConfigSelection.handleKey(self, key) + + + class ConfigNumber(ConfigText): def __init__(self, default = 0): ConfigText.__init__(self, str(default), fixed_size = False) @@@ -1285,7 -1249,6 +1285,6 @@@ class ConfigLocations(ConfigElement) self.default = default self.locations = [] self.mountpoints = [] - harddiskmanager.on_partition_list_change.append(self.mountpointsChanged) self.value = default[:] def setValue(self, value): @@@ -1322,7 -1285,7 +1321,7 @@@ locations = [[x, None, False, False] for x in tmp] self.refreshMountpoints() for x in locations: - if os_path.exists(x[0]): + if fileExists(x[0]): x[1] = self.getMountpoint(x[0]) x[2] = True self.locations = locations @@@ -1341,20 -1304,11 +1340,11 @@@ return False return self.tostring([x[0] for x in locations]) != sv - def mountpointsChanged(self, action, dev): - print "Mounts changed: ", action, dev - mp = dev.mountpoint+"/" - if action == "add": - self.addedMount(mp) - elif action == "remove": - self.removedMount(mp) - self.refreshMountpoints() - def addedMount(self, mp): for x in self.locations: if x[1] == mp: x[2] = True - elif x[1] == None and os_path.exists(x[0]): + elif x[1] == None and fileExists(x[0]): x[1] = self.getMountpoint(x[0]) x[2] = True @@@ -1364,7 -1318,7 +1354,7 @@@ x[2] = False def refreshMountpoints(self): - self.mountpoints = [p.mountpoint + "/" for p in harddiskmanager.getMountedPartitions() if p.mountpoint != "/"] + self.mountpoints = [p.mountpoint for p in harddiskmanager.getMountedPartitions() if p.mountpoint != "/"] self.mountpoints.sort(key = lambda x: -len(x)) def checkChangedMountpoints(self): diff --combined lib/python/Screens/InfoBar.py index 59cc21d,be1407d..a15c7ac --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@@ -16,7 -16,7 +16,7 @@@ from Screens.InfoBarGenerics import Inf InfoBarSubserviceSelection, InfoBarShowMovies, InfoBarTimeshift, \ InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \ InfoBarSummarySupport, InfoBarMoviePlayerSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \ - InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport, InfoBarJobman + InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarServiceErrorPopupSupport, InfoBarJobman profile("LOAD:InitBar_Components") from Components.ActionMap import HelpableActionMap @@@ -32,7 -32,7 +32,7 @@@ class InfoBar(InfoBarBase, InfoBarShowH HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, - InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport, InfoBarJobman, + InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarServiceErrorPopupSupport, InfoBarJobman, Screen): ALLOW_SUSPEND = True @@@ -56,7 -56,7 +56,7 @@@ InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \ InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \ InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarJobman, \ - InfoBarSleepTimer, InfoBarPlugins, InfoBarServiceErrorPopupSupport: + InfoBarPlugins, InfoBarServiceErrorPopupSupport: x.__init__(self) self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))])) @@@ -212,7 -212,6 +212,6 @@@ class MoviePlayer(InfoBarBase, InfoBarS return if answer in ("quit", "quitanddeleteconfirmed"): - config.movielist.last_videodir.cancel() self.close() elif answer == "movielist": ref = self.session.nav.getCurrentlyPlayingServiceReference() diff --combined lib/python/Screens/InfoBarGenerics.py index 2cbfeb7,b27df9d..ed41bb2 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@@ -10,6 -10,7 +10,7 @@@ from Components.ServiceEventTracker imp from Components.Sources.Boolean import Boolean from Components.config import config, ConfigBoolean, ConfigClock from Components.SystemInfo import SystemInfo + from Components.UsageConfig import preferredInstantRecordPath, defaultMoviePath from EpgSelection import EPGSelection from Plugins.Plugin import PluginDescriptor @@@ -24,11 -25,12 +25,11 @@@ from Screens.TimerSelection import Time from Screens.PictureInPicture import PictureInPicture from Screens.SubtitleDisplay import SubtitleDisplay from Screens.RdsDisplay import RdsInfoDisplay, RassInteractive -from Screens.SleepTimerEdit import SleepTimerEdit from Screens.TimeDateInput import TimeDateInput from ServiceReference import ServiceReference from Tools import Notifications - from Tools.Directories import SCOPE_HDD, resolveFilename, fileExists + from Tools.Directories import fileExists from enigma import eTimer, eServiceCenter, eDVBServicePMTHandler, iServiceInformation, \ iPlayableService, eServiceReference, eEPGCache @@@ -1356,6 -1358,17 +1357,6 @@@ class InfoBarJobman job_manager.in_background = in_background # depends on InfoBarExtensions -class InfoBarSleepTimer: - def __init__(self): - self.addExtension((self.getSleepTimerName, self.showSleepTimerSetup, lambda: True), "1") - - def getSleepTimerName(self): - return _("Sleep Timer") - - def showSleepTimerSetup(self): - self.session.open(SleepTimerEdit) - -# depends on InfoBarExtensions class InfoBarPiP: def __init__(self): try: @@@ -1484,7 -1497,7 +1485,7 @@@ class InfoBarInstantRecord if isinstance(serviceref, eServiceReference): serviceref = ServiceReference(serviceref) - recording = RecordTimerEntry(serviceref, begin, end, name, description, eventid, dirname = config.movielist.last_videodir.value) + recording = RecordTimerEntry(serviceref, begin, end, name, description, eventid, dirname = preferredInstantRecordPath()) recording.dontSave = True if event is None or limitEvent == False: @@@ -1585,9 -1598,9 +1586,9 @@@ self.session.nav.RecordTimer.timeChanged(entry) def instantRecord(self): - dir = config.movielist.last_videodir.value - if not fileExists(dir, 'w'): - dir = resolveFilename(SCOPE_HDD) + dir = preferredInstantRecordPath() + if not dir or not fileExists(dir, 'w'): + dir = defaultMoviePath() try: stat = os_stat(dir) except: