diff options
Diffstat (limited to 'lib/python')
| -rw-r--r-- | lib/python/Components/ConfigList.py | 5 | ||||
| -rw-r--r-- | lib/python/Components/InputDevice.py | 6 | ||||
| -rw-r--r-- | lib/python/Components/Lcd.py | 8 | ||||
| -rw-r--r-- | lib/python/Components/NimManager.py | 1 | ||||
| -rw-r--r-- | lib/python/Components/RFmod.py | 2 | ||||
| -rw-r--r-- | lib/python/Components/SetupDevices.py | 8 | ||||
| -rw-r--r-- | lib/python/Components/config.py | 36 | ||||
| -rw-r--r-- | lib/python/Plugins/SystemPlugins/Makefile.am | 2 | ||||
| -rw-r--r-- | lib/python/Plugins/SystemPlugins/PositionerSetup/Makefile.am | 7 | ||||
| -rw-r--r-- | lib/python/Plugins/SystemPlugins/PositionerSetup/__init__.py | 0 | ||||
| -rw-r--r-- | lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py | 137 | ||||
| -rw-r--r-- | lib/python/Screens/ScanSetup.py | 28 |
12 files changed, 216 insertions, 24 deletions
diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py index 7ed00014..6ff9116f 100644 --- a/lib/python/Components/ConfigList.py +++ b/lib/python/Components/ConfigList.py @@ -19,8 +19,9 @@ class ConfigList(HTMLComponent, GUIComponent): def handleKey(self, key): selection = self.getCurrent() - selection[1].handleKey(key) - self.invalidateCurrent() + if selection[1].parent.enabled: + selection[1].handleKey(key) + self.invalidateCurrent() def getCurrent(self): return self.l.getCurrentSelection() diff --git a/lib/python/Components/InputDevice.py b/lib/python/Components/InputDevice.py index f800f302..bfb5435b 100644 --- a/lib/python/Components/InputDevice.py +++ b/lib/python/Components/InputDevice.py @@ -2,7 +2,7 @@ from config import config #global config instance from config import configElement from config import ConfigSubsection -from config import ConfigSlider +from config import configSlider from config import configSelection class inputDevices: @@ -17,8 +17,8 @@ class inputDevices: def InitInputDevices(): config.inputDevices = ConfigSubsection(); - config.inputDevices.repeat = configElement("config.inputDevices.repeat", ConfigSlider, 5, ""); - config.inputDevices.delay = configElement("config.inputDevices.delay", ConfigSlider, 4, ""); + config.inputDevices.repeat = configElement("config.inputDevices.repeat", configSlider, 5, (1, 10)) + config.inputDevices.delay = configElement("config.inputDevices.delay", configSlider, 4, (1, 10)) #this instance anywhere else needed? iDevices = inputDevices(); diff --git a/lib/python/Components/Lcd.py b/lib/python/Components/Lcd.py index 552d5485..ea0c37a1 100644 --- a/lib/python/Components/Lcd.py +++ b/lib/python/Components/Lcd.py @@ -1,5 +1,5 @@ from config import config #global config instance -from config import ConfigSlider +from config import configSlider from config import configSelection from config import ConfigSubsection from config import configElement @@ -25,9 +25,9 @@ class LCD: def InitLcd(): config.lcd = ConfigSubsection(); - config.lcd.bright = configElement("config.lcd.bright", ConfigSlider, 10, "") - config.lcd.contrast = configElement("config.lcd.contrast", ConfigSlider, 10, "") - config.lcd.standby = configElement("config.lcd.standby", ConfigSlider, 0, "") + config.lcd.bright = configElement("config.lcd.bright", configSlider, 10, (1, 10)) + config.lcd.contrast = configElement("config.lcd.contrast", configSlider, 10, (1, 10)) + config.lcd.standby = configElement("config.lcd.standby", configSlider, 0, (1,10)) config.lcd.invert = configElement("config.lcd.invert", configSelection, 0, (("disable", _("Disable")), ("enable", _("Enable")))) ilcd = LCD() diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 1ad4c229..ac73c00e 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -2,7 +2,6 @@ from config import config #global config instance from config import configElement from config import ConfigSubsection -from config import ConfigSlider from config import configSelection from config import currentConfigSelectionElement from config import getConfigSelectionElement diff --git a/lib/python/Components/RFmod.py b/lib/python/Components/RFmod.py index 5ea88ec0..6c7214bc 100644 --- a/lib/python/Components/RFmod.py +++ b/lib/python/Components/RFmod.py @@ -26,7 +26,7 @@ def InitRFmod(): config.rfmod.sound = configElement("config.rfmod.sound", configSelection, 0, (("enable", _("Enable")), ("disable", _("Disable"))) ); config.rfmod.soundcarrier = configElement("config.rfmod.soundcarrier", configSelection, 1, ("4.5 MHz", "5.5 MHz", "6.0 MHz", "6.5 MHz") ); config.rfmod.channel = configElement("config.rfmod.channel", configSelection, 6, ("30", "31", "32", "33", "34", "35", "36", "37", "38", "39") ); - config.rfmod.finetune = configElement("config.rfmod.finetune", ConfigSlider, 5, ""); + config.rfmod.finetune = configElement("config.rfmod.finetune", configSlider, 5, (1, 10)); iRFmod = RFmod() diff --git a/lib/python/Components/SetupDevices.py b/lib/python/Components/SetupDevices.py index 2c5990a9..3398af71 100644 --- a/lib/python/Components/SetupDevices.py +++ b/lib/python/Components/SetupDevices.py @@ -2,7 +2,7 @@ from config import config #global config instance from config import configElement from config import ConfigSubsection -from config import ConfigSlider +from config import configSlider from config import configSelection from config import configText from Components.Timezones import timezones @@ -24,9 +24,9 @@ def InitSetupDevices(): config.keyboard.keymap = configElement("config.keyboard.keymap", configSelection, 1, (_("English"), _("German")) ); config.osd = ConfigSubsection(); - config.osd.alpha = configElement("config.osd.alpha", ConfigSlider, 0, ""); - config.osd.bright = configElement("config.osd.bright", ConfigSlider, 5, ""); - config.osd.contrast = configElement("config.osd.contrast", ConfigSlider, 5, ""); + config.osd.alpha = configElement("config.osd.alpha", configSlider, 0, (1, 10)); + config.osd.bright = configElement("config.osd.bright", configSlider, 5, (1, 10)); + config.osd.contrast = configElement("config.osd.contrast", configSlider, 5, (1, 10)); def languageNotifier(configElement): language.activateLanguage(configElement.value) diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 06bb62a2..635eb748 100644 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -293,7 +293,27 @@ class configSequence: return ("mtext"[1-selected:], value, [mPos]) else: return ("text", value) + +class configNothing: + def __init__(self, parent): + self.parent = parent + self.markedPos = 0 + + def cancel(self): + self.parent.reload() + + def save(self): + self.parent.save() + def nextEntry(self): + self.parent.vals[1](self.parent.getConfigPath()) + + def handleKey(self, key): + pass + + def __call__(self, selected): #needed by configlist + return ("text", "") + class configText: # used as first parameter # is the text of a fixed size or is the user able to extend the length of the text @@ -378,7 +398,7 @@ config = Config(); configfile = configFile() -class ConfigSlider: +class configSlider: def __init__(self, parent): self.parent = parent @@ -392,21 +412,21 @@ class ConfigSlider: if self.parent.value < 0: self.parent.value = 0 - if self.parent.value > 10: - self.parent.value = 10 + if self.parent.value > self.parent.vals[1]: + self.parent.value = self.parent.vals[1] def handleKey(self, key): if key == config.key["prevElement"]: - self.parent.value = self.parent.value - 1 + self.parent.value = self.parent.value - self.parent.vals[0] if key == config.key["nextElement"]: - self.parent.value = self.parent.value + 1 + self.parent.value = self.parent.value + self.parent.vals[0] self.checkValues() self.parent.change() def __call__(self, selected): #needed by configlist self.checkValues() - return ("slider", self.parent.value * 10) + return ("slider", self.parent.value, self.parent.vals[1]) class ConfigSubsection: def __init__(self): @@ -428,7 +448,7 @@ class configElement: return 0 #prevent bigger then array def datafromFile(self, control, data): - if control == ConfigSlider: + if control == configSlider: return int(data) elif control == configSelection: try: @@ -458,7 +478,7 @@ class configElement: return "" def datatoFile(self, control, data): - if control == ConfigSlider: + if control == configSlider: return str(data) elif control == configSelection: if len(self.vals) < data + 1: diff --git a/lib/python/Plugins/SystemPlugins/Makefile.am b/lib/python/Plugins/SystemPlugins/Makefile.am index 41969459..51e14620 100644 --- a/lib/python/Plugins/SystemPlugins/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Makefile.am @@ -1 +1 @@ -SUBDIRS = SoftwareUpdate FrontprocessorUpgrade OldSoftwareUpdate +SUBDIRS = SoftwareUpdate FrontprocessorUpgrade OldSoftwareUpdate PositionerSetup diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/Makefile.am b/lib/python/Plugins/SystemPlugins/PositionerSetup/Makefile.am new file mode 100644 index 00000000..dd9f623c --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/Makefile.am @@ -0,0 +1,7 @@ +installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/PositionerSetup + +install_PYTHON = \ + __init__.py \ + plugin.py + + diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/__init__.py b/lib/python/Plugins/SystemPlugins/PositionerSetup/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/__init__.py diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py new file mode 100644 index 00000000..cd39fecf --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py @@ -0,0 +1,137 @@ +from enigma import eTimer, eDVBSatelliteEquipmentControl +from Screens.Screen import Screen +from Plugins.Plugin import PluginDescriptor + +from Components.Label import Label +from Components.ConfigList import ConfigList +from Components.ActionMap import ActionMap +from Components.config import config, ConfigSubsection, configElement_nonSave, configNothing, getConfigListEntry, configSelection + +class PositionerSetup(Screen): + skin = """ + <screen position="100,100" size="560,400" title="Positioner setup..." > + <widget name="red" position="0,100" size="140,80" backgroundColor="red" halign="center" valign="center" font="Regular;21" /> + <widget name="green" position="140,100" size="140,80" backgroundColor="green" halign="center" valign="center" font="Regular;21" /> + <widget name="yellow" position="280,100" size="140,80" backgroundColor="yellow" halign="center" valign="center" font="Regular;21" /> + <widget name="blue" position="420,100" size="140,80" backgroundColor="blue" halign="center" valign="center" font="Regular;21" /> + <widget name="status" position="0,200" size="550,40" font="Regular;15" /> + <widget name="list" position="100,0" size="350,100" /> + </screen>""" + def __init__(self, session): + self.skin = PositionerSetup.skin + Screen.__init__(self, session) + + self.createConfig() + + self.status = Label("") + self["status"] = self.status + + self.red = Label("") + self["red"] = self.red + self.green = Label("") + self["green"] = self.green + self.yellow = Label("") + self["yellow"] = self.yellow + self.blue = Label("") + self["blue"] = self.blue + + self.list = [] + self["list"] = ConfigList(self.list) + self.createSetup() + + self["actions"] = ActionMap(["DirectionActions", "OkCancelActions", "ColorActions"], + { + "ok": self.go, + "cancel": self.close, + "up": self.up, + "down": self.down, + "left": self.left, + "right": self.right, + "red": self.redKey, + "green": self.greenKey, + "yellow": self.yellowKey, + "blue": self.blueKey, + }, -1) + + self.updateColors("move") + + self.statusTimer = eTimer() + self.statusTimer.timeout.get().append(self.updateStatus) + self.statusTimer.start(500, False) + + def createConfig(self): + config.positioner = ConfigSubsection() + config.positioner.move = configElement_nonSave("move", configNothing, 0, None) + config.positioner.limits = configElement_nonSave("limits", configNothing, 0, None) + config.positioner.storage = configElement_nonSave("storage", configSelection, 0, ("1", "2", "3")) + + def createSetup(self): + self.list.append(getConfigListEntry(_("Positioner movement"), config.positioner.move)) + self.list.append(getConfigListEntry(_("Set limits"), config.positioner.limits)) + self.list.append(getConfigListEntry(_("Positioner storage"), config.positioner.storage)) + + self["list"].l.setList(self.list) + + def go(self): + pass + + def up(self): + self["list"].instance.moveSelection(self["list"].instance.moveUp) + self.updateColors(self["list"].getCurrent()[1].parent.configPath) + + def down(self): + self["list"].instance.moveSelection(self["list"].instance.moveDown) + self.updateColors(self["list"].getCurrent()[1].parent.configPath) + + def left(self): + self["list"].handleKey(config.key["prevElement"]) + + def right(self): + self["list"].handleKey(config.key["nextElement"]) + + def updateColors(self, entry): + if entry == "move": + self.red.setText(_("Move east")) + self.green.setText(_("Step east")) + self.yellow.setText(_("Step west")) + self.blue.setText(_("Move west")) + elif entry == "limits": + self.red.setText(_("Limits off")) + self.green.setText(_("Limit east")) + self.yellow.setText(_("Limit west")) + self.blue.setText("") + elif entry == "storage": + self.red.setText(_("Apply satellite")) + self.green.setText(_("Store position")) + self.yellow.setText(_("Goto position")) + self.blue.setText("") + else: + self.red.setText("") + self.green.setText("") + self.yellow.setText("") + self.blue.setText("") + + def redKey(self): + print "red" + + def greenKey(self): + pass + + def yellowKey(self): + pass + + def blueKey(self): + pass + + def updateStatus(self): + if eDVBSatelliteEquipmentControl.getInstance().isRotorMoving(): + self.status.setText("moving...") + else: + self.status.setText("not moving") + +def PositionerMain(session): + session.open(PositionerSetup) + +def Plugins(): + return PluginDescriptor(name="Positioner setup", description="Setup your positioner", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=PositionerMain) + diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index a51c1c87..6875433f 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -63,6 +63,10 @@ class ScanSetup(Screen): "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) + + self.statusTimer = eTimer() + self.statusTimer.timeout.get().append(self.updateStatus) + #self.statusTimer.start(5000, True) self.list = [] self["config"] = ConfigList(self.list) @@ -156,6 +160,19 @@ class ScanSetup(Screen): elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete": pass + if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"] and currentConfigSelectionElement(config.scan.type) == "single_transponder") or \ + (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"] and currentConfigSelectionElement(config.scan.typecable) == "single_transponder") or \ + (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"] and currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder"): + self.configElementSNR = getConfigListEntry(_("SNR"), config.scan.snr) + self.list.append(self.configElementSNR) + self.configElementACG = getConfigListEntry(_("AGC"), config.scan.agc) + self.list.append(self.configElementACG) + self.configElementBER = getConfigListEntry(_("BER"), config.scan.ber) + self.list.append(self.configElementBER) + self.statusTimer.start(500, False) + else: + self.statusTimer.stop() + self["config"].list = self.list self["config"].l.setList(self.list) @@ -187,6 +204,14 @@ class ScanSetup(Screen): nimList.append(nim[0]) #nimList.append("all") config.scan.nims = configElement_nonSave("config.scan.nims", configSelection, 0, nimList) + + # status + config.scan.snr = configElement_nonSave("config.scan.snr", configSlider, 0, (1, 100)) + config.scan.snr.enabled = False + config.scan.agc = configElement_nonSave("config.scan.agc", configSlider, 0, (1, 100)) + config.scan.agc.enabled = False + config.scan.ber = configElement_nonSave("config.scan.ber", configSlider, 0, (1, 100)) + config.scan.ber.enabled = False # sat config.scan.sat.frequency = configElement_nonSave("config.scan.sat.frequency", configSequence, [11836], configsequencearg.get("INTEGER", (1, 99999))) @@ -235,6 +260,9 @@ class ScanSetup(Screen): self["config"].handleKey(config.key["nextElement"]) self.newConfig() + def updateStatus(self): + print "updatestatus" + def keyNumberGlobal(self, number): print "You pressed number " + str(number) if (self["config"].getCurrent()[1].parent.enabled == True): |
