From 995cb7dd936b2ec22ea414182a227ed8b2da867c Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 6 May 2010 14:24:22 +0200 Subject: Network.py,NetworkSetup.py,skin_default.xml: * Introduce new unified naming for network interfaces. * Redesign NetworkadapterSelection Screen. * small cleanups. Refs #137 , Fixes #418 --- lib/python/Components/Network.py | 51 ++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-) (limited to 'lib/python/Components') diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index b9da48d8..e8a3d459 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -26,6 +26,9 @@ class Network: self.DnsConsole = Console() self.PingConsole = Console() self.config_ready = None + self.friendlyNames = {} + self.lan_interfaces = [] + self.wlan_interfaces = [] self.getInterfaces() def onRemoteRootFS(self): @@ -309,13 +312,47 @@ class Network: return len(self.ifaces) def getFriendlyAdapterName(self, x): - # maybe this needs to be replaced by an external list. - friendlyNames = { - "eth0": _("Integrated Ethernet"), - "wlan0": _("Wireless"), - "ath0": _("Integrated Wireless") - } - return friendlyNames.get(x, x) # when we have no friendly name, use adapter name + if x in self.friendlyNames.keys(): + return self.friendlyNames.get(x, x) + else: + self.friendlyNames[x] = self.getFriendlyAdapterNaming(x) + return self.friendlyNames.get(x, x) # when we have no friendly name, use adapter name + + def getFriendlyAdapterNaming(self, iface): + if iface.startswith('eth'): + if iface not in self.lan_interfaces and len(self.lan_interfaces) == 0: + self.lan_interfaces.append(iface) + return _("LAN connection") + elif iface not in self.lan_interfaces and len(self.lan_interfaces) >= 1: + self.lan_interfaces.append(iface) + return _("LAN connection") + " " + str(len(self.lan_interfaces)) + else: + if iface not in self.wlan_interfaces and len(self.wlan_interfaces) == 0: + self.wlan_interfaces.append(iface) + return _("WLAN connection") + elif iface not in self.wlan_interfaces and len(self.wlan_interfaces) >= 1: + self.wlan_interfaces.append(iface) + return _("WLAN connection") + " " + str(len(self.wlan_interfaces)) + + def getFriendlyAdapterDescription(self, iface): + if iface == 'eth0': + return _("Internal LAN adapter.") + else: + classdir = "/sys/class/net/" + iface + "/device/" + driverdir = "/sys/class/net/" + iface + "/device/driver/" + if os_path.exists(classdir): + files = listdir(classdir) + if 'driver' in files: + if os_path.realpath(driverdir).endswith('ath_pci'): + return _("Atheros")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + elif os_path.realpath(driverdir).endswith('zd1211b'): + return _("Zydas")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + elif os_path.realpath(driverdir).endswith('rt73'): + return _("Ralink")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + else: + return _("Unknown network adapter.") + else: + return _("Unknown network adapter.") def getAdapterName(self, iface): return iface -- cgit v1.2.3 From 85e468fa62411c066f23d64de384711aa2b35fa8 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 7 May 2010 12:49:48 +0200 Subject: mytest.py: load bouquets before parental control init and remove strange hack in parental control this fixes bug #532 --- lib/python/Components/ParentalControl.py | 11 +---------- mytest.py | 6 ++++-- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'lib/python/Components') diff --git a/lib/python/Components/ParentalControl.py b/lib/python/Components/ParentalControl.py index 9942bca7..63b5ccfb 100644 --- a/lib/python/Components/ParentalControl.py +++ b/lib/python/Components/ParentalControl.py @@ -55,11 +55,10 @@ def InitParentalControl(): class ParentalControl: def __init__(self): #Do not call open on init, because bouquets are not ready at that moment -# self.open() + self.open() self.serviceLevel = {} #Instead: Use Flags to see, if we already initialized config and called open self.configInitialized = False - self.filesOpened = False #This is the timer that is used to see, if the time for caching the pin is over #Of course we could also work without a timer and compare the times every #time we call isServicePlayable. But this might probably slow down zapping, @@ -89,9 +88,6 @@ class ParentalControl: def isServicePlayable(self, ref, callback): if not config.ParentalControl.configured.value or not config.ParentalControl.servicepinactive.value: return True - #Check if we already read the whitelists and blacklists. If not: call open - if self.filesOpened == False: - self.open() #Check if configuration has already been read or if the significant values have changed. #If true: read the configuration if self.configInitialized == False or self.storeServicePin != config.ParentalControl.storeservicepin.value or self.storeServicePinCancel != config.ParentalControl.storeservicepincancel.value: @@ -153,8 +149,6 @@ class ParentalControl: def getProtectionType(self, service): #New method used in ParentalControlList: This method does not only return #if a service is protected or not, it also returns, why (whitelist or blacklist, service or bouquet) - if self.filesOpened == False: - self.open() sImage = "" if (config.ParentalControl.type.value == LIST_WHITELIST): if self.whitelist.has_key(service): @@ -319,14 +313,11 @@ class ParentalControl: def save(self): # we need to open the files in case we havent's read them yet - if not self.filesOpened: - self.open() self.saveListToFile(LIST_BLACKLIST) self.saveListToFile(LIST_WHITELIST) def open(self): self.openListFromFile(LIST_BLACKLIST) self.openListFromFile(LIST_WHITELIST) - self.filesOpened = True parentalControl = ParentalControl() diff --git a/mytest.py b/mytest.py index 4b687e05..a3cfb5a2 100755 --- a/mytest.py +++ b/mytest.py @@ -30,6 +30,9 @@ from Screens.SimpleSummary import SimpleSummary from sys import stdout, exc_info +profile("Bouquets") +eDVBDB.getInstance().reloadBouquets() + profile("ParentalControl") from Components.ParentalControl import InitParentalControl InitParentalControl() @@ -45,8 +48,7 @@ from Tools.Directories import InitFallbackFiles, resolveFilename, SCOPE_PLUGINS, from Components.config import config, configfile, ConfigText, ConfigYesNo, ConfigInteger, NoSave InitFallbackFiles() -profile("ReloadProfiles") -eDVBDB.getInstance().reloadBouquets() +profile("config.misc") config.misc.radiopic = ConfigText(default = resolveFilename(SCOPE_CURRENT_SKIN, "radio.mvi")) config.misc.isNextRecordTimerAfterEventActionAuto = ConfigYesNo(default=False) -- cgit v1.2.3 From bea4946ae09bcab368696c50031e29c635017585 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Wed, 12 May 2010 16:03:30 +0200 Subject: RecordTimer.py,RecordingConfig.py,setup.xml: *add possibility to change the default recording filename composition in expert mode. This allows now to have shorter recording filenames (Date-Name) or longer (DateTime-Channel-Name-Shortdescription) beside the default. This fixes #345 --- RecordTimer.py | 8 ++++++++ data/setup.xml | 1 + lib/python/Components/RecordingConfig.py | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-) mode change 100644 => 100755 RecordTimer.py mode change 100644 => 100755 data/setup.xml mode change 100644 => 100755 lib/python/Components/RecordingConfig.py (limited to 'lib/python/Components') diff --git a/RecordTimer.py b/RecordTimer.py old mode 100644 new mode 100755 index f670417a..04c3ff12 --- a/RecordTimer.py +++ b/RecordTimer.py @@ -129,6 +129,7 @@ class RecordTimerEntry(timer.TimerEntry, object): def calculateFilename(self): service_name = self.service_ref.getServiceName() begin_date = strftime("%Y%m%d %H%M", localtime(self.begin)) + begin_shortdate = strftime("%Y%m%d", localtime(self.begin)) print "begin_date: ", begin_date print "service_name: ", service_name @@ -138,6 +139,13 @@ class RecordTimerEntry(timer.TimerEntry, object): filename = begin_date + " - " + service_name if self.name: filename += " - " + self.name + if config.usage.setup_level.index >= 2: # expert+ + if config.recording.filename_composition.value == "short": + filename = begin_shortdate + " - " + self.name + elif config.recording.filename_composition.value == "long": + filename = begin_date + " - " + service_name + " - " + self.name + " - " + self.description + else: + filename += " - " + self.name # standard if config.recording.ascii_filenames.value: filename = ASCIItranslit.legacyEncode(filename) diff --git a/data/setup.xml b/data/setup.xml old mode 100644 new mode 100755 index 705eaf33..f5dea734 --- a/data/setup.xml +++ b/data/setup.xml @@ -72,6 +72,7 @@ config.usage.pip_zero_button config.usage.alternatives_priority config.recording.ascii_filenames + config.recording.filename_composition config.usage.hdd_standby diff --git a/lib/python/Components/RecordingConfig.py b/lib/python/Components/RecordingConfig.py old mode 100644 new mode 100755 index fe9284d9..40dfb2ca --- a/lib/python/Components/RecordingConfig.py +++ b/lib/python/Components/RecordingConfig.py @@ -1,4 +1,4 @@ -from config import ConfigNumber, ConfigYesNo, ConfigSubsection, config +from config import ConfigNumber, ConfigYesNo, ConfigSubsection, ConfigSelection, config def InitRecordingConfig(): config.recording = ConfigSubsection(); @@ -8,3 +8,7 @@ def InitRecordingConfig(): config.recording.margin_after = ConfigNumber(default=0) config.recording.debug = ConfigYesNo(default = False) config.recording.ascii_filenames = ConfigYesNo(default = False) + config.recording.filename_composition = ConfigSelection(default = "standard", choices = [ + ("standard", _("standard")), + ("short", _("Short filenames")), + ("long", _("Long filenames")) ] ) \ No newline at end of file -- cgit v1.2.3