aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
authorFraxinas <andreas.frisch@multimedia-labs.de>2008-12-14 01:22:59 +0100
committerFraxinas <andreas.frisch@multimedia-labs.de>2008-12-14 01:22:59 +0100
commit56ac7a4a764a4251a851778df09967405aa9a930 (patch)
tree43ec1be37fefc1ac4a6e03bb51e43b5f579ec9cc /lib/python/Components
parent5b4292943b2cf011b19929aa19c85a939cc72714 (diff)
parentb833353b5285a547eb18c079aa860c9ee2765d6e (diff)
downloadenigma2-56ac7a4a764a4251a851778df09967405aa9a930.tar.gz
enigma2-56ac7a4a764a4251a851778df09967405aa9a930.zip
Merge branch 'master' of fraxinas@git.opendreambox.org:/git/enigma2
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/Converter/RemainingToText.py34
-rw-r--r--lib/python/Components/Converter/ServicePosition.py13
-rw-r--r--lib/python/Components/NimManager.py10
-rw-r--r--lib/python/Components/ServiceScan.py86
-rw-r--r--lib/python/Components/UsageConfig.py8
-rwxr-xr-xlib/python/Components/config.py53
6 files changed, 135 insertions, 69 deletions
diff --git a/lib/python/Components/Converter/RemainingToText.py b/lib/python/Components/Converter/RemainingToText.py
index adefe9cf..4249e30a 100644
--- a/lib/python/Components/Converter/RemainingToText.py
+++ b/lib/python/Components/Converter/RemainingToText.py
@@ -2,19 +2,43 @@ from Components.Converter.Converter import Converter
from Components.Element import cached
class RemainingToText(Converter, object):
+ DEFAULT = 0
+ WITH_SECONDS = 1
+ NO_SECONDS = 2
+
def __init__(self, type):
Converter.__init__(self, type)
+ if type == "WithSeconds":
+ self.type = self.WITH_SECONDS
+ elif type == "NoSeconds":
+ self.type = self.NO_SECONDS
+ else:
+ self.type = self.DEFAULT
@cached
def getText(self):
- r = self.source.time
- if r is None:
+ time = self.source.time
+ if time is None:
return ""
(duration, remaining) = self.source.time
- if remaining is not None:
- return "+%d min" % (remaining / 60)
+
+ if self.type == self.WITH_SECONDS:
+ if remaining is not None:
+ return "%d:%02d:%02d" % (remaining / 3600, (remaining / 60) - ((remaining / 3600) * 60), remaining % 60)
+ else:
+ return "%02d:%02d:%02d" % (duration / 3600, (duration / 60) - ((duration / 3600) * 60), duration % 60)
+ elif self.type == self.NO_SECONDS:
+ if remaining is not None:
+ return "+%d:%02d" % (remaining / 3600, (remaining / 60) - ((remaining / 3600) * 60))
+ else:
+ return "%02d:%02d" % (duration / 3600, (duration / 60) - ((duration / 3600) * 60))
+ elif self.type == self.DEFAULT:
+ if remaining is not None:
+ return "+%d min" % (remaining / 60)
+ else:
+ return "%d min" % (duration / 60)
else:
- return "%d min" % (duration / 60)
+ return "???"
text = property(getText)
diff --git a/lib/python/Components/Converter/ServicePosition.py b/lib/python/Components/Converter/ServicePosition.py
index b488258b..d7a55dae 100644
--- a/lib/python/Components/Converter/ServicePosition.py
+++ b/lib/python/Components/Converter/ServicePosition.py
@@ -19,6 +19,7 @@ class ServicePosition(Converter, Poll, object):
self.negate = 'Negate' in args
self.detailed = 'Detailed' in args
self.showHours = 'ShowHours' in args
+ self.showNoSeconds = 'ShowNoSeconds' in args
if self.detailed:
self.poll_interval = 100
@@ -34,7 +35,7 @@ class ServicePosition(Converter, Poll, object):
elif type == "Gauge":
self.type = self.TYPE_GAUGE
else:
- raise "type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours}"
+ raise "type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours|NoSeconds}"
self.poll_enabled = self.type != self.TYPE_LENGTH
@@ -94,9 +95,15 @@ class ServicePosition(Converter, Poll, object):
if not self.detailed:
if self.showHours:
- return sign + "%d:%02d:%02d" % (l/3600, l%3600/60, l%60)
+ if self.showNoSeconds:
+ return sign + "%d:%02d" % (l/3600, l%3600/60)
+ else:
+ return sign + "%d:%02d:%02d" % (l/3600, l%3600/60, l%60)
else:
- return sign + "%d:%02d" % (l/60, l%60)
+ if self.showNoSeconds:
+ return sign + "%d" % (l/60)
+ else:
+ return sign + "%d:%02d" % (l/60, l%60)
else:
if self.showHours:
return sign + "%d:%02d:%02d:%03d" % ((l/3600/90000), (l/90000)%3600/60, (l/90000)%60, (l%90000)/90)
diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py
index edd3bbbb..168962e9 100644
--- a/lib/python/Components/NimManager.py
+++ b/lib/python/Components/NimManager.py
@@ -381,6 +381,8 @@ class SecConfigure:
sec.setLNBSlotMask(tunermask)
+ sec.setLNBPrio(int(currLnb.prio.value))
+
# finally add the orbital positions
for y in lnbSat[x]:
self.addSatellite(sec, y)
@@ -1026,6 +1028,14 @@ def InitNimManager(nimmgr):
nim.advanced.lnb[x].fastTurningBegin = ConfigDateTime(default=mktime(btime.timetuple()), formatstring = _("%H:%M"), increment = 600)
etime = datetime(1970, 1, 1, 19, 0);
nim.advanced.lnb[x].fastTurningEnd = ConfigDateTime(default=mktime(etime.timetuple()), formatstring = _("%H:%M"), increment = 600)
+ prio_list = [ ("-1", _("Auto")) ]
+ for prio in range(65):
+ prio_list.append((str(prio), str(prio)))
+ for prio in range(14000,14065):
+ prio_list.append((str(prio), str(prio)))
+ for prio in range(19000,19065):
+ prio_list.append((str(prio), str(prio)))
+ nim.advanced.lnb[x].prio = ConfigSelection(default="-1", choices=prio_list)
elif slot.isCompatible("DVB-C"):
nim.configMode = ConfigSelection(
choices = {
diff --git a/lib/python/Components/ServiceScan.py b/lib/python/Components/ServiceScan.py
index 5a7b3dea..5d624264 100644
--- a/lib/python/Components/ServiceScan.py
+++ b/lib/python/Components/ServiceScan.py
@@ -36,54 +36,46 @@ class ServiceScan:
tp_text = ""
if transponder:
tp_type = transponder.getSystem()
- if not tp_type[0]:
- tp_type = tp_type[1]
- if tp_type == iDVBFrontend.feSatellite:
- network = _("Satellite")
- tp = transponder.getDVBS()
- if not tp[0]:
- tp = tp[1]
- orb_pos = tp.orbital_position
- try:
- sat_name = str(nimmgr.getSatDescription(orb_pos))
- except KeyError:
- sat_name = ""
- if orb_pos > 1800: # west
- orb_pos = 3600 - orb_pos
- h = _("W")
- else:
- h = _("E")
- if sat_name.find("%d.%d" % (orb_pos/10, orb_pos%10)) != -1:
- network = sat_name
- else:
- network = ("%s %d.%d %s") % (sat_name, orb_pos / 10, orb_pos % 10, h)
- tp_text = ("%s %s %d%c / %d / %s") %( { 0 : "DVB-S", 1 : "DVB-S2" }[tp.system],
- { 0 : "Auto", 1 : "QPSK", 2 : "M8PSK", 3 : "QAM16" }[tp.modulation],
- tp.frequency/1000,
- { 0 : 'H', 1 : 'V', 2 : 'L', 3 : 'R' }[tp.polarisation],
- tp.symbol_rate/1000,
- { 0 : "AUTO", 1 : "1/2", 2 : "2/3", 3 : "3/4", 4 : "5/6",
- 5 : "7/8", 6 : "8/9", 7 : "3/5", 8 : "4/5", 9 : "9/10",
- 15 : "NONE" }[tp.fec] )
- elif tp_type == iDVBFrontend.feCable:
- network = _("Cable")
- tp = transponder.getDVBC()
- if not tp[0]:
- tp = tp[1]
- tp_text = ("DVB-C %s %d / %d / %s") %( { 0 : "AUTO", 1 : "QAM16", 2 : "QAM32", 3 : "QAM64", 4 : "QAM128", 5 : "QAM256" }[tp.modulation],
- tp.frequency,
- tp.symbol_rate/1000,
- { 0 : "AUTO", 1 : "1/2", 2 : "2/3", 3 : "3/4", 4 : "5/6", 5 : "7/8", 6 : "8/9", 15 : "NONE" }[tp.fec_inner] )
- elif tp_type == iDVBFrontend.feTerrestrial:
- network = _("Terrestrial")
- tp = transponder.getDVBT()
- if not tp[0]:
- tp = tp[1]
- tp_text = ("DVB-T %s %d %s") %( { 0 : "QPSK", 1 : "QAM16", 2 : "QAM64", 3 : "AUTO"}[tp.modulation],
- tp.frequency,
- { 0 : "Bw 8MHz", 1 : "Bw 7MHz", 2 : "Bw 6MHz", 3 : "Bw Auto" }[tp.bandwidth])
+ if tp_type == iDVBFrontend.feSatellite:
+ network = _("Satellite")
+ tp = transponder.getDVBS()
+ orb_pos = tp.orbital_position
+ try:
+ sat_name = str(nimmgr.getSatDescription(orb_pos))
+ except KeyError:
+ sat_name = ""
+ if orb_pos > 1800: # west
+ orb_pos = 3600 - orb_pos
+ h = _("W")
else:
- print "unknown transponder type in scanStatusChanged"
+ h = _("E")
+ if sat_name.find("%d.%d" % (orb_pos/10, orb_pos%10)) != -1:
+ network = sat_name
+ else:
+ network = ("%s %d.%d %s") % (sat_name, orb_pos / 10, orb_pos % 10, h)
+ tp_text = ("%s %s %d%c / %d / %s") %( { 0 : "DVB-S", 1 : "DVB-S2" }[tp.system],
+ { 0 : "Auto", 1 : "QPSK", 2 : "M8PSK", 3 : "QAM16" }[tp.modulation],
+ tp.frequency/1000,
+ { 0 : 'H', 1 : 'V', 2 : 'L', 3 : 'R' }[tp.polarisation],
+ tp.symbol_rate/1000,
+ { 0 : "AUTO", 1 : "1/2", 2 : "2/3", 3 : "3/4", 4 : "5/6",
+ 5 : "7/8", 6 : "8/9", 7 : "3/5", 8 : "4/5", 9 : "9/10",
+ 15 : "NONE" }[tp.fec] )
+ elif tp_type == iDVBFrontend.feCable:
+ network = _("Cable")
+ tp = transponder.getDVBC()
+ tp_text = ("DVB-C %s %d / %d / %s") %( { 0 : "AUTO", 1 : "QAM16", 2 : "QAM32", 3 : "QAM64", 4 : "QAM128", 5 : "QAM256" }[tp.modulation],
+ tp.frequency,
+ tp.symbol_rate/1000,
+ { 0 : "AUTO", 1 : "1/2", 2 : "2/3", 3 : "3/4", 4 : "5/6", 5 : "7/8", 6 : "8/9", 15 : "NONE" }[tp.fec_inner] )
+ elif tp_type == iDVBFrontend.feTerrestrial:
+ network = _("Terrestrial")
+ tp = transponder.getDVBT()
+ tp_text = ("DVB-T %s %d %s") %( { 0 : "QPSK", 1 : "QAM16", 2 : "QAM64", 3 : "AUTO"}[tp.modulation],
+ tp.frequency,
+ { 0 : "Bw 8MHz", 1 : "Bw 7MHz", 2 : "Bw 6MHz", 3 : "Bw Auto" }[tp.bandwidth])
+ else:
+ print "unknown transponder type in scanStatusChanged"
self.network.setText(network)
self.transponder.setText(tp_text)
diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py
index 6ed87840..2ea91aeb 100644
--- a/lib/python/Components/UsageConfig.py
+++ b/lib/python/Components/UsageConfig.py
@@ -89,8 +89,8 @@ def InitUsageConfig():
config.seek.speeds_backward = ConfigSet(default=[8, 16, 32, 64, 128], choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8], choices=[2, 4, 6, 8, 12, 16, 25])
- config.seek.enter_forward = ConfigSelection(default = "2", choices = ["2"])
- config.seek.enter_backward = ConfigSelection(default = "2", choices = ["2"])
+ config.seek.enter_forward = ConfigSelection(default = "2", choices = ["2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
+ config.seek.enter_backward = ConfigSelection(default = "1", choices = ["1", "2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
config.seek.stepwise_minspeed = ConfigSelection(default = "16", choices = ["Never", "2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
config.seek.stepwise_repeat = ConfigSelection(default = "3", choices = ["2", "3", "4", "5", "6"])
@@ -104,14 +104,14 @@ def InitUsageConfig():
configElement.value = [2]
updateChoices(config.seek.enter_forward, configElement.value)
- config.seek.speeds_forward.addNotifier(updateEnterForward)
+ config.seek.speeds_forward.addNotifier(updateEnterForward, immediate_feedback = False)
def updateEnterBackward(configElement):
if not configElement.value:
configElement.value = [2]
updateChoices(config.seek.enter_backward, configElement.value)
- config.seek.speeds_backward.addNotifier(updateEnterBackward)
+ config.seek.speeds_backward.addNotifier(updateEnterBackward, immediate_feedback = False)
def updateChoices(sel, choices):
if choices:
diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py
index cfa4318c..1efb8a56 100755
--- a/lib/python/Components/config.py
+++ b/lib/python/Components/config.py
@@ -31,8 +31,10 @@ class ConfigElement(object):
object.__init__(self)
self.saved_value = None
+ self.last_value = None
self.save_disabled = False
self.notifiers = []
+ self.notifiers_final = []
self.enabled = True
self.callNotifiersOnSaveAndCancel = False
@@ -85,10 +87,16 @@ class ConfigElement(object):
for x in self.notifiers:
x(self)
- def addNotifier(self, notifier, initial_call = True):
+ def changedFinal(self):
+ for x in self.notifiers_final:
+ x(self)
+
+ def addNotifier(self, notifier, initial_call = True, immediate_feedback = True):
assert callable(notifier), "notifiers must be callable"
- self.notifiers.append(notifier)
-
+ if immediate_feedback:
+ self.notifiers.append(notifier)
+ else:
+ self.notifiers_final.append(notifier)
# CHECKME:
# do we want to call the notifier
# - at all when adding it? (yes, though optional)
@@ -110,7 +118,9 @@ class ConfigElement(object):
pass
def onDeselect(self, session):
- pass
+ if not self.last_value == self.value:
+ self.changedFinal()
+ self.last_value = self.value
KEY_LEFT = 0
KEY_RIGHT = 1
@@ -143,6 +153,7 @@ class ConfigSelection(ConfigElement):
ConfigElement.__init__(self)
self._value = None
self.setChoices(choices, default)
+ self.last_value = self._value
def setChoices(self, choices, default = None):
self.choices = []
@@ -262,7 +273,8 @@ class ConfigBoolean(ConfigElement):
def __init__(self, default = False, descriptions = {False: "false", True: "true"}):
ConfigElement.__init__(self)
self.descriptions = descriptions
- self.value = self.default = default
+ self.value = self.last_value = self.default = default
+
def handleKey(self, key):
if key in [KEY_LEFT, KEY_RIGHT]:
self.value = not self.value
@@ -309,6 +321,11 @@ class ConfigBoolean(ConfigElement):
else:
self.value = False
+ def onDeselect(self, session):
+ if not self.last_value == self.value:
+ self.changedFinal()
+ self.last_value = self.value
+
class ConfigYesNo(ConfigBoolean):
def __init__(self, default = False):
ConfigBoolean.__init__(self, default = default, descriptions = {False: _("no"), True: _("yes")})
@@ -326,7 +343,7 @@ class ConfigDateTime(ConfigElement):
ConfigElement.__init__(self)
self.increment = increment
self.formatstring = formatstring
- self.value = self.default = int(default)
+ self.value = self.last_value = self.default = int(default)
def handleKey(self, key):
if key == KEY_LEFT:
@@ -367,6 +384,7 @@ class ConfigSequence(ConfigElement):
self.default = default
self.value = copy.copy(default)
+ self.last_value = copy.copy(default)
self.endNotifier = []
@@ -507,6 +525,11 @@ class ConfigSequence(ConfigElement):
def fromstring(self, value):
return [int(x) for x in value.split(self.seperator)]
+ def onDeselect(self, session):
+ if not self.last_value == self._value:
+ self.changedFinal()
+ self.last_value = copy.copy(self._value)
+
class ConfigIP(ConfigSequence):
def __init__(self, default, auto_jump = False):
ConfigSequence.__init__(self, seperator = ".", limits = [(0,255),(0,255),(0,255),(0,255)], default = default)
@@ -685,7 +708,7 @@ class ConfigText(ConfigElement, NumericalTextInput):
self.offset = 0
self.overwrite = fixed_size
self.help_window = None
- self.value = self.default = default
+ self.value = self.last_value = self.default = default
def validateMarker(self):
if self.fixed_size:
@@ -851,6 +874,9 @@ class ConfigText(ConfigElement, NumericalTextInput):
if self.help_window:
session.deleteDialog(self.help_window)
self.help_window = None
+ if not self.last_value == self.value:
+ self.changedFinal()
+ self.last_value = self.value
def getHTML(self, id):
return '<input type="text" name="' + id + '" value="' + self.value + '" /><br>\n'
@@ -925,6 +951,9 @@ class ConfigNumber(ConfigText):
def onDeselect(self, session):
self.marked_pos = 0
self.offset = 0
+ if not self.last_value == self.value:
+ self.changedFinal()
+ self.last_value = self.value
class ConfigSearchText(ConfigText):
def __init__(self, default = "", fixed_size = False, visible_width = False):
@@ -955,7 +984,7 @@ class ConfigDirectory(ConfigText):
class ConfigSlider(ConfigElement):
def __init__(self, default = 0, increment = 1, limits = (0, 100)):
ConfigElement.__init__(self)
- self.value = self.default = default
+ self.value = self.last_value = self.default = default
self.min = limits[0]
self.max = limits[1]
self.increment = increment
@@ -1027,7 +1056,7 @@ class ConfigSet(ConfigElement):
default = []
self.pos = -1
default.sort()
- self.default = default
+ self.last_value = self.default = default
self.value = default+[]
def toggleChoice(self, choice):
@@ -1036,6 +1065,7 @@ class ConfigSet(ConfigElement):
else:
self.value.append(choice)
self.value.sort()
+ self.changed()
def handleKey(self, key):
if key in KEY_NUMBERS + [KEY_DELETE, KEY_BACKSPACE]:
@@ -1082,7 +1112,9 @@ class ConfigSet(ConfigElement):
def onDeselect(self, session):
self.pos = -1
- self.changed()
+ if not self.last_value == self.value:
+ self.changedFinal()
+ self.last_value = self.value+[]
def tostring(self, value):
return str(value)
@@ -1099,6 +1131,7 @@ class ConfigLocations(ConfigElement):
self.locations = []
self.mountpoints = []
harddiskmanager.on_partition_list_change.append(self.mountpointsChanged)
+ self.value = default+[]
def setValue(self, value):
loc = [x[0] for x in self.locations if x[3]]