- fix configMode for DVB-T and DVB-C
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Thu, 24 Jul 2008 19:50:05 +0000 (19:50 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Thu, 24 Jul 2008 19:50:05 +0000 (19:50 +0000)
- add some information to the NimSelection to give a quick overview to
the user

data/skin_default.xml
lib/python/Components/NimManager.py
lib/python/Screens/Satconfig.py

index cc478d128146fbcd75f66046505cdd8de7a55434..8b3f2e9a92d3c75a6c98e73492f3adf7217bc5ea 100644 (file)
@@ -616,8 +616,18 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y()))
                <widget name="menu" position="10,10" size="440,310" />
        </screen>
        <!-- Nim selection -->
                <widget name="menu" position="10,10" size="440,310" />
        </screen>
        <!-- Nim selection -->
-       <screen name="NimSelection" position="160,223" size="400,130" title="Choose Tuner">
-               <widget name="nimlist" position="10,10" size="380,105" />
+       <screen name="NimSelection" position="160,123" size="400,330" title="Choose Tuner">
+               <widget source="nimlist" render="Listbox" position="0,0" size="380,300" scrollbarMode="showOnDemand">
+                       <convert type="TemplatedMultiContent">
+                               {"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, 30), 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": 70
+                               }
+                       </convert>
+               </widget>
        </screen>
        <!-- Nim setup -->
        <screen name="NimSetup" position="80,95" size="560,412" title="Reception Settings">
        </screen>
        <!-- Nim setup -->
        <screen name="NimSetup" position="80,95" size="560,412" title="Reception Settings">
index 4adbdba4174bb15a8454d59fa1476427193c4378..72303af7d6e1ab26681eed41cc0a23abb4e55d03 100644 (file)
@@ -672,6 +672,12 @@ class NimManager:
        
        def getNimConfig(self, slotid):
                return config.Nims[slotid]
        
        def getNimConfig(self, slotid):
                return config.Nims[slotid]
+       
+       def getSatName(self, pos):
+               for sat in self.satList:
+                       if sat[0] == pos:
+                               return sat[1]
+               return _("N/A")
 
        def getSatList(self):
                return self.satList
 
        def getSatList(self):
                return self.satList
index 7d44965824f6b6b9f59aaaa6f47e0366b5e075eb..bf28463209a06b0598d3594e5e806c006d061fea 100644 (file)
@@ -6,6 +6,7 @@ from Components.ConfigList import ConfigListScreen
 from Components.MenuList import MenuList
 from Components.NimManager import nimmanager
 from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, updateConfigElement
 from Components.MenuList import MenuList
 from Components.NimManager import nimmanager
 from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, updateConfigElement
+from Components.Sources.List import List
 from Screens.MessageBox import MessageBox
 
 from time import mktime, localtime
 from Screens.MessageBox import MessageBox
 
 from time import mktime, localtime
@@ -48,19 +49,20 @@ class NimSetup(Screen, ConfigListScreen):
                                nim.powerMeasurement.save()
                
        def createConfigMode(self):
                                nim.powerMeasurement.save()
                
        def createConfigMode(self):
-               choices = { "nothing": _("nothing connected"),
-                                       "simple": _("simple"),
-                                       "advanced": _("advanced")}
-               #if len(nimmanager.getNimListOfType(nimmanager.getNimType(self.slotid), exception = x)) > 0:
-               #       choices["equal"] = _("equal to")
-               #       choices["satposdepends"] = _("second cable of motorized LNB")
-               if len(nimmanager.canEqualTo(self.slotid)) > 0:
-                       choices["equal"] = _("equal to")
-               if len(nimmanager.canDependOn(self.slotid)) > 0:
-                       choices["satposdepends"] = _("second cable of motorized LNB")
-               if len(nimmanager.canConnectTo(self.slotid)) > 0:
-                       choices["loopthrough"] = _("loopthrough to")
-               self.nimConfig.configMode.setChoices(choices)
+               if self.nim.isCompatible("DVB-S"):
+                       choices = { "nothing": _("nothing connected"),
+                                               "simple": _("simple"),
+                                               "advanced": _("advanced")}
+                       #if len(nimmanager.getNimListOfType(nimmanager.getNimType(self.slotid), exception = x)) > 0:
+                       #       choices["equal"] = _("equal to")
+                       #       choices["satposdepends"] = _("second cable of motorized LNB")
+                       if len(nimmanager.canEqualTo(self.slotid)) > 0:
+                               choices["equal"] = _("equal to")
+                       if len(nimmanager.canDependOn(self.slotid)) > 0:
+                               choices["satposdepends"] = _("second cable of motorized LNB")
+                       if len(nimmanager.canConnectTo(self.slotid)) > 0:
+                               choices["loopthrough"] = _("loopthrough to")
+                       self.nimConfig.configMode.setChoices(choices)
                                                        
        def createSetup(self):
                print "Creating setup"
                                                        
        def createSetup(self):
                print "Creating setup"
@@ -370,11 +372,9 @@ class NimSelection(Screen):
        def __init__(self, session):
                Screen.__init__(self, session)
                
        def __init__(self, session):
                Screen.__init__(self, session)
                
-               menu = [ ]
-               for x in nimmanager.nim_slots:
-                       menu.append((x.friendly_full_description, x))
-
-               self["nimlist"] = MenuList(menu)
+               self.list = [None] * nimmanager.getSlotCount()
+               self["nimlist"] = List(self.list)
+               self.updateList()
 
                self["actions"] = ActionMap(["OkCancelActions"],
                {
 
                self["actions"] = ActionMap(["OkCancelActions"],
                {
@@ -384,6 +384,47 @@ class NimSelection(Screen):
 
        def okbuttonClick(self):
                nim = self["nimlist"].getCurrent()
 
        def okbuttonClick(self):
                nim = self["nimlist"].getCurrent()
-               nim = nim and nim[1]
+               nim = nim and nim[3]
                if nim is not None and not nim.empty:
                if nim is not None and not nim.empty:
-                       self.session.open(NimSetup, nim.slot)
+                       self.session.openWithCallback(self.updateList, NimSetup, nim.slot)
+
+       def updateList(self):
+               self.list = [ ]
+               for x in nimmanager.nim_slots:
+                       slotid = x.slot
+                       nimConfig = nimmanager.getNimConfig(x.slot)
+                       text = nimConfig.configMode.value
+                       if x.isCompatible("DVB-S"):
+                               if nimConfig.configMode.value in ["loopthrough", "equal", "satposdepends"]:
+                                       text = { "loopthrough": _("loopthrough to"),
+                                                        "equal": _("equal to"),
+                                                        "satposdepends": _("second cable of motorized LNB") } [nimConfig.configMode.value]
+                                       text += _("Tuner") + " " + ["A", "B", "C", "D"][int(nimConfig.connectedTo.value)]
+                               elif nimConfig.configMode.value == "nothing":
+                                       text = _("nothing connected")
+                               elif nimConfig.configMode.value == "simple":
+                                       if nimConfig.diseqcMode.value in ["single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]:
+                                               text = _("Sats") + ": " + nimmanager.getSatName(int(nimConfig.diseqcA.value))
+                                               if nimConfig.diseqcMode.value in ["toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]:
+                                                       text += "," + nimmanager.getSatName(int(nimConfig.diseqcB.value))
+                                               if nimConfig.diseqcMode.value == "diseqc_a_b_c_d":
+                                                       text += "," + nimmanager.getSatName(int(nimConfig.diseqcC.value))
+                                                       text += "," + nimmanager.getSatName(int(nimConfig.diseqcD.value))
+                                       elif nimConfig.diseqcMode.value == "positioner":
+                                               text = _("Positioner") + ":"
+                                               if nimConfig.positionerMode.value == "usals":
+                                                       text += _("USALS")
+                                               elif nimConfig.positionerMode.value == "manual":
+                                                       text += _("manual")
+                                       else:   
+                                               text = _("simple")
+                               elif nimConfig.configMode.value == "advanced":
+                                       text = _("advanced")
+                       elif x.isCompatible("DVB-T") or x.isCompatible("DVB-C"):
+                               if nimConfig.configMode.value == "nothing":
+                                       text = _("nothing connected")
+                               elif nimConfig.configMode.value == "enabled":
+                                       text = _("enabled")
+                               
+                       self.list.append((slotid, x.friendly_full_description, text, x))
+               self["nimlist"].updateList(self.list)
\ No newline at end of file