From: Stefan Pluecken Date: Sat, 2 Oct 2010 12:50:56 +0000 (+0200) Subject: fixes bug #587 X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=970cdaf1f5137645fad5f1404d29fdd90127f5fb fixes bug #587 - use new internally connectable detection mechanism - display unsupported tuners --- diff --git a/data/skin_default.xml b/data/skin_default.xml index 8b26ce7..f9fb09c 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -670,12 +670,12 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - - + + {"template": [ - MultiContentEntryText(pos = (10, 5), size = (360, 30), flags = RT_HALIGN_LEFT, text = 1), # index 1 is the nim name, - MultiContentEntryText(pos = (50, 30), size = (320, 50), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is a description of the nim settings, + MultiContentEntryText(pos = (10, 5), size = (440, 30), flags = RT_HALIGN_LEFT, text = 1), # index 1 is the nim name, + MultiContentEntryText(pos = (50, 30), size = (400, 50), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is a description of the nim settings, ], "fonts": [gFont("Regular", 20), gFont("Regular", 15)], "itemHeight": 80 diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 805be4d..cb832e4 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -471,7 +471,7 @@ class SecConfigure: self.update() class NIM(object): - def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}): + def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}, frontend_id = None): self.slot = slot if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", None): @@ -483,8 +483,11 @@ class NIM(object): self.has_outputs = has_outputs self.internally_connectable = internally_connectable self.multi_type = multi_type + self.frontend_id = frontend_id def isCompatible(self, what): + if not self.isSupported(): + return False compatible = { None: (None,), "DVB-S": ("DVB-S", None), @@ -526,6 +529,9 @@ class NIM(object): def isMultiType(self): return (len(self.multi_type) > 0) + def isSupported(self): + return (self.frontend_id is not None) + # returns dict {: } def getMultiTypeList(self): return self.multi_type @@ -548,8 +554,10 @@ class NIM(object): if self.empty: nim_text += _("(empty)") + elif not self.isSupported(): + nim_text += self.description + " (" + _("not supported") + ")" else: - nim_text += self.description + " (" + self.friendly_type + ")" + nim_text += self.description + " (" + self.friendly_type + ")" return nim_text @@ -675,6 +683,9 @@ class NimManager: elif line.strip().startswith("Internally_Connectable:"): input = int(line.strip()[len("Internally_Connectable:") + 1:]) entries[current_slot]["internally_connectable"] = input + elif line.strip().startswith("Frontend_Device:"): + input = int(line.strip()[len("Frontend_Device:") + 1:]) + entries[current_slot]["frontend_device"] = input elif line.strip().startswith("Mode"): # "Mode 0: DVB-T" -> ["Mode 0", " DVB-T"] split = line.strip().split(":") @@ -688,17 +699,24 @@ class NimManager: entries[current_slot]["name"] = _("N/A") nimfile.close() + from os import path + for id, entry in entries.items(): if not (entry.has_key("name") and entry.has_key("type")): entry["name"] = _("N/A") entry["type"] = None if not (entry.has_key("has_outputs")): entry["has_outputs"] = True - if not (entry.has_key("internally_connectable")): - entry["internally_connectable"] = None + if entry.has_key("frontend_device"): # check if internally connectable + if path.exists("/proc/stb/frontend/%d/rf_switch" % entry["frontend_device"]): + entry["internally_connectable"] = entry["frontend_device"] - 1 + else: + entry["internally_connectable"] = None + else: + entry["frontend_device"] = entry["internally_connectable"] = None 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"])) + 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"], frontend_id = entry["frontend_device"])) def hasNimType(self, chktype): for slot in self.nim_slots: diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 44f4251..a5712dc 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -489,7 +489,7 @@ class NimSelection(Screen): def okbuttonClick(self): nim = self["nimlist"].getCurrent() nim = nim and nim[3] - if nim is not None and not nim.empty: + if nim is not None and not nim.empty and nim.isSupported(): self.session.openWithCallback(self.updateList, self.resultclass, nim.slot) def showNim(self, nim): @@ -548,6 +548,8 @@ class NimSelection(Screen): text = _("enabled") if x.isMultiType(): text = _("Switchable tuner types:") + "(" + ','.join(x.getMultiTypeList().values()) + ")" + "\n" + text + if not x.isSupported(): + text = _("tuner is not supported") self.list.append((slotid, x.friendly_full_description, text, x)) self["nimlist"].setList(self.list)