aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorFraxinas <andreas.frisch@multimedia-labs.de>2008-11-10 10:18:28 +0100
committerFraxinas <andreas.frisch@multimedia-labs.de>2008-11-10 10:18:28 +0100
commit4c2cba9ccb6f754aac9378e2fc2c7b546e6d589c (patch)
tree1ae11748c8a14720c98fb666ffaf8615fd5ff038 /lib/python
parentacbad24424304473f967b678bd9deb51f73acf27 (diff)
parent752d9da39e993387fefbd9ccbf39e5cb8f85735e (diff)
downloadenigma2-4c2cba9ccb6f754aac9378e2fc2c7b546e6d589c.tar.gz
enigma2-4c2cba9ccb6f754aac9378e2fc2c7b546e6d589c.zip
Merge branch 'master' of fraxinas@git.opendreambox.org:/git/enigma2
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/Lcd.py10
-rw-r--r--lib/python/Components/NimManager.py21
-rw-r--r--lib/python/Components/TimerSanityCheck.py54
-rwxr-xr-xlib/python/Components/config.py5
-rwxr-xr-xlib/python/Screens/NetworkSetup.py42
-rw-r--r--lib/python/Screens/TimerEdit.py23
-rw-r--r--lib/python/enigma_python.i4
7 files changed, 106 insertions, 53 deletions
diff --git a/lib/python/Components/Lcd.py b/lib/python/Components/Lcd.py
index 0471843c..0e501237 100644
--- a/lib/python/Components/Lcd.py
+++ b/lib/python/Components/Lcd.py
@@ -44,9 +44,14 @@ def InitLcd():
ilcd = LCD()
- config.lcd.bright = ConfigSlider(default=10, limits=(0, 10))
+ config.lcd.standby = ConfigSlider(default=0, limits=(0, 10))
+ config.lcd.standby.addNotifier(setLCDbright);
+ config.lcd.standby.apply = lambda : setLCDbright(config.lcd.standby)
+
+ config.lcd.bright = ConfigSlider(default=5, limits=(0, 10))
config.lcd.bright.addNotifier(setLCDbright);
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))
@@ -54,9 +59,6 @@ def InitLcd():
else:
config.lcd.contrast = ConfigNothing()
- config.lcd.standby = ConfigSlider(default=0, limits=(0, 10))
- config.lcd.standby.apply = lambda : setLCDbright(config.lcd.standby)
-
config.lcd.invert = ConfigYesNo(default=False)
config.lcd.invert.addNotifier(setLCDinverted);
else:
diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py
index 3c7a147e..32fca47f 100644
--- a/lib/python/Components/NimManager.py
+++ b/lib/python/Components/NimManager.py
@@ -1,3 +1,5 @@
+from Tools.HardwareInfo import HardwareInfo
+
from config import config, ConfigSubsection, ConfigSelection, ConfigFloat, \
ConfigSatlist, ConfigYesNo, ConfigInteger, ConfigSubList, ConfigNothing, \
ConfigSubDict, ConfigOnOff, ConfigDateTime
@@ -153,6 +155,7 @@ class SecConfigure:
for slot in nim_slots:
x = slot.slot
nim = slot.config
+ hw = HardwareInfo()
if slot.isCompatible("DVB-S"):
print "slot: " + str(x) + " configmode: " + str(nim.configMode.value)
if nim.configMode.value in [ "loopthrough", "satposdepends", "nothing" ]:
@@ -185,7 +188,7 @@ class SecConfigure:
loValue = rotorParam.EAST
else:
loValue = rotorParam.WEST
- inputPowerDelta=50
+ inputPowerDelta=hw.get_device_name() == "dm8000" and 15 or 50
useInputPower=False
turning_speed=0
if nim.powerMeasurement.value:
@@ -656,7 +659,7 @@ class NimManager:
def canEqualTo(self, slotid):
type = self.getNimType(slotid)
- if self.getNimConfig(slotid) == "DVB-S2":
+ if type == "DVB-S2":
type = "DVB-S"
nimList = self.getNimListOfType(type, slotid)
for nim in nimList[:]:
@@ -664,10 +667,10 @@ class NimManager:
if mode.configMode.value == "loopthrough" or mode.configMode.value == "satposdepends":
nimList.remove(nim)
return nimList
-
+
def canDependOn(self, slotid):
type = self.getNimType(slotid)
- if self.getNimConfig(slotid) == "DVB-S2":
+ if type == "DVB-S2":
type = "DVB-S"
nimList = self.getNimListOfType(type, slotid)
positionerList = []
@@ -680,6 +683,13 @@ class NimManager:
if lnb != 0:
nimHaveRotor = True
break
+ if not nimHaveRotor:
+ for sat in mode.advanced.sat.values():
+ lnb_num = int(sat.lnb.value)
+ diseqcmode = lnb_num and mode.advanced.lnb[lnb_num].diseqcMode.value or ""
+ if diseqcmode == "1_2":
+ nimHaveRotor = True
+ break
if nimHaveRotor:
alreadyConnected = False
for testnim in nimList:
@@ -842,6 +852,7 @@ def InitSecParams():
def InitNimManager(nimmgr):
InitSecParams()
+ hw = HardwareInfo()
config.Nims = ConfigSubList()
for x in range(len(nimmgr.nim_slots)):
@@ -972,7 +983,7 @@ def InitNimManager(nimmgr):
nim.advanced.lnb[x].latitude = ConfigFloat(default = [50,767], limits = [(0,359),(0,999)])
nim.advanced.lnb[x].latitudeOrientation = ConfigSelection(choices = [("north", _("North")), ("south", _("South"))], default = "north")
nim.advanced.lnb[x].powerMeasurement = ConfigYesNo(default=True)
- nim.advanced.lnb[x].powerThreshold = ConfigInteger(default=50, limits=(0, 100))
+ nim.advanced.lnb[x].powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm8000" and 15 or 50, limits=(0, 100))
nim.advanced.lnb[x].turningSpeed = ConfigSelection(choices = [("fast", _("Fast")), ("slow", _("Slow")), ("fast epoch", _("Fast epoch"))], default = "fast")
btime = datetime(1970, 1, 1, 7, 0);
nim.advanced.lnb[x].fastTurningBegin = ConfigDateTime(default=mktime(btime.timetuple()), formatstring = _("%H:%M"), increment = 600)
diff --git a/lib/python/Components/TimerSanityCheck.py b/lib/python/Components/TimerSanityCheck.py
index e793cdcd..031c9cae 100644
--- a/lib/python/Components/TimerSanityCheck.py
+++ b/lib/python/Components/TimerSanityCheck.py
@@ -1,9 +1,7 @@
-import string
import NavigationInstance
from time import localtime
-from Components.NimManager import nimmanager
from ServiceReference import ServiceReference
-from enigma import iServiceInformation, eServiceCenter
+from enigma import iServiceInformation, eServiceCenter, eServiceReference
class TimerSanityCheck:
def __init__(self, timerlist, newtimer=None):
@@ -54,6 +52,7 @@ class TimerSanityCheck:
# index -1 for the new Timer, 0..n index of the existing timers
# count of running timers
+ serviceHandler = eServiceCenter.getInstance()
print "checkTimerlist"
# create a list with all start and end times
# split it into recurring and singleshot timers
@@ -149,9 +148,7 @@ class TimerSanityCheck:
fakeRecList = []
ConflictTimer = None
ConflictTunerType = None
- ConflictSlot = None
newTimerTunerType = None
- newTimerTunerSlot = None
cnt = 0
idx = 0
overlaplist = []
@@ -162,24 +159,45 @@ class TimerSanityCheck:
else:
timer = self.timerlist[event[2]]
if event[1] == self.bflag:
- fakeRecService = NavigationInstance.instance.recordService(timer.service_ref)
- fakeRecResult = fakeRecService.start(True)
- feinfo = fakeRecService.frontendInfo().getFrontendData()
- tunerType = feinfo.get("tuner_type")
- tunerSlot = feinfo.get("tuner_number")
+ tunerType = [ ]
+ fakeRecService = NavigationInstance.instance.recordService(timer.service_ref, True)
+ if fakeRecService:
+ fakeRecResult = fakeRecService.start(True)
+ else:
+ fakeRecResult = -1
+ if not fakeRecResult: # tune okay
+ feinfo = fakeRecService.frontendInfo().getFrontendData()
+ tunerType.append(feinfo.get("tuner_type"))
+ else: # tune failed.. so we must go another way to get service type (DVB-S, DVB-T, DVB-C)
+
+ def getServiceType(ref): # helper function to get a service type of a service reference
+ serviceInfo = serviceHandler.info(ref)
+ serviceInfo = serviceInfo and serviceInfo.getInfoObject(ref, iServiceInformation.sTransponderData)
+ if serviceInfo:
+ return { "Satellite" : "DVB-S", "Cable" : "DVB-C", "Terrestrial" : "DVB-T"}[serviceInfo["type"]]
+
+ ref = timer.service_ref.ref
+ if ref.flags & eServiceReference.isGroup: # service group ?
+ serviceList = serviceHandler.list(ref) # get all alternative services
+ if serviceList:
+ for ref in serviceList.getContent("R"): # iterate over all group service references
+ type = getServiceType(ref)
+ if not type in tunerType: # just add single time
+ tunerType.append(type)
+ else:
+ tunerType.append(getServiceType(ref))
+
if event[2] == -1: # new timer
newTimerTunerType = tunerType
- newTimerTunerSlot = tunerSlot
- overlaplist.append((fakeRecResult, timer, tunerType, tunerSlot))
+ overlaplist.append((fakeRecResult, timer, tunerType))
fakeRecList.append((timer, fakeRecService))
if fakeRecResult:
if ConflictTimer is None: # just take care of the first conflict
ConflictTimer = timer
ConflictTunerType = tunerType
- ConflictTunerSlot = tunerSlot
elif event[1] == self.eflag:
for fakeRec in fakeRecList:
- if timer == fakeRec[0]:
+ if timer == fakeRec[0] and fakeRec[1]:
NavigationInstance.instance.stopRecordService(fakeRec[1])
fakeRecList.remove(fakeRec)
del fakeRec
@@ -211,7 +229,6 @@ class TimerSanityCheck:
if nt and kt:
ConflictTimer = self.newtimer
ConflictTunerType = newTimerTunerType
- ConflictSlot = newTimerTunerSlot
break
self.simultimer = [ ConflictTimer ]
@@ -223,8 +240,11 @@ class TimerSanityCheck:
else:
continue
for entry in event[4]:
- if not self.simultimer.count(entry[1]) and (entry[2] == ConflictTunerType or entry[3] == ConflictTunerSlot):
- self.simultimer.append(entry[1])
+ if not entry[1] in self.simultimer:
+ for x in entry[2]:
+ if x in ConflictTunerType:
+ self.simultimer.append(entry[1])
+ break
if len(self.simultimer) < 2:
print "Bug: unknown Conflict!"
diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py
index c21a9192..4ddcabec 100755
--- a/lib/python/Components/config.py
+++ b/lib/python/Components/config.py
@@ -34,6 +34,7 @@ class ConfigElement(object):
self.save_disabled = False
self.notifiers = []
self.enabled = True
+ self.callNotifiersOnSaveAndCancel = False
# you need to override this to do input validation
def setValue(self, value):
@@ -66,9 +67,13 @@ class ConfigElement(object):
self.saved_value = None
else:
self.saved_value = self.tostring(self.value)
+ if self.callNotifiersOnSaveAndCancel:
+ self.changed()
def cancel(self):
self.load()
+ if self.callNotifiersOnSaveAndCancel:
+ self.changed()
def isChanged(self):
sv = self.saved_value
diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py
index 887e1674..580673e4 100755
--- a/lib/python/Screens/NetworkSetup.py
+++ b/lib/python/Screens/NetworkSetup.py
@@ -50,8 +50,8 @@ class NetworkAdapterSelection(Screen,HelpableScreen):
Screen.__init__(self, session)
HelpableScreen.__init__(self)
- self.wlan_errortext = _("No working wireless networkadapter found.\nPlease verify that you have attached a compatible WLAN USB Stick and your Network is configured correctly.")
- self.lan_errortext = _("No working local networkadapter found.\nPlease verify that you have attached a network cable and your Network is configured correctly.")
+ self.wlan_errortext = _("No working wireless network adapter found.\nPlease verify that you have attached a compatible WLAN device and your network is configured correctly.")
+ self.lan_errortext = _("No working local network adapter found.\nPlease verify that you have attached a network cable and your network is configured correctly.")
self.oktext = _("Press OK on your remote control to continue.")
self.restartLanRef = None
@@ -67,18 +67,18 @@ class NetworkAdapterSelection(Screen,HelpableScreen):
self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
{
- "cancel": (self.close, _("exit networkinterface list")),
+ "cancel": (self.close, _("exit network interface list")),
"ok": (self.okbuttonClick, _("select interface")),
})
self["ColorActions"] = HelpableActionMap(self, "ColorActions",
{
- "red": (self.close, _("exit networkinterface list")),
+ "red": (self.close, _("exit network interface list")),
})
self["DefaultInterfaceAction"] = HelpableActionMap(self, "ColorActions",
{
- "blue": (self.setDefaultInterface, [_("Set interface as default Interface"),_("* Only available if more then one interface is active.")] ),
+ "blue": (self.setDefaultInterface, [_("Set interface as default Interface"),_("* Only available if more than one interface is active.")] ),
})
self.list = []
@@ -273,13 +273,18 @@ class NameserverSetup(Screen, ConfigListScreen, HelpableScreen):
self.createSetup()
class AdapterSetup(Screen, ConfigListScreen, HelpableScreen):
- def __init__(self, session, iface,essid=None, aplist=None):
+ def __init__(self, session, networkinfo, essid=None, aplist=None):
Screen.__init__(self, session)
HelpableScreen.__init__(self)
self.session = session
- self.iface = iface
- self.essid = essid
- self.aplist = aplist
+ if isinstance(networkinfo, (list, tuple)):
+ self.iface = networkinfo[0]
+ self.essid = networkinfo[1]
+ self.aplist = networkinfo[2]
+ else:
+ self.iface = networkinfo
+ self.essid = essid
+ self.aplist = aplist
self.extended = None
self.applyConfigRef = None
self.finished_cb = None
@@ -290,19 +295,19 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen):
self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
{
- "cancel": (self.cancel, _("exit networkadapter setup menu")),
+ "cancel": (self.cancel, _("exit network adapter setup menu")),
"ok": (self.ok, _("select menu entry")),
})
self["ColorActions"] = HelpableActionMap(self, "ColorActions",
{
- "red": (self.cancel, _("exit networkadapter configuration")),
+ "red": (self.cancel, _("exit network adapter configuration")),
"blue": (self.KeyBlue, _("open nameserver configuration")),
})
self["VirtualKB"] = HelpableActionMap(self, "ColorActions",
{
- "green": (self.KeyGreen, [_("open virtual keyboard input help"),_("* Only available when entering hidden ssid or network key")] ),
+ "green": (self.KeyGreen, [_("open virtual keyboard input help"),_("* Only available when entering hidden SSID or network key")] ),
})
self["actions"] = NumberActionMap(["SetupActions"],
@@ -516,7 +521,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen):
if self.iface == "wlan0" or self.iface == "ath0" :
if self["config"].getCurrent() == self.hiddenSSID:
if config.plugins.wlan.essid.value == 'hidden...':
- self.session.openWithCallback(self.VirtualKeyBoardSSIDCallback, VirtualKeyBoard, title = (_("Enter WLAN networkname/SSID:")), text = config.plugins.wlan.essid.value)
+ self.session.openWithCallback(self.VirtualKeyBoardSSIDCallback, VirtualKeyBoard, title = (_("Enter WLAN network name/SSID:")), text = config.plugins.wlan.essid.value)
if self["config"].getCurrent() == self.encryptionKey:
self.session.openWithCallback(self.VirtualKeyBoardKeyCallback, VirtualKeyBoard, title = (_("Enter WLAN passphrase/key:")), text = config.plugins.wlan.encryption.psk.value)
@@ -600,7 +605,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen):
iNetwork.deactivateInterface(self.iface)
iNetwork.writeNetworkConfig()
iNetwork.restartNetwork(self.applyConfigDataAvail)
- self.applyConfigRef = self.session.openWithCallback(self.applyConfigfinishedCB, MessageBox, _("Please wait while activating your network configuration..."), type = MessageBox.TYPE_INFO, enable_input = False)
+ self.applyConfigRef = self.session.openWithCallback(self.applyConfigfinishedCB, MessageBox, _("Please wait for activation of your network configuration..."), type = MessageBox.TYPE_INFO, enable_input = False)
else:
self.cancel()
@@ -616,10 +621,10 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen):
if data is True:
num_configured_if = len(iNetwork.getConfiguredAdapters())
if num_configured_if >= 2:
- self.session.openWithCallback(self.secondIfaceFoundCB, MessageBox, _("Your network configuration has been activated.\nA second configured interface has been found.\n\nDo you want to disable the second networkinterface?"), default = True)
+ self.session.openWithCallback(self.secondIfaceFoundCB, MessageBox, _("Your network configuration has been activated.\nA second configured interface has been found.\n\nDo you want to disable the second network interface?"), default = True)
else:
if self.finished_cb:
- self.session.openWithCallback(self.finished_cb, MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10)
+ self.session.openWithCallback(lambda x : self.finished_cb(), MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10)
else:
self.session.openWithCallback(self.ConfigfinishedCB, MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10)
@@ -695,7 +700,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
self.oktext = _("Press OK on your remote control to continue.")
self.reboottext = _("Your Dreambox will restart after pressing OK on your remote control.")
- self.errortext = _("No working wireless interface found.\n Please verify that you have attached a compatible WLAN device or enable you local network interface.")
+ self.errortext = _("No working wireless network interface found.\n Please verify that you have attached a compatible WLAN device or enable your local network interface.")
self["WizardActions"] = HelpableActionMap(self, "WizardActions",
{
@@ -1404,4 +1409,5 @@ class NetworkAdapterTest(Screen):
except ImportError:
pass
else:
- iStatus.stopWlanConsole() \ No newline at end of file
+ iStatus.stopWlanConsole()
+
diff --git a/lib/python/Screens/TimerEdit.py b/lib/python/Screens/TimerEdit.py
index 800bab33..aae345db 100644
--- a/lib/python/Screens/TimerEdit.py
+++ b/lib/python/Screens/TimerEdit.py
@@ -317,6 +317,7 @@ class TimerSanityConflict(Screen):
EMPTY = 0
ENABLE = 1
DISABLE = 2
+ EDIT = 3
def __init__(self, session, timer):
Screen.__init__(self, session)
@@ -338,10 +339,11 @@ class TimerSanityConflict(Screen):
self["key_red"] = Button("Edit")
self["key_green"] = Button(" ")
- self["key_yellow"] = Button("Edit")
+ self["key_yellow"] = Button(" ")
self["key_blue"] = Button(" ")
self.key_green_choice = self.EMPTY
+ self.key_yellow_choice = self.EMPTY
self.key_blue_choice = self.EMPTY
self["actions"] = ActionMap(["OkCancelActions", "DirectionActions", "ShortcutActions", "TimerEditActions"],
@@ -415,9 +417,14 @@ class TimerSanityConflict(Screen):
self["actions"].actions.update({"green":self.toggleTimer1})
self["key_green"].setText(_("Disable"))
self.key_green_choice = self.DISABLE
+
if len(self.timer) > 1:
x = self["list"].getSelectedIndex()
if self.timer[x] is not None:
+ if self.key_yellow_choice == self.EMPTY:
+ self["actions"].actions.update({"yellow":self.editTimer2})
+ self["key_yellow"].setText(_("Edit"))
+ self.key_yellow_choice = self.EDIT
if self.timer[x].disabled and self.key_blue_choice != self.ENABLE:
self["actions"].actions.update({"blue":self.toggleTimer2})
self["key_blue"].setText(_("Enable"))
@@ -432,9 +439,11 @@ class TimerSanityConflict(Screen):
self.key_blue_choice = self.DISABLE
else:
#FIXME.... this doesnt hide the buttons self.... just the text
- self.removeAction("yellow")
- self["key_yellow"].setText(" ")
- self.key_yellow_choice = self.EMPTY
- self.removeAction("blue")
- self["key_blue"].setText(" ")
- self.key_blue_choice = self.EMPTY
+ if self.key_yellow_choice != self.EMPTY:
+ self.removeAction("yellow")
+ self["key_yellow"].setText(" ")
+ self.key_yellow_choice = self.EMPTY
+ if self.key_blue_choice != self.EMPTY:
+ self.removeAction("blue")
+ self["key_blue"].setText(" ")
+ self.key_blue_choice = self.EMPTY
diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i
index 8f05d53d..7de05d2b 100644
--- a/lib/python/enigma_python.i
+++ b/lib/python/enigma_python.i
@@ -282,9 +282,9 @@ PyObject *New_iRecordableServicePtr(const ePtr<iRecordableService> &ptr)
/* needed for service groups */
-PyObject *getBestPlayableServiceReference(const eServiceReference &bouquet_ref, const eServiceReference &ignore);
+PyObject *getBestPlayableServiceReference(const eServiceReference &bouquet_ref, const eServiceReference &ignore, bool simulate=false);
%{
-PyObject *getBestPlayableServiceReference(const eServiceReference &bouquet_ref, const eServiceReference &ignore)
+PyObject *getBestPlayableServiceReference(const eServiceReference &bouquet_ref, const eServiceReference &ignore, bool simulate=false)
{
eStaticServiceDVBBouquetInformation info;
if (info.isPlayable(bouquet_ref, ignore))