aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/About.py14
-rwxr-xr-x[-rw-r--r--]lib/python/Components/ChoiceList.py6
-rwxr-xr-x[-rw-r--r--]lib/python/Components/ConfigList.py46
-rw-r--r--lib/python/Components/Converter/Makefile.am2
-rw-r--r--lib/python/Components/Converter/SensorToText.py14
-rw-r--r--lib/python/Components/Converter/ServiceInfo.py4
-rw-r--r--lib/python/Components/Converter/TemplatedMultiContent.py20
-rwxr-xr-x[-rw-r--r--]lib/python/Components/EpgList.py12
-rw-r--r--lib/python/Components/FanControl.py117
-rwxr-xr-xlib/python/Components/FileList.py28
-rwxr-xr-xlib/python/Components/Harddisk.py19
-rw-r--r--lib/python/Components/Lcd.py28
-rwxr-xr-xlib/python/Components/Makefile.am2
-rwxr-xr-x[-rw-r--r--]lib/python/Components/MediaPlayer.py12
-rwxr-xr-xlib/python/Components/Network.py17
-rw-r--r--lib/python/Components/NimManager.py61
-rw-r--r--lib/python/Components/ParentalControl.py319
-rw-r--r--lib/python/Components/ParentalControlList.py29
-rwxr-xr-xlib/python/Components/PluginComponent.py2
-rw-r--r--lib/python/Components/Renderer/Listbox.py4
-rwxr-xr-x[-rw-r--r--]lib/python/Components/SelectionList.py4
-rw-r--r--lib/python/Components/Sensors.py72
-rwxr-xr-x[-rw-r--r--]lib/python/Components/ServiceList.py14
-rw-r--r--lib/python/Components/Sources/List.py5
-rw-r--r--lib/python/Components/Sources/Makefile.am2
-rw-r--r--lib/python/Components/Sources/Sensor.py31
-rw-r--r--lib/python/Components/SystemInfo.py2
-rw-r--r--lib/python/Components/Task.py17
-rwxr-xr-x[-rw-r--r--]lib/python/Components/TimerList.py14
-rw-r--r--lib/python/Components/TuneTest.py5
-rw-r--r--lib/python/Components/UsageConfig.py34
-rwxr-xr-xlib/python/Components/config.py31
32 files changed, 779 insertions, 208 deletions
diff --git a/lib/python/Components/About.py b/lib/python/Components/About.py
index bb2d7568..8e332e33 100644
--- a/lib/python/Components/About.py
+++ b/lib/python/Components/About.py
@@ -19,11 +19,21 @@ class About:
#0120 2005 11 29 01 16
#0123 4567 89 01 23 45
version = splitted[1]
+ image_type = version[0] # 0 = release, 1 = experimental
+ major = version[1]
+ minor = version[2]
+ revision = version[3]
year = version[4:8]
month = version[8:10]
day = version[10:12]
-
- return '-'.join(("dev", year, month, day))
+ date = '-'.join((year, month, day))
+ if image_type == '0':
+ image_type = "Release"
+ version = '.'.join((major, minor, revision))
+ return ' '.join((image_type, version, date))
+ else:
+ image_type = "Experimental"
+ return ' '.join((image_type, date))
file.close()
except IOError:
pass
diff --git a/lib/python/Components/ChoiceList.py b/lib/python/Components/ChoiceList.py
index fe505c2a..33868d61 100644..100755
--- a/lib/python/Components/ChoiceList.py
+++ b/lib/python/Components/ChoiceList.py
@@ -1,16 +1,16 @@
from MenuList import MenuList
-from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
+from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename
from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont
from Tools.LoadPixmap import LoadPixmap
-def ChoiceEntryComponent(key, text):
+def ChoiceEntryComponent(key = "", text = ["--"]):
res = [ text ]
if text[0] == "--":
res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 00, 800, 25, 0, RT_HALIGN_LEFT, "-"*200))
else:
res.append((eListboxPythonMultiContent.TYPE_TEXT, 45, 00, 800, 25, 0, RT_HALIGN_LEFT, text[0]))
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/buttons/key_" + key + ".png"))
+ png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/key_" + key + ".png"))
if png is not None:
res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, 0, 35, 25, png))
diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py
index 00949e2f..418a1b67 100644..100755
--- a/lib/python/Components/ConfigList.py
+++ b/lib/python/Components/ConfigList.py
@@ -1,7 +1,7 @@
from HTMLComponent import HTMLComponent
from GUIComponent import GUIComponent
-from config import KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS, ConfigElement
-from Components.ActionMap import NumberActionMap
+from config import KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS, ConfigElement, ConfigText, ConfigPassword
+from Components.ActionMap import NumberActionMap, ActionMap
from enigma import eListbox, eListboxPythonConfigContent, eRCInput, eTimer
from Screens.MessageBox import MessageBox
@@ -66,6 +66,7 @@ class ConfigList(HTMLComponent, GUIComponent, object):
self.current = self.getCurrent()
if self.current:
self.current[1].onSelect(self.session)
+
for x in self.onSelectionChanged:
x()
@@ -127,13 +128,52 @@ class ConfigListScreen:
"9": self.keyNumberGlobal,
"0": self.keyNumberGlobal
}, -1) # to prevent left/right overriding the listbox
+
+ self["VirtualKB"] = ActionMap(["VirtualKeyboardActions"],
+ {
+ "showVirtualKeyboard": self.KeyText,
+ }, -2)
+ self["VirtualKB"].setEnabled(False)
self["config"] = ConfigList(list, session = session)
+
if on_change is not None:
self.__changed = on_change
else:
self.__changed = lambda: None
-
+
+ if not self.handleInputHelpers in self["config"].onSelectionChanged:
+ self["config"].onSelectionChanged.append(self.handleInputHelpers)
+
+ def handleInputHelpers(self):
+ if self["config"].getCurrent() is not None:
+ if isinstance(self["config"].getCurrent()[1], ConfigText) or isinstance(self["config"].getCurrent()[1], ConfigPassword):
+ if self.has_key("VKeyIcon"):
+ self["VirtualKB"].setEnabled(True)
+ self["VKeyIcon"].boolean = True
+ if self.has_key("HelpWindow"):
+ if self["config"].getCurrent()[1].help_window.instance is not None:
+ helpwindowpos = self["HelpWindow"].getPosition()
+ from enigma import ePoint
+ self["config"].getCurrent()[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1]))
+ else:
+ if self.has_key("VKeyIcon"):
+ self["VirtualKB"].setEnabled(False)
+ self["VKeyIcon"].boolean = False
+ else:
+ if self.has_key("VKeyIcon"):
+ self["VirtualKB"].setEnabled(False)
+ self["VKeyIcon"].boolean = False
+
+ def KeyText(self):
+ from Screens.VirtualKeyBoard import VirtualKeyBoard
+ self.session.openWithCallback(self.VirtualKeyBoardCallback, VirtualKeyBoard, title = self["config"].getCurrent()[0], text = self["config"].getCurrent()[1].getValue())
+
+ def VirtualKeyBoardCallback(self, callback = None):
+ if callback is not None and len(callback):
+ self["config"].getCurrent()[1].setValue(callback)
+ self["config"].invalidate(self["config"].getCurrent())
+
def keyOK(self):
self["config"].handleKey(KEY_OK)
diff --git a/lib/python/Components/Converter/Makefile.am b/lib/python/Components/Converter/Makefile.am
index 75c8a08e..3b6fd3e8 100644
--- a/lib/python/Components/Converter/Makefile.am
+++ b/lib/python/Components/Converter/Makefile.am
@@ -6,4 +6,4 @@ install_PYTHON = \
ConditionalShowHide.py ServicePosition.py ValueRange.py RdsInfo.py Streaming.py \
StaticMultiList.py ServiceTime.py MovieInfo.py MenuEntryCompare.py StringListSelection.py \
ValueBitTest.py TunerInfo.py ConfigEntryTest.py TemplatedMultiContent.py ProgressToText.py \
- Combine.py
+ Combine.py SensorToText.py
diff --git a/lib/python/Components/Converter/SensorToText.py b/lib/python/Components/Converter/SensorToText.py
new file mode 100644
index 00000000..fb156faf
--- /dev/null
+++ b/lib/python/Components/Converter/SensorToText.py
@@ -0,0 +1,14 @@
+from Components.Converter.Converter import Converter
+
+class SensorToText(Converter, object):
+ def __init__(self, arguments):
+ Converter.__init__(self, arguments)
+
+ def getText(self):
+ if self.source.getValue() is None:
+ return ""
+ return "%d %s" % (self.source.getValue(), self.source.getUnit())
+
+ text = property(getText)
+
+ \ No newline at end of file
diff --git a/lib/python/Components/Converter/ServiceInfo.py b/lib/python/Components/Converter/ServiceInfo.py
index 5014fde6..fa3518ce 100644
--- a/lib/python/Components/Converter/ServiceInfo.py
+++ b/lib/python/Components/Converter/ServiceInfo.py
@@ -19,6 +19,7 @@ class ServiceInfo(Converter, object):
ONID = 13
SID = 14
FRAMERATE = 15
+ TRANSFERBPS = 16
def __init__(self, type):
@@ -40,6 +41,7 @@ class ServiceInfo(Converter, object):
"OnId": (self.ONID, (iPlayableService.evUpdatedInfo,)),
"Sid": (self.SID, (iPlayableService.evUpdatedInfo,)),
"Framerate": (self.FRAMERATE, (iPlayableService.evVideoSizeChanged,iPlayableService.evUpdatedInfo,)),
+ "TransferBPS": (self.TRANSFERBPS, (iPlayableService.evUpdatedInfo,)),
}[type]
def getServiceInfoString(self, info, what, convert = lambda x: "%d" % x):
@@ -112,6 +114,8 @@ class ServiceInfo(Converter, object):
return self.getServiceInfoString(info, iServiceInformation.sSID)
elif self.type == self.FRAMERATE:
return self.getServiceInfoString(info, iServiceInformation.sFrameRate, lambda x: "%d fps" % ((x+500)/1000))
+ elif self.type == self.TRANSFERBPS:
+ return self.getServiceInfoString(info, iServiceInformation.sTransferBPS, lambda x: "%d kB/s" % (x/1024))
return ""
text = property(getText)
diff --git a/lib/python/Components/Converter/TemplatedMultiContent.py b/lib/python/Components/Converter/TemplatedMultiContent.py
index b86d94bf..b5a98449 100644
--- a/lib/python/Components/Converter/TemplatedMultiContent.py
+++ b/lib/python/Components/Converter/TemplatedMultiContent.py
@@ -10,8 +10,8 @@ class TemplatedMultiContent(StringList):
del l["self"] # cleanup locals a bit
del l["args"]
- self.template = eval(args, {}, l)
self.active_style = None
+ self.template = eval(args, {}, l)
assert "fonts" in self.template
assert "itemHeight" in self.template
assert "template" in self.template or "templates" in self.template
@@ -25,7 +25,6 @@ class TemplatedMultiContent(StringList):
if not self.content:
from enigma import eListboxPythonMultiContent
self.content = eListboxPythonMultiContent()
- self.setTemplate()
# also setup fonts (also given by source)
index = 0
@@ -35,30 +34,33 @@ class TemplatedMultiContent(StringList):
# if only template changed, don't reload list
if what[0] == self.CHANGED_SPECIFIC and what[1] == "style":
- self.setTemplate()
- return
-
- if self.source:
+ pass
+ elif self.source:
self.content.setList(self.source.list)
- self.setTemplate()
+ self.setTemplate()
self.downstream_elements.changed(what)
def setTemplate(self):
if self.source:
style = self.source.style
+
if style == self.active_style:
- return # style did not change
+ return
# if skin defined "templates", that means that it defines multiple styles in a dict. template should still be a default
templates = self.template.get("templates")
template = self.template.get("template")
itemheight = self.template["itemHeight"]
+ selectionEnabled = self.template.get("selectionEnabled", True)
if templates and style and style in templates: # if we have a custom style defined in the source, and different templates in the skin, look it up
template = templates[style][1]
itemheight = templates[style][0]
+ if len(templates[style]) > 2:
+ selectionEnabled = templates[style][2]
self.content.setTemplate(template)
-
self.content.setItemHeight(itemheight)
+ self.selectionEnabled = selectionEnabled
+ self.active_style = style
diff --git a/lib/python/Components/EpgList.py b/lib/python/Components/EpgList.py
index 59f92621..41cd1b2c 100644..100755
--- a/lib/python/Components/EpgList.py
+++ b/lib/python/Components/EpgList.py
@@ -8,7 +8,7 @@ from Tools.LoadPixmap import LoadPixmap
from time import localtime, time
from ServiceReference import ServiceReference
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
EPG_TYPE_SINGLE = 0
EPG_TYPE_MULTI = 1
@@ -53,11 +53,11 @@ class EPGList(HTMLComponent, GUIComponent):
assert(type == EPG_TYPE_SIMILAR)
self.l.setBuildFunc(self.buildSimilarEntry)
self.epgcache = eEPGCache.getInstance()
- self.clock_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock.png'))
- self.clock_add_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_add.png'))
- self.clock_pre_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_pre.png'))
- self.clock_post_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_post.png'))
- self.clock_prepost_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_prepost.png'))
+ self.clock_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock.png'))
+ self.clock_add_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_add.png'))
+ self.clock_pre_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_pre.png'))
+ self.clock_post_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_post.png'))
+ self.clock_prepost_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_prepost.png'))
def getEventFromId(self, service, eventid):
event = None
diff --git a/lib/python/Components/FanControl.py b/lib/python/Components/FanControl.py
new file mode 100644
index 00000000..a993c396
--- /dev/null
+++ b/lib/python/Components/FanControl.py
@@ -0,0 +1,117 @@
+import os
+
+from Components.config import config, ConfigSubList, ConfigSubsection, ConfigSlider
+from Tools.BoundFunction import boundFunction
+
+import NavigationInstance
+from enigma import iRecordableService
+
+class FanControl:
+ # ATM there's only support for one fan
+ def __init__(self):
+ if os.path.exists("/proc/stb/fp/fan_vlt") or os.path.exists("/proc/stb/fp/fan_pwm") or os.path.exists("/proc/stb/fp/fan_speed"):
+ self.fancount = 1
+ else:
+ self.fancount = 0
+ self.createConfig()
+ config.misc.standbyCounter.addNotifier(self.standbyCounterChanged, initial_call = False)
+
+ def setVoltage_PWM(self):
+ for fanid in range(self.getFanCount()):
+ cfg = self.getConfig(fanid)
+ self.setVoltage(fanid, cfg.vlt.value)
+ self.setPWM(fanid, cfg.pwm.value)
+ print "[FanControl]: setting fan values: fanid = %d, voltage = %d, pwm = %d" % (fanid, cfg.vlt.value, cfg.pwm.value)
+
+ def setVoltage_PWM_Standby(self):
+ for fanid in range(self.getFanCount()):
+ cfg = self.getConfig(fanid)
+ self.setVoltage(fanid, cfg.vlt_standby.value)
+ self.setPWM(fanid, cfg.pwm_standby.value)
+ print "[FanControl]: setting fan values (standby mode): fanid = %d, voltage = %d, pwm = %d" % (fanid, cfg.vlt_standby.value, cfg.pwm_standby.value)
+
+ def getRecordEvent(self, recservice, event):
+ recordings = len(NavigationInstance.instance.getRecordings())
+ if event == iRecordableService.evEnd:
+ if recordings == 0:
+ self.setVoltage_PWM_Standby()
+ elif event == iRecordableService.evStart:
+ if recordings == 1:
+ self.setVoltage_PWM()
+
+ def leaveStandby(self):
+ NavigationInstance.instance.record_event.remove(self.getRecordEvent)
+ recordings = NavigationInstance.instance.getRecordings()
+ if not recordings:
+ self.setVoltage_PWM()
+
+ def standbyCounterChanged(self, configElement):
+ from Screens.Standby import inStandby
+ inStandby.onClose.append(self.leaveStandby)
+ recordings = NavigationInstance.instance.getRecordings()
+ NavigationInstance.instance.record_event.append(self.getRecordEvent)
+ if not recordings:
+ self.setVoltage_PWM_Standby()
+
+ def createConfig(self):
+ def setVlt(fancontrol, fanid, configElement):
+ fancontrol.setVoltage(fanid, configElement.value)
+ def setPWM(fancontrol, fanid, configElement):
+ fancontrol.setPWM(fanid, configElement.value)
+
+ config.fans = ConfigSubList()
+ for fanid in range(self.getFanCount()):
+ fan = ConfigSubsection()
+ fan.vlt = ConfigSlider(default = 15, increment = 5, limits = (0, 255))
+ fan.pwm = ConfigSlider(default = 0, increment = 5, limits = (0, 255))
+ fan.vlt_standby = ConfigSlider(default = 5, increment = 5, limits = (0, 255))
+ fan.pwm_standby = ConfigSlider(default = 0, increment = 5, limits = (0, 255))
+ fan.vlt.addNotifier(boundFunction(setVlt, self, fanid))
+ fan.pwm.addNotifier(boundFunction(setPWM, self, fanid))
+ config.fans.append(fan)
+
+ def getConfig(self, fanid):
+ return config.fans[fanid]
+
+ def getFanCount(self):
+ return self.fancount
+
+ def hasRPMSensor(self, fanid):
+ return os.path.exists("/proc/stb/fp/fan_speed")
+
+ def hasFanControl(self, fanid):
+ return os.path.exists("/proc/stb/fp/fan_vlt") or os.path.exists("/proc/stb/fp/fan_pwm")
+
+ def getFanSpeed(self, fanid):
+ f = open("/proc/stb/fp/fan_speed", "r")
+ value = int(f.readline().strip()[:-4])
+ f.close()
+ return value
+
+ def getVoltage(self, fanid):
+ f = open("/proc/stb/fp/fan_vlt", "r")
+ value = int(f.readline().strip(), 16)
+ f.close()
+ return value
+
+ def setVoltage(self, fanid, value):
+ if value > 255:
+ return
+ f = open("/proc/stb/fp/fan_vlt", "w")
+ f.write("%x" % value)
+ f.close()
+
+ def getPWM(self, fanid):
+ f = open("/proc/stb/fp/fan_pwm", "r")
+ value = int(f.readline().strip(), 16)
+ f.close()
+ return value
+
+ def setPWM(self, fanid, value):
+ if value > 255:
+ return
+ f = open("/proc/stb/fp/fan_pwm", "w")
+ f.write("%x" % value)
+ f.close()
+
+fancontrol = FanControl()
diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py
index 38b08547..841a2fe5 100755
--- a/lib/python/Components/FileList.py
+++ b/lib/python/Components/FileList.py
@@ -3,7 +3,7 @@ from os import path as os_path, listdir
from MenuList import MenuList
from Components.Harddisk import harddiskmanager
-from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
+from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename, fileExists
from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, \
eServiceReference, eServiceCenter, gFont
@@ -35,12 +35,12 @@ def FileEntryComponent(name, absolute = None, isDir = False):
res = [ (absolute, isDir) ]
res.append((eListboxPythonMultiContent.TYPE_TEXT, 35, 1, 470, 20, 0, RT_HALIGN_LEFT, name))
if isDir:
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/directory.png"))
+ png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "extensions/directory.png"))
else:
extension = name.split('.')
extension = extension[-1].lower()
if EXTENSIONS.has_key(extension):
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/" + EXTENSIONS[extension] + ".png"))
+ png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "extensions/" + EXTENSIONS[extension] + ".png"))
else:
png = None
if png is not None:
@@ -160,8 +160,11 @@ class FileList(MenuList):
directories.sort()
files.sort()
else:
- if os_path.exists(directory):
- files = listdir(directory)
+ if fileExists(directory):
+ try:
+ files = listdir(directory)
+ except:
+ files = []
files.sort()
tmpfiles = files[:]
for x in tmpfiles:
@@ -256,12 +259,12 @@ def MultiFileSelectEntryComponent(name, absolute = None, isDir = False, selected
res = [ (absolute, isDir, selected, name) ]
res.append((eListboxPythonMultiContent.TYPE_TEXT, 55, 1, 470, 20, 0, RT_HALIGN_LEFT, name))
if isDir:
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/directory.png"))
+ png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "extensions/directory.png"))
else:
extension = name.split('.')
extension = extension[-1].lower()
if EXTENSIONS.has_key(extension):
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/" + EXTENSIONS[extension] + ".png"))
+ png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "extensions/" + EXTENSIONS[extension] + ".png"))
else:
png = None
if png is not None:
@@ -269,10 +272,10 @@ def MultiFileSelectEntryComponent(name, absolute = None, isDir = False, selected
if not name.startswith('<'):
if selected is False:
- icon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock_off.png"))
+ icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_off.png"))
res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 0, 25, 25, icon))
else:
- icon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock_on.png"))
+ icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png"))
res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 0, 25, 25, icon))
return res
@@ -374,8 +377,11 @@ class MultiFileSelectList(FileList):
directories.sort()
files.sort()
else:
- if os_path.exists(directory):
- files = listdir(directory)
+ if fileExists(directory):
+ try:
+ files = listdir(directory)
+ except:
+ files = []
files.sort()
tmpfiles = files[:]
for x in tmpfiles:
diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py
index 2efdb68f..e8e612a4 100755
--- a/lib/python/Components/Harddisk.py
+++ b/lib/python/Components/Harddisk.py
@@ -166,7 +166,7 @@ class Harddisk:
lines = mounts.readlines()
mounts.close()
- cmd = "/bin/umount"
+ cmd = "umount"
for line in lines:
parts = line.strip().split(" ")
@@ -177,12 +177,12 @@ class Harddisk:
return (res >> 8)
def createPartition(self):
- cmd = 'printf "0,\n;\n;\n;\ny\n" | /sbin/sfdisk -f ' + self.disk_path
+ cmd = 'printf "0,\n;\n;\n;\ny\n" | sfdisk -f ' + self.disk_path
res = system(cmd)
return (res >> 8)
def mkfs(self):
- cmd = "/sbin/mkfs.ext3 "
+ cmd = "mkfs.ext3 "
if self.diskSize() > 4 * 1024:
cmd += "-T largefile "
cmd += "-m0 -O dir_index " + self.partitionPath("1")
@@ -202,7 +202,7 @@ class Harddisk:
for line in lines:
parts = line.strip().split(" ")
if path.realpath(parts[0]) == self.partitionPath("1"):
- cmd = "/bin/mount -t ext3 " + parts[0]
+ cmd = "mount -t ext3 " + parts[0]
res = system(cmd)
break
@@ -218,7 +218,7 @@ class Harddisk:
def fsck(self):
# We autocorrect any failures
# TODO: we could check if the fs is actually ext3
- cmd = "/sbin/fsck.ext3 -f -p " + self.partitionPath("1")
+ cmd = "fsck.ext3 -f -p " + self.partitionPath("1")
res = system(cmd)
return (res >> 8)
@@ -226,7 +226,7 @@ class Harddisk:
part = self.partitionPath(n)
if access(part, 0):
- cmd = '/bin/dd bs=512 count=3 if=/dev/zero of=' + part
+ cmd = 'dd bs=512 count=3 if=/dev/zero of=' + part
res = system(cmd)
else:
res = 0
@@ -290,7 +290,10 @@ class Harddisk:
# any access has been made to the disc. If there has been no access over a specifed time,
# we set the hdd into standby.
def readStats(self):
- l = readFile("/sys/block/%s/stat" % self.device)
+ try:
+ l = open("/sys/block/%s/stat" % self.device).read()
+ except IOError:
+ return -1,-1
(nr_read, _, _, _, nr_write) = l.split()[:5]
return int(nr_read), int(nr_write)
@@ -319,7 +322,7 @@ class Harddisk:
l = sum(stats)
print "sum", l, "prev_sum", self.last_stat
- if l != self.last_stat: # access
+ if l != self.last_stat and l >= 0: # access
print "hdd was accessed since previous check!"
self.last_stat = l
self.last_access = t
diff --git a/lib/python/Components/Lcd.py b/lib/python/Components/Lcd.py
index 0e501237..dde158b6 100644
--- a/lib/python/Components/Lcd.py
+++ b/lib/python/Components/Lcd.py
@@ -28,6 +28,14 @@ class LCD:
def isOled(self):
return eDBoxLCD.getInstance().isOled()
+def leaveStandby():
+ config.lcd.bright.apply()
+
+def standbyCounterChanged(configElement):
+ from Screens.Standby import inStandby
+ inStandby.onClose.append(leaveStandby)
+ config.lcd.standby.apply()
+
def InitLcd():
detected = eDBoxLCD.getInstance().detected()
SystemInfo["Display"] = detected
@@ -42,9 +50,18 @@ def InitLcd():
def setLCDinverted(configElement):
ilcd.setInverted(configElement.value);
+ standby_default = 0
+
ilcd = LCD()
- config.lcd.standby = ConfigSlider(default=0, limits=(0, 10))
+ if not ilcd.isOled():
+ config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20))
+ config.lcd.contrast.addNotifier(setLCDcontrast);
+ else:
+ config.lcd.contrast = ConfigNothing()
+ standby_default = 1
+
+ config.lcd.standby = ConfigSlider(default=standby_default, limits=(0, 10))
config.lcd.standby.addNotifier(setLCDbright);
config.lcd.standby.apply = lambda : setLCDbright(config.lcd.standby)
@@ -53,12 +70,6 @@ def InitLcd():
config.lcd.bright.apply = lambda : setLCDbright(config.lcd.bright)
config.lcd.bright.callNotifiersOnSaveAndCancel = True
- if not ilcd.isOled():
- config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20))
- config.lcd.contrast.addNotifier(setLCDcontrast);
- else:
- config.lcd.contrast = ConfigNothing()
-
config.lcd.invert = ConfigYesNo(default=False)
config.lcd.invert.addNotifier(setLCDinverted);
else:
@@ -69,3 +80,6 @@ def InitLcd():
config.lcd.standby = ConfigNothing()
config.lcd.bright.apply = lambda : doNothing()
config.lcd.standby.apply = lambda : doNothing()
+
+ config.misc.standbyCounter.addNotifier(standbyCounterChanged, initial_call = False)
+
diff --git a/lib/python/Components/Makefile.am b/lib/python/Components/Makefile.am
index 34710fa1..b5ef0688 100755
--- a/lib/python/Components/Makefile.am
+++ b/lib/python/Components/Makefile.am
@@ -19,4 +19,4 @@ install_PYTHON = \
Element.py Playlist.py ParentalControl.py ParentalControlList.py \
Ipkg.py SelectionList.py Scanner.py SystemInfo.py DreamInfoHandler.py \
Task.py language_cache.py Console.py ResourceManager.py TuneTest.py \
- Keyboard.py
+ Keyboard.py Sensors.py FanControl.py
diff --git a/lib/python/Components/MediaPlayer.py b/lib/python/Components/MediaPlayer.py
index 12f2727f..5583b22d 100644..100755
--- a/lib/python/Components/MediaPlayer.py
+++ b/lib/python/Components/MediaPlayer.py
@@ -1,6 +1,6 @@
from MenuList import MenuList
-from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
+from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename
from os import path
from enigma import eListboxPythonMultiContent, RT_VALIGN_CENTER, gFont, eServiceCenter
@@ -14,11 +14,11 @@ STATE_REWIND = 3
STATE_FORWARD = 4
STATE_NONE = 5
-PlayIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_play.png"))
-PauseIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_pause.png"))
-StopIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_stop.png"))
-RewindIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_rewind.png"))
-ForwardIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_forward.png"))
+PlayIcon = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/ico_mp_play.png"))
+PauseIcon = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/ico_mp_pause.png"))
+StopIcon = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/ico_mp_stop.png"))
+RewindIcon = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/ico_mp_rewind.png"))
+ForwardIcon = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/ico_mp_forward.png"))
def PlaylistEntryComponent(serviceref, state):
res = [ serviceref ]
diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py
index f65d6090..b9da48d8 100755
--- a/lib/python/Components/Network.py
+++ b/lib/python/Components/Network.py
@@ -14,7 +14,7 @@ class Network:
self.NetworkState = 0
self.DnsState = 0
self.nameservers = []
- self.ethtool_bin = "/usr/sbin/ethtool"
+ self.ethtool_bin = "ethtool"
self.container = eConsoleAppContainer()
self.Console = Console()
self.LinkConsole = Console()
@@ -24,6 +24,7 @@ class Network:
self.activateConsole = Console()
self.resetNetworkConsole = Console()
self.DnsConsole = Console()
+ self.PingConsole = Console()
self.config_ready = None
self.getInterfaces()
@@ -233,7 +234,7 @@ class Network:
self.configuredNetworkAdapters = self.configuredInterfaces
# load ns only once
self.loadNameserverConfig()
- print "read configured interfac:", ifaces
+ print "read configured interface:", ifaces
print "self.ifaces after loading:", self.ifaces
self.config_ready = True
self.msgPlugins()
@@ -424,6 +425,7 @@ class Network:
def checkNetworkState(self,statecallback):
# www.dream-multimedia-tv.de, www.heise.de, www.google.de
+ self.NetworkState = 0
cmd1 = "ping -c 1 82.149.226.170"
cmd2 = "ping -c 1 193.99.144.85"
cmd3 = "ping -c 1 209.85.135.103"
@@ -475,10 +477,17 @@ class Network:
def getLinkStateFinished(self, result, retval,extra_args):
(callback) = extra_args
+
if self.LinkConsole is not None:
if len(self.LinkConsole.appContainers) == 0:
callback(result)
+ def stopPingConsole(self):
+ if self.PingConsole is not None:
+ if len(self.PingConsole.appContainers):
+ for name in self.PingConsole.appContainers.keys():
+ self.PingConsole.kill(name)
+
def stopLinkStateConsole(self):
if self.LinkConsole is not None:
if len(self.LinkConsole.appContainers):
@@ -571,11 +580,11 @@ class Network:
self.wlanmodule = 'madwifi'
if os_path.exists(rt73_dir):
rtfiles = listdir(rt73_dir)
- if len(rtfiles) == 2:
+ if len(rtfiles) == 2 or len(rtfiles) == 5:
self.wlanmodule = 'ralink'
if os_path.exists(zd1211b_dir):
zdfiles = listdir(zd1211b_dir)
- if len(zdfiles) == 1:
+ if len(zdfiles) == 1 or len(zdfiles) == 5:
self.wlanmodule = 'zydas'
return self.wlanmodule
diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py
index 05204a74..745cc730 100644
--- a/lib/python/Components/NimManager.py
+++ b/lib/python/Components/NimManager.py
@@ -444,7 +444,7 @@ class SecConfigure:
self.update()
class NIM(object):
- def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None):
+ def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}):
self.slot = slot
if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", None):
@@ -455,6 +455,7 @@ class NIM(object):
self.description = description
self.has_outputs = has_outputs
self.internally_connectable = internally_connectable
+ self.multi_type = multi_type
def isCompatible(self, what):
compatible = {
@@ -466,6 +467,9 @@ class NIM(object):
}
return what in compatible[self.type]
+ def getType(self):
+ return self.type
+
def connectableTo(self):
connectable = {
"DVB-S": ("DVB-S", "DVB-S2"),
@@ -491,6 +495,13 @@ class NIM(object):
def internallyConnectableTo(self):
return self.internally_connectable
+
+ def isMultiType(self):
+ return (len(self.multi_type) > 0)
+
+ # returns dict {<slotid>: <type>}
+ def getMultiTypeList(self):
+ return self.multi_type
slot_id = property(getSlotID)
@@ -636,7 +647,15 @@ class NimManager:
entries[current_slot]["has_outputs"] = (input == "yes")
elif line.strip().startswith("Internally_Connectable:"):
input = int(line.strip()[len("Internally_Connectable:") + 1:])
- entries[current_slot]["internally_connectable"] = input
+ entries[current_slot]["internally_connectable"] = input
+ elif line.strip().startswith("Mode"):
+ # "Mode 0: DVB-T" -> ["Mode 0", " DVB-T"]
+ split = line.strip().split(":")
+ # "Mode 0" -> ["Mode, "0"]
+ split2 = split[0].split(" ")
+ modes = entries[current_slot].get("multi_type", {})
+ modes[split2[1]] = split[1].strip()
+ entries[current_slot]["multi_type"] = modes
elif line.strip().startswith("empty"):
entries[current_slot]["type"] = None
entries[current_slot]["name"] = _("N/A")
@@ -650,12 +669,17 @@ class NimManager:
entry["has_outputs"] = True
if not (entry.has_key("internally_connectable")):
entry["internally_connectable"] = None
- self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"]))
+ if not (entry.has_key("multi_type")):
+ entry["multi_type"] = {}
+ self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"], multi_type = entry["multi_type"]))
def hasNimType(self, chktype):
for slot in self.nim_slots:
if slot.isCompatible(chktype):
return True
+ for type in slot.getMultiTypeList().values():
+ if chktype == type:
+ return True
return False
def getNimType(self, slotid):
@@ -899,7 +923,7 @@ def InitSecParams():
x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER, configElement.value))
config.sec.delay_after_voltage_change_before_measure_idle_inputpower = x
- x = ConfigInteger(default=750, limits = (0, 9999))
+ x = ConfigInteger(default=900, limits = (0, 9999))
x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_MOTOR_CMD, configElement.value))
config.sec.delay_after_enable_voltage_before_motor_command = x
@@ -1213,10 +1237,38 @@ def InitNimManager(nimmgr):
tmp.lnb = lnb
nim.advanced.sat[x] = tmp
+ def toneAmplitudeChanged(configElement):
+ fe_id = configElement.fe_id
+ slot_id = configElement.slot_id
+ if nimmgr.nim_slots[slot_id].description == 'Alps BSBE2':
+ open("/proc/stb/frontend/%d/tone_amplitude" %(fe_id), "w").write(configElement.value)
+
+ def tunerTypeChanged(configElement):
+ fe_id = configElement.fe_id
+ open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value)
+
+ empty_slots = 0
for slot in nimmgr.nim_slots:
x = slot.slot
nim = config.Nims[x]
+ if slot.isMultiType():
+ typeList = []
+ value = None
+ for id in slot.getMultiTypeList().keys():
+ type = slot.getMultiTypeList()[id]
+ typeList.append((id, type))
+ if type == slot.getType():
+ value = id
+ nim.multiType = ConfigSelection(typeList, "0")
+ nim.multiType.value = value
+ nim.multiType.fe_id = x - empty_slots
+ nim.multiType.addNotifier(tunerTypeChanged)
+
if slot.isCompatible("DVB-S"):
+ nim.toneAmplitude = ConfigSelection([("9", "600mV"), ("8", "700mV"), ("7", "800mV"), ("6", "900mV"), ("5", "1100mV")], "7")
+ nim.toneAmplitude.fe_id = x - empty_slots
+ nim.toneAmplitude.slot_id = x
+ nim.toneAmplitude.addNotifier(toneAmplitudeChanged)
nim.diseqc13V = ConfigYesNo(False)
nim.diseqcMode = ConfigSelection(diseqc_mode_choices, "diseqc_a_b")
nim.connectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x])
@@ -1306,6 +1358,7 @@ def InitNimManager(nimmgr):
nim.terrestrial = ConfigSelection(choices = list)
nim.terrestrial_5V = ConfigOnOff()
else:
+ empty_slots += 1
nim.configMode = ConfigSelection(choices = { "nothing": _("disabled") }, default="nothing");
if slot.type is not None:
print "pls add support for this frontend type!", slot.type
diff --git a/lib/python/Components/ParentalControl.py b/lib/python/Components/ParentalControl.py
index d68e01ff..9942bca7 100644
--- a/lib/python/Components/ParentalControl.py
+++ b/lib/python/Components/ParentalControl.py
@@ -1,19 +1,34 @@
-from Components.config import config, ConfigSubsection, ConfigSelection, ConfigPIN, ConfigYesNo, ConfigSubList, ConfigInteger
+from Components.config import config, ConfigSubsection, ConfigSelection, ConfigPIN, ConfigText, ConfigYesNo, ConfigSubList, ConfigInteger
+#from Screens.ChannelSelection import service_types_tv
from Screens.InputBox import PinInput
from Screens.MessageBox import MessageBox
from Tools.BoundFunction import boundFunction
from ServiceReference import ServiceReference
from Tools import Notifications
from Tools.Directories import resolveFilename, SCOPE_CONFIG
+from enigma import eTimer
+import time
+
+TYPE_SERVICE = "SERVICE"
+TYPE_BOUQUETSERVICE = "BOUQUETSERVICE"
+TYPE_BOUQUET = "BOUQUET"
+LIST_BLACKLIST = "blacklist"
+LIST_WHITELIST = "whitelist"
+
+IMG_WHITESERVICE = LIST_WHITELIST + "-" + TYPE_SERVICE
+IMG_WHITEBOUQUET = LIST_WHITELIST + "-" + TYPE_BOUQUET
+IMG_BLACKSERVICE = LIST_BLACKLIST + "-" + TYPE_SERVICE
+IMG_BLACKBOUQUET = LIST_BLACKLIST + "-" + TYPE_BOUQUET
def InitParentalControl():
config.ParentalControl = ConfigSubsection()
config.ParentalControl.configured = ConfigYesNo(default = False)
config.ParentalControl.mode = ConfigSelection(default = "simple", choices = [("simple", _("simple")), ("complex", _("complex"))])
- config.ParentalControl.storeservicepin = ConfigSelection(default = "never", choices = [("never", _("never")), ("5_minutes", _("5 minutes")), ("30_minutes", _("30 minutes")), ("60_minutes", _("60 minutes")), ("restart", _("until restart"))])
+ config.ParentalControl.storeservicepin = ConfigSelection(default = "never", choices = [("never", _("never")), ("5", _("5 minutes")), ("30", _("30 minutes")), ("60", _("60 minutes")), ("standby", _("until standby/restart"))])
+ config.ParentalControl.storeservicepincancel = ConfigSelection(default = "never", choices = [("never", _("never")), ("5", _("5 minutes")), ("30", _("30 minutes")), ("60", _("60 minutes")), ("standby", _("until standby/restart"))])
config.ParentalControl.servicepinactive = ConfigYesNo(default = False)
config.ParentalControl.setuppinactive = ConfigYesNo(default = False)
- config.ParentalControl.type = ConfigSelection(default = "blacklist", choices = [("whitelist", _("whitelist")), ("blacklist", _("blacklist"))])
+ config.ParentalControl.type = ConfigSelection(default = "blacklist", choices = [(LIST_WHITELIST, _("whitelist")), (LIST_BLACKLIST, _("blacklist"))])
config.ParentalControl.setuppin = ConfigPIN(default = -1)
config.ParentalControl.retries = ConfigSubsection()
@@ -39,40 +54,58 @@ def InitParentalControl():
class ParentalControl:
def __init__(self):
- self.open()
+ #Do not call open on init, because bouquets are not ready at that moment
+# self.open()
self.serviceLevel = {}
-
- def addWhitelistService(self, service):
- self.whitelist.append(service)
+ #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,
+ #That's why I decided to use a timer
+ self.sessionPinTimer = eTimer()
+ self.sessionPinTimer.callback.append(self.resetSessionPin)
- def addBlacklistService(self, service):
- self.blacklist.append(service)
-
- def setServiceLevel(self, service, level):
- self.serviceLevel[service] = level
-
- def deleteWhitelistService(self, service):
- self.whitelist.remove(service)
- if self.serviceLevel.has_key(service):
- self.serviceLevel.remove(service)
+ def serviceMethodWrapper(self, service, method, *args):
+ #This method is used to call all functions that need a service as Parameter:
+ #It takes either a Service- Reference or a Bouquet- Reference and passes
+ #Either the service or all services contained in the bouquet to the method given
+ #That way all other functions do not need to distinguish between service and bouquet.
+ if "FROM BOUQUET" in service:
+ method( service , TYPE_BOUQUET , *args )
+ servicelist = self.readServicesFromBouquet(service,"C")
+ for ref in servicelist:
+ sRef = str(ref[0])
+ method( sRef , TYPE_BOUQUETSERVICE , *args )
+ else:
+ ref = ServiceReference(service)
+ sRef = str(ref)
+ method( sRef , TYPE_SERVICE , *args )
- def deleteBlacklistService(self, service):
- self.blacklist.remove(service)
- if self.serviceLevel.has_key(service):
- self.serviceLevel.remove(service)
+ def setServiceLevel(self, service, type, level):
+ self.serviceLevel[service] = level
def isServicePlayable(self, ref, callback):
if not config.ParentalControl.configured.value or not config.ParentalControl.servicepinactive.value:
return True
- #print "whitelist:", self.whitelist
- #print "blacklist:", self.blacklist
- #print "config.ParentalControl.type.value:", config.ParentalControl.type.value
- #print "not in whitelist:", (service not in self.whitelist)
- #print "checking parental control for service:", ref.toString()
+ #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:
+ self.getConfigValues()
service = ref.toCompareString()
- if (config.ParentalControl.type.value == "whitelist" and service not in self.whitelist) or (config.ParentalControl.type.value == "blacklist" and service in self.blacklist):
+ if (config.ParentalControl.type.value == LIST_WHITELIST and not self.whitelist.has_key(service)) or (config.ParentalControl.type.value == LIST_BLACKLIST and self.blacklist.has_key(service)):
+ #Check if the session pin is cached and return the cached value, if it is.
+ if self.sessionPinCached == True:
+ #As we can cache successful pin- entries as well as canceled pin- entries,
+ #We give back the last action
+ return self.sessionPinCachedValue
self.callback = callback
- #print "service:", ServiceReference(service).getServiceName()
+ #Someone started to implement different levels of protection. Seems they were never completed
+ #I did not throw out this code, although it is of no use at the moment
levelNeeded = 0
if self.serviceLevel.has_key(service):
levelNeeded = self.serviceLevel[service]
@@ -83,103 +116,217 @@ class ParentalControl:
return True
def protectService(self, service):
- #print "protect"
- #print "config.ParentalControl.type.value:", config.ParentalControl.type.value
- if config.ParentalControl.type.value == "whitelist":
- if service in self.whitelist:
- self.deleteWhitelistService(service)
+ if config.ParentalControl.type.value == LIST_WHITELIST:
+ if self.whitelist.has_key(service):
+ self.serviceMethodWrapper(service, self.removeServiceFromList, self.whitelist)
+ #self.deleteWhitelistService(service)
else: # blacklist
- if service not in self.blacklist:
- self.addBlacklistService(service)
+ if not self.blacklist.has_key(service):
+ self.serviceMethodWrapper(service, self.addServiceToList, self.blacklist)
+ #self.addBlacklistService(service)
#print "whitelist:", self.whitelist
#print "blacklist:", self.blacklist
-
def unProtectService(self, service):
#print "unprotect"
#print "config.ParentalControl.type.value:", config.ParentalControl.type.value
- if config.ParentalControl.type.value == "whitelist":
- if service not in self.whitelist:
- self.addWhitelistService(service)
+ if config.ParentalControl.type.value == LIST_WHITELIST:
+ if not self.whitelist.has_key(service):
+ self.serviceMethodWrapper(service, self.addServiceToList, self.whitelist)
+ #self.addWhitelistService(service)
else: # blacklist
- if service in self.blacklist:
- self.deleteBlacklistService(service)
+ if self.blacklist.has_key(service):
+ self.serviceMethodWrapper(service, self.removeServiceFromList, self.blacklist)
+ #self.deleteBlacklistService(service)
#print "whitelist:", self.whitelist
#print "blacklist:", self.blacklist
def getProtectionLevel(self, service):
- if (config.ParentalControl.type.value == "whitelist" and service not in self.whitelist) or (config.ParentalControl.type.value == "blacklist" and service in self.blacklist):
+ if (config.ParentalControl.type.value == LIST_WHITELIST and not self.whitelist.has_key(service)) or (config.ParentalControl.type.value == LIST_BLACKLIST and self.blacklist.has_key(service)):
if self.serviceLevel.has_key(service):
return self.serviceLevel[service]
else:
return 0
else:
return -1
+
+ 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):
+ if TYPE_SERVICE in self.whitelist[service]:
+ sImage = IMG_WHITESERVICE
+ else:
+ sImage = IMG_WHITEBOUQUET
+ elif (config.ParentalControl.type.value == LIST_BLACKLIST):
+ if self.blacklist.has_key(service):
+ if TYPE_SERVICE in self.blacklist[service]:
+ sImage = IMG_BLACKSERVICE
+ else:
+ sImage = IMG_BLACKBOUQUET
+ bLocked = self.getProtectionLevel(service) != -1
+ return (bLocked,sImage)
+
+ def getConfigValues(self):
+ #Read all values from configuration
+ self.checkPinInterval = False
+ self.checkPinIntervalCancel = False
+ self.checkSessionPin = False
+ self.checkSessionPinCancel = False
+
+ self.sessionPinCached = False
+ self.pinIntervalSeconds = 0
+ self.pinIntervalSecondsCancel = 0
+
+ self.storeServicePin = config.ParentalControl.storeservicepin.value
+ self.storeServicePinCancel = config.ParentalControl.storeservicepincancel.value
+
+ if self.storeServicePin == "never":
+ pass
+ elif self.storeServicePin == "standby":
+ self.checkSessionPin = True
+ else:
+ self.checkPinInterval = True
+ iMinutes = float(self.storeServicePin)
+ iSeconds = iMinutes*60
+ self.pinIntervalSeconds = iSeconds
+
+ if self.storeServicePinCancel == "never":
+ pass
+ elif self.storeServicePinCancel == "standby":
+ self.checkSessionPinCancel = True
+ else:
+ self.checkPinIntervalCancel = True
+ iMinutes = float(self.storeServicePinCancel)
+ iSeconds = iMinutes*60
+ self.pinIntervalSecondsCancel = iSeconds
+ self.configInitialized = True
+ # Reset PIN cache on standby: Use StandbyCounter- Config- Callback
+ config.misc.standbyCounter.addNotifier(self.standbyCounterCallback, initial_call = False)
+
+ def standbyCounterCallback(self, configElement):
+ self.resetSessionPin()
+
+ def resetSessionPin(self):
+ #Reset the session pin, stop the timer
+ self.sessionPinCached = False
+ self.sessionPinTimer.stop()
+
+ def getCurrentTimeStamp(self):
+ return time.time()
+
def getPinList(self):
return [ x.value for x in config.ParentalControl.servicepin ]
-
+
def servicePinEntered(self, service, result):
-# levelNeeded = 0
- #if self.serviceLevel.has_key(service):
- #levelNeeded = self.serviceLevel[service]
-#
- #print "getPinList():", self.getPinList()
- #pinList = self.getPinList()[:levelNeeded + 1]
- #print "pinList:", pinList
-#
-# print "pin entered for service", service, "and pin was", pin
- #if pin is not None and int(pin) in pinList:
+
if result is not None and result:
- #print "pin ok, playing service"
+ #This is the new function of caching the service pin
+ #save last session and time of last entered pin...
+ if self.checkSessionPin == True:
+ self.sessionPinCached = True
+ self.sessionPinCachedValue = True
+ if self.checkPinInterval == True:
+ self.sessionPinCached = True
+ self.sessionPinCachedValue = True
+ self.sessionPinTimer.start(self.pinIntervalSeconds*1000,1)
self.callback(ref = service)
else:
+ #This is the new function of caching cancelling of service pin
if result is not None:
Notifications.AddNotification(MessageBox, _("The pin code you entered is wrong."), MessageBox.TYPE_ERROR)
- #print "wrong pin entered"
+ else:
+ if self.checkSessionPinCancel == True:
+ self.sessionPinCached = True
+ self.sessionPinCachedValue = False
+ if self.checkPinIntervalCancel == True:
+ self.sessionPinCached = True
+ self.sessionPinCachedValue = False
+ self.sessionPinTimer.start(self.pinIntervalSecondsCancel*1000,1)
- def saveWhitelist(self):
- file = open(resolveFilename(SCOPE_CONFIG, "whitelist"), 'w')
- for x in self.whitelist:
- file.write(x + "\n")
- file.close
-
- def openWhitelist(self):
- self.whitelist = []
- try:
- file = open(resolveFilename(SCOPE_CONFIG, "whitelist"), 'r')
- lines = file.readlines()
- for x in lines:
- ref = ServiceReference(x.strip())
- self.whitelist.append(str(ref))
- file.close
- except:
- pass
-
- def saveBlacklist(self):
- file = open(resolveFilename(SCOPE_CONFIG, "blacklist"), 'w')
- for x in self.blacklist:
- file.write(x + "\n")
+ def saveListToFile(self,sWhichList):
+ #Replaces saveWhiteList and saveBlackList:
+ #I don't like to have two functions with identical code...
+ if sWhichList == LIST_BLACKLIST:
+ vList = self.blacklist
+ else:
+ vList = self.whitelist
+ file = open(resolveFilename(SCOPE_CONFIG, sWhichList), 'w')
+ for sService,sType in vList.iteritems():
+ #Only Services that are selected directly and Bouqets are saved.
+ #Services that are added by a bouquet are not saved.
+ #This is the reason for the change in self.whitelist and self.blacklist
+ if TYPE_SERVICE in sType or TYPE_BOUQUET in sType:
+ file.write(str(sService) + "\n")
file.close
- def openBlacklist(self):
- self.blacklist = []
+ def openListFromFile(self,sWhichList):
+ #Replaces openWhiteList and openBlackList:
+ #I don't like to have two functions with identical code...
+ if sWhichList == LIST_BLACKLIST:
+ self.blacklist = {}
+ vList = self.blacklist
+ else:
+ self.whitelist = {}
+ vList = self.whitelist
try:
- file = open(resolveFilename(SCOPE_CONFIG, "blacklist"), 'r')
+ file = open(resolveFilename(SCOPE_CONFIG, sWhichList ), 'r')
lines = file.readlines()
for x in lines:
- ref = ServiceReference(x.strip())
- self.blacklist.append(str(ref))
+ sPlain = x.strip()
+ self.serviceMethodWrapper(sPlain, self.addServiceToList, vList)
file.close
except:
pass
+
+ def addServiceToList(self, service, type, vList):
+ #Replaces addWhitelistService and addBlacklistService
+ #The lists are not only lists of service references any more.
+ #They are named lists with the service as key and an array of types as value:
+
+ if vList.has_key(service):
+ if not type in vList[service]:
+ vList[service].append(type)
+ else:
+ vList[service] = [type]
+
+ def removeServiceFromList(self, service, type, vList):
+ #Replaces deleteWhitelistService and deleteBlacklistService
+ if vList.has_key(service):
+ if type in vList[service]:
+ vList[service].remove(type)
+ if not vList[service]:
+ del vList[service]
+ if self.serviceLevel.has_key(service):
+ self.serviceLevel.remove(service)
+
+ def readServicesFromBouquet(self,sBouquetSelection,formatstring):
+ #This method gives back a list of services for a given bouquet
+ from enigma import eServiceCenter, eServiceReference
+ from Screens.ChannelSelection import service_types_tv
+ serviceHandler = eServiceCenter.getInstance()
+ refstr = sBouquetSelection
+ root = eServiceReference(refstr)
+ list = serviceHandler.list(root)
+ if list is not None:
+ services = list.getContent("CN", True) #(servicecomparestring, name)
+ return services
def save(self):
- self.saveBlacklist()
- self.saveWhitelist()
+ # 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.openBlacklist()
- self.openWhitelist()
+ self.openListFromFile(LIST_BLACKLIST)
+ self.openListFromFile(LIST_WHITELIST)
+ self.filesOpened = True
parentalControl = ParentalControl()
diff --git a/lib/python/Components/ParentalControlList.py b/lib/python/Components/ParentalControlList.py
index 128e6d3e..797ea391 100644
--- a/lib/python/Components/ParentalControlList.py
+++ b/lib/python/Components/ParentalControlList.py
@@ -1,19 +1,28 @@
from MenuList import MenuList
-from Components.ParentalControl import parentalControl
+from Components.ParentalControl import parentalControl, IMG_WHITESERVICE, IMG_WHITEBOUQUET, IMG_BLACKSERVICE, IMG_BLACKBOUQUET
from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
from Tools.LoadPixmap import LoadPixmap
-lockPicture = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock.png"))
+#Now there is a list of pictures instead of one...
+entryPicture = {}
-def ParentalControlEntryComponent(service, name, locked = True):
+entryPicture[IMG_BLACKSERVICE] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock.png"))
+entryPicture[IMG_BLACKBOUQUET] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lockBouquet.png"))
+entryPicture[IMG_WHITESERVICE] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/unlock.png"))
+entryPicture[IMG_WHITEBOUQUET] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/unlockBouquet.png"))
+
+def ParentalControlEntryComponent(service, name, protectionType):
+ locked = protectionType[0]
+ sImage = protectionType[1]
res = [
(service, name, locked),
(eListboxPythonMultiContent.TYPE_TEXT, 80, 5, 300, 50, 0, RT_HALIGN_LEFT, name)
]
- if locked:
- res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, lockPicture))
+ #Changed logic: The image is defined by sImage, not by locked anymore
+ if sImage != "":
+ res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, entryPicture[sImage]))
return res
class ParentalControlList(MenuList):
@@ -25,9 +34,11 @@ class ParentalControlList(MenuList):
def toggleSelectedLock(self):
print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
- self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(self.l.getCurrentSelection()[0][0], self.l.getCurrentSelection()[0][1], not self.l.getCurrentSelection()[0][2]);
- if self.l.getCurrentSelection()[0][2]:
- parentalControl.protectService(self.l.getCurrentSelection()[0][0])
+ curSel = self.l.getCurrentSelection()
+ if curSel[0][2]:
+ parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])
else:
- parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])
+ parentalControl.protectService(self.l.getCurrentSelection()[0][0])
+ #Instead of just negating the locked- flag, now I call the getProtectionType every time...
+ self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(curSel[0][0], curSel[0][1], parentalControl.getProtectionType(curSel[0][0]))
self.l.setList(self.list)
diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py
index c91d6ad5..5e439fdf 100755
--- a/lib/python/Components/PluginComponent.py
+++ b/lib/python/Components/PluginComponent.py
@@ -46,7 +46,7 @@ class PluginComponent:
for pluginname in os_listdir(directory_category):
path = directory_category + "/" + pluginname
if os_path.isdir(path):
- if fileExists(path + "/plugin.pyc") or fileExists(path + "/plugin.py"):
+ if fileExists(path + "/plugin.pyc") or fileExists(path + "/plugin.pyo") or fileExists(path + "/plugin.py"):
try:
plugin = my_import('.'.join(["Plugins", c, pluginname, "plugin"]))
diff --git a/lib/python/Components/Renderer/Listbox.py b/lib/python/Components/Renderer/Listbox.py
index 7a895330..640121e1 100644
--- a/lib/python/Components/Renderer/Listbox.py
+++ b/lib/python/Components/Renderer/Listbox.py
@@ -77,6 +77,10 @@ class Listbox(Renderer, object):
selection_enabled = property(lambda self: self.__selection_enabled, setSelectionEnabled)
def changed(self, what):
+ if hasattr(self.source, "selectionEnabled"):
+ self.selection_enabled = self.source.selectionEnabled
+ if len(what) > 1 and isinstance(what[1], str) and what[1] == "style":
+ return
self.content = self.source.content
def entry_changed(self, index):
diff --git a/lib/python/Components/SelectionList.py b/lib/python/Components/SelectionList.py
index 08af7d02..1c5423fb 100644..100755
--- a/lib/python/Components/SelectionList.py
+++ b/lib/python/Components/SelectionList.py
@@ -1,9 +1,9 @@
from MenuList import MenuList
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT
from Tools.LoadPixmap import LoadPixmap
-selectionpng = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/selectioncross.png"))
+selectionpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/selectioncross.png"))
def SelectionEntryComponent(description, value, index, selected):
res = [
diff --git a/lib/python/Components/Sensors.py b/lib/python/Components/Sensors.py
new file mode 100644
index 00000000..8898a030
--- /dev/null
+++ b/lib/python/Components/Sensors.py
@@ -0,0 +1,72 @@
+from Components.FanControl import fancontrol
+
+class Sensors:
+ # (type, name, unit, directory)
+ TYPE_TEMPERATURE = 0
+ # (type, name, unit, fanid)
+ TYPE_FAN_RPM = 1
+
+ def __init__(self):
+ # (type, name, unit, sensor_specific_dict/list)
+ self.sensors_list = []
+ self.addSensors()
+
+ def getSensorsCount(self, type = None):
+ if type is None:
+ return len(self.sensors_list)
+ count = 0
+ for sensor in self.sensors_list:
+ if sensor[0] == type:
+ count += 1
+ return count
+
+ # returns a list of sensorids of type "type"
+ def getSensorsList(self, type = None):
+ if type is None:
+ return range(len(self.sensors_list))
+ list = []
+ for sensorid in range(len(self.sensors_list)):
+ if self.sensors_list[sensorid][0] == type:
+ list.append(sensorid)
+ return list
+
+
+ def getSensorType(self, sensorid):
+ return self.sensors_list[sensorid][0]
+
+ def getSensorName(self, sensorid):
+ return self.sensors_list[sensorid][1]
+
+ def getSensorValue(self, sensorid):
+ value = -1
+ sensor = self.sensors_list[sensorid]
+ if sensor[0] == self.TYPE_TEMPERATURE:
+ f = open("%s/value" % sensor[3], "r")
+ value = int(f.readline().strip())
+ f.close()
+ elif sensor[0] == self.TYPE_FAN_RPM:
+ value = fancontrol.getFanSpeed(sensor[3])
+ return value
+
+ def getSensorUnit(self, sensorid):
+ return self.sensors_list[sensorid][2]
+
+ def addSensors(self):
+ import os
+ if os.path.exists("/proc/stb/sensors"):
+ for dirname in os.listdir("/proc/stb/sensors"):
+ if dirname.find("temp", 0, 4) == 0:
+ f = open("/proc/stb/sensors/%s/name" % dirname, "r")
+ name = f.readline().strip()
+ f.close()
+
+ f = open("/proc/stb/sensors/%s/unit" % dirname, "r")
+ unit = f.readline().strip()
+ f.close()
+
+ self.sensors_list.append((self.TYPE_TEMPERATURE, name, unit, "/proc/stb/sensors/%s" % dirname))
+ for fanid in range(fancontrol.getFanCount()):
+ if fancontrol.hasRPMSensor(fanid):
+ self.sensors_list.append((self.TYPE_FAN_RPM, _("Fan %d") % (fanid + 1), "rpm", fanid))
+
+sensors = Sensors() \ No newline at end of file
diff --git a/lib/python/Components/ServiceList.py b/lib/python/Components/ServiceList.py
index b0283c11..6095812a 100644..100755
--- a/lib/python/Components/ServiceList.py
+++ b/lib/python/Components/ServiceList.py
@@ -5,7 +5,7 @@ from skin import parseColor, parseFont
from enigma import eListboxServiceContent, eListbox, eServiceCenter, eServiceReference, gFont, eRect
from Tools.LoadPixmap import LoadPixmap
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
class ServiceList(HTMLComponent, GUIComponent):
MODE_NORMAL = 0
@@ -15,27 +15,27 @@ class ServiceList(HTMLComponent, GUIComponent):
GUIComponent.__init__(self)
self.l = eListboxServiceContent()
- pic = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/folder.png"))
+ pic = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/folder.png"))
if pic:
self.l.setPixmap(self.l.picFolder, pic)
- pic = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/marker.png"))
+ pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/marker.png"))
if pic:
self.l.setPixmap(self.l.picMarker, pic)
- pic = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_dvb_s-fs8.png"))
+ pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "ico_dvb_s-fs8.png"))
if pic:
self.l.setPixmap(self.l.picDVB_S, pic)
- pic = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_dvb_c-fs8.png"))
+ pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "ico_dvb_c-fs8.png"))
if pic:
self.l.setPixmap(self.l.picDVB_C, pic)
- pic = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_dvb_t-fs8.png"))
+ pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "ico_dvb_t-fs8.png"))
if pic:
self.l.setPixmap(self.l.picDVB_T, pic)
- pic = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_service_group-fs8.png"))
+ pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "ico_service_group-fs8.png"))
if pic:
self.l.setPixmap(self.l.picServiceGroup, pic)
diff --git a/lib/python/Components/Sources/List.py b/lib/python/Components/Sources/List.py
index 1eab32b2..6f0670a1 100644
--- a/lib/python/Components/Sources/List.py
+++ b/lib/python/Components/Sources/List.py
@@ -91,8 +91,9 @@ to generate HTML."""
return self.__style
def setStyle(self, style):
- self.__style = style
- self.changed((self.CHANGED_SPECIFIC, "style"))
+ if self.__style != style:
+ self.__style = style
+ self.changed((self.CHANGED_SPECIFIC, "style"))
style = property(getStyle, setStyle)
diff --git a/lib/python/Components/Sources/Makefile.am b/lib/python/Components/Sources/Makefile.am
index 6ef8cac6..436d31be 100644
--- a/lib/python/Components/Sources/Makefile.am
+++ b/lib/python/Components/Sources/Makefile.am
@@ -4,4 +4,4 @@ install_PYTHON = \
__init__.py Clock.py EventInfo.py Source.py List.py CurrentService.py \
FrontendStatus.py Boolean.py Config.py ServiceList.py RdsDecoder.py StreamService.py \
StaticText.py CanvasSource.py ServiceEvent.py Event.py FrontendInfo.py TunerInfo.py \
- RecordState.py Progress.py
+ RecordState.py Progress.py Sensor.py
diff --git a/lib/python/Components/Sources/Sensor.py b/lib/python/Components/Sources/Sensor.py
new file mode 100644
index 00000000..e927bbf4
--- /dev/null
+++ b/lib/python/Components/Sources/Sensor.py
@@ -0,0 +1,31 @@
+from Components.Sensors import sensors
+
+from enigma import eTimer
+
+from Source import Source
+
+class SensorSource(Source):
+ def __init__(self, update_interval = 500, sensorid = None):
+ self.update_interval = update_interval
+ self.sensorid = sensorid
+ Source.__init__(self)
+
+ if sensorid is not None:
+ self.update_timer = eTimer()
+ self.update_timer.callback.append(self.updateValue)
+ self.update_timer.start(self.update_interval)
+
+ def getValue(self):
+ if self.sensorid is not None:
+ return sensors.getSensorValue(self.sensorid)
+ return None
+
+ def getUnit(self):
+ return sensors.getSensorUnit(self.sensorid)
+
+ def updateValue(self):
+ self.changed((self.CHANGED_POLL,))
+
+ def destroy(self):
+ if self.sensorid is not None:
+ self.update_timer.callback.remove(self.updateValue)
diff --git a/lib/python/Components/SystemInfo.py b/lib/python/Components/SystemInfo.py
index d2b405a2..f9c4065f 100644
--- a/lib/python/Components/SystemInfo.py
+++ b/lib/python/Components/SystemInfo.py
@@ -1,5 +1,6 @@
from enigma import eDVBResourceManager
from Tools.Directories import fileExists
+from Tools.HardwareInfo import HardwareInfo
SystemInfo = { }
@@ -27,3 +28,4 @@ def countFrontpanelLEDs():
SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs()
SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists("/dev/dbox/lcd0")
SystemInfo["FrontpanelDisplayGrayscale"] = fileExists("/dev/dbox/oled0")
+SystemInfo["DeepstandbySupport"] = HardwareInfo().get_device_name() != "dm800"
diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py
index df94f8a6..2e4e757d 100644
--- a/lib/python/Components/Task.py
+++ b/lib/python/Components/Task.py
@@ -16,6 +16,7 @@ class Job(object):
self.end = 100
self.__progress = 0
self.weightScale = 1
+ self.afterEvent = None
self.state_changed = CList()
@@ -370,12 +371,20 @@ class DiskspacePrecondition(Condition):
class ToolExistsPrecondition(Condition):
def check(self, task):
import os
+
if task.cmd[0]=='/':
- realpath = task.cmd
+ self.realpath = task.cmd
+ print "[Task.py][ToolExistsPrecondition] WARNING: usage of absolute paths for tasks should be avoided!"
+ return os.access(self.realpath, os.X_OK)
else:
- realpath = task.cwd + '/' + task.cmd
- self.realpath = realpath
- return os.access(realpath, os.X_OK)
+ self.realpath = task.cmd
+ path = os.environ.get('PATH', '').split(os.pathsep)
+ path.append(task.cwd + '/')
+ absolutes = filter(lambda file: os.access(file, os.X_OK), map(lambda directory, file = task.cmd: os.path.join(directory, file), path))
+ if len(absolutes) > 0:
+ self.realpath = task.cmd[0]
+ return True
+ return False
def getErrorMessage(self, task):
return _("A required tool (%s) was not found.") % (self.realpath)
diff --git a/lib/python/Components/TimerList.py b/lib/python/Components/TimerList.py
index 44a7eb4f..30097c96 100644..100755
--- a/lib/python/Components/TimerList.py
+++ b/lib/python/Components/TimerList.py
@@ -7,7 +7,7 @@ from enigma import eListboxPythonMultiContent, eListbox, gFont, \
RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_VALIGN_CENTER
from Tools.LoadPixmap import LoadPixmap
from timer import TimerEntry
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
class TimerList(HTMLComponent, GUIComponent, object):
#
@@ -33,12 +33,18 @@ class TimerList(HTMLComponent, GUIComponent, object):
count += 1
flags = flags >> 1
if timer.justplay:
- res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s "+ _("(ZAP)")) % (FuzzyTime(timer.begin)[1]))))
+ if timer.end - timer.begin < 4: # rounding differences
+ res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s "+ _("(ZAP)")) % (FuzzyTime(timer.begin)[1]))))
+ else:
+ res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s ... %s (%d " + _("mins") + ") ") % (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60)) + _("(ZAP)")))
else:
res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s ... %s (%d " + _("mins") + ")") % (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60))))
else:
if timer.justplay:
- res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s " + _("(ZAP)")) % (FuzzyTime(timer.begin)))))
+ if timer.end - timer.begin < 4:
+ res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s " + _("(ZAP)")) % (FuzzyTime(timer.begin)))))
+ else:
+ res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s ... %s (%d " + _("mins") + ") ") % (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:] + ((timer.end - timer.begin) / 60,))) + _("(ZAP)")))
else:
res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s ... %s (%d " + _("mins") + ")") % (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:] + ((timer.end - timer.begin) / 60,)))))
@@ -65,7 +71,7 @@ class TimerList(HTMLComponent, GUIComponent, object):
res.append((eListboxPythonMultiContent.TYPE_TEXT, width-150, 50, 150, 20, 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, state))
if timer.disabled:
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/redx.png"))
+ png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/redx.png"))
res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 490, 5, 40, 40, png))
return res
diff --git a/lib/python/Components/TuneTest.py b/lib/python/Components/TuneTest.py
index f9ab3edb..44b19091 100644
--- a/lib/python/Components/TuneTest.py
+++ b/lib/python/Components/TuneTest.py
@@ -1,8 +1,9 @@
from enigma import eDVBFrontendParametersSatellite, eDVBFrontendParameters, eDVBResourceManager, eTimer
class Tuner:
- def __init__(self, frontend):
+ def __init__(self, frontend, ignore_rotor=False):
self.frontend = frontend
+ self.ignore_rotor = ignore_rotor
# transponder = (frequency, symbolrate, polarisation, fec, inversion, orbpos, system, modulation, rolloff, pilot, tsid, onid)
# 0 1 2 3 4 5 6 7 8 9 10 11
@@ -21,7 +22,7 @@ class Tuner:
parm.rolloff = transponder[8]
parm.pilot = transponder[9]
feparm = eDVBFrontendParameters()
- feparm.setDVBS(parm)
+ feparm.setDVBS(parm, self.ignore_rotor)
self.lastparm = feparm
self.frontend.tune(feparm)
diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py
index 6fcab8bc..60827107 100644
--- a/lib/python/Components/UsageConfig.py
+++ b/lib/python/Components/UsageConfig.py
@@ -1,12 +1,13 @@
from Components.Harddisk import harddiskmanager
from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigNumber, ConfigSet, ConfigLocations
+from Tools.Directories import resolveFilename, SCOPE_HDD
from enigma import Misc_Options, setTunerTypePriorityOrder;
from SystemInfo import SystemInfo
import os
def InitUsageConfig():
config.usage = ConfigSubsection();
- config.usage.showdish = ConfigYesNo(default = False)
+ config.usage.showdish = ConfigYesNo(default = True)
config.usage.multibouquet = ConfigYesNo(default = False)
config.usage.quickzap_bouquet_change = ConfigYesNo(default = False)
config.usage.e1like_radio_mode = ConfigYesNo(default = False)
@@ -30,8 +31,11 @@ def InitUsageConfig():
("standard", _("standard")), ("swap", _("swap PiP and main picture")),
("swapstop", _("move PiP to main picture")), ("stop", _("stop PiP")) ])
+ config.usage.default_path = ConfigText(default = resolveFilename(SCOPE_HDD))
+ config.usage.timer_path = ConfigText(default = "<default>")
+ config.usage.instantrec_path = ConfigText(default = "<default>")
+ config.usage.timeshift_path = ConfigText(default = "/media/hdd/")
config.usage.allowed_timeshift_paths = ConfigLocations(default = ["/media/hdd/"])
- config.usage.timeshift_path = ConfigText(default = "/media/hdd")
config.usage.on_movie_start = ConfigSelection(default = "ask", choices = [
("ask", _("Ask user")), ("resume", _("Resume from last position")), ("beginning", _("Start from the beginning")) ])
@@ -65,19 +69,19 @@ def InitUsageConfig():
def TunerTypePriorityOrderChanged(configElement):
setTunerTypePriorityOrder(int(configElement.value))
- config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged)
+ config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged, immediate_feedback=False)
def setHDDStandby(configElement):
for hdd in harddiskmanager.HDDList():
hdd[1].setIdleTime(int(configElement.value))
- config.usage.hdd_standby.addNotifier(setHDDStandby)
+ config.usage.hdd_standby.addNotifier(setHDDStandby, immediate_feedback=False)
def set12VOutput(configElement):
if configElement.value == "on":
Misc_Options.getInstance().set_12V_output(1)
elif configElement.value == "off":
Misc_Options.getInstance().set_12V_output(0)
- config.usage.output_12V.addNotifier(set12VOutput)
+ config.usage.output_12V.addNotifier(set12VOutput, immediate_feedback=False)
SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
@@ -128,3 +132,23 @@ def updateChoices(sel, choices):
defval = str(x)
break
sel.setChoices(map(str, choices), defval)
+
+def preferredPath(path):
+ if config.usage.setup_level.index < 2 or path == "<default>":
+ return None # config.usage.default_path.value, but delay lookup until usage
+ elif path == "<current>":
+ return config.movielist.last_videodir.value
+ elif path == "<timer>":
+ return config.movielist.last_timer_videodir.value
+ else:
+ return path
+
+def preferredTimerPath():
+ return preferredPath(config.usage.timer_path.value)
+
+def preferredInstantRecordPath():
+ return preferredPath(config.usage.instantrec_path.value)
+
+def defaultMoviePath():
+ return config.usage.default_path.value
+
diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py
index 789ec32f..471b59ec 100755
--- a/lib/python/Components/config.py
+++ b/lib/python/Components/config.py
@@ -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
@@ -1034,13 +1034,13 @@ class ConfigSelectionNumber(ConfigSelection):
step += stepwidth
ConfigSelection.__init__(self, choices, default)
-
+
def getValue(self):
- return int(self.text)
+ return int(ConfigSelection.getValue(self))
def setValue(self, val):
- self.text = str(val)
-
+ ConfigSelection.setValue(self, str(val))
+
def handleKey(self, key):
if not self.wraparound:
if key == KEY_RIGHT:
@@ -1050,8 +1050,6 @@ class ConfigSelectionNumber(ConfigSelection):
if self.choices.index(self.value) == 0:
return
ConfigSelection.handleKey(self, key)
-
-
class ConfigNumber(ConfigText):
def __init__(self, default = 0):
@@ -1140,6 +1138,9 @@ class ConfigDirectory(ConfigText):
else:
return ConfigText.getMulti(self, selected)
+ def onSelect(self, session):
+ self.allmarked = (self.value != "")
+
# a slider.
class ConfigSlider(ConfigElement):
def __init__(self, default = 0, increment = 1, limits = (0, 100)):
@@ -1285,7 +1286,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 +1322,7 @@ class ConfigLocations(ConfigElement):
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 +1341,11 @@ class ConfigLocations(ConfigElement):
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 +1355,7 @@ class ConfigLocations(ConfigElement):
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):