take setup menu titles optionally from setup.xml, try to make them a bit easier to...
authorFelix Domke <tmbinc@elitedvb.net>
Wed, 19 Jul 2006 19:30:54 +0000 (19:30 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Wed, 19 Jul 2006 19:30:54 +0000 (19:30 +0000)
data/menu.xml
data/setup.xml
lib/python/Screens/Screen.py
lib/python/Screens/Setup.py

index 499b97839f0b882f468e7358af41995364c8a0a4..ba1dbc5241aa4517d721f2d25197c52ab45d734f 100644 (file)
                        </menu>
                        <menu text="System">
                                <id val="system" />
-                               <item text="Language"><screen module="LanguageSelection" /></item>
-                               <item text="Usage Settings"><setup id="usage" /></item>
-                               <item text="Timezone"><setup id="timezone" /></item>
-                               <item text="Audio / Video"><setup id="avsetup" /></item>
-                               <item text="UHF Modulator"><setup id="RFmod" /></item>
-                               <item text="Harddisk"><screen module="HarddiskSetup" screen="HarddiskSelection"/></item>
+                               <item text="Language..."><screen module="LanguageSelection" /></item>
+                               <item><setup id="usage" /></item>
+                               <item><setup id="timezone" /></item>
+                               <item><setup id="avsetup" /></item>
+                               <item><setup id="RFmod" /></item>
+                               <item text="Harddisk..."><screen module="HarddiskSetup" screen="HarddiskSelection"/></item>
                                <!--<item text="Remote Control"><setup id="rc" /></item>-->
                                <!--<item text="Keyboard"><setup id="keyboard" /></item>-->
                                <!--<item text="OSD"><setup id="osd" /></item>-->
-                               <item text="LCD"><setup id="lcd" /></item>
-                               <item text="Network"><screen module="NetworkSetup" screen="NetworkSetup" /></item>
+                               <item><setup id="lcd" /></item>
+                               <item text="Network..."><screen module="NetworkSetup" screen="NetworkSetup" /></item>
                        </menu>
                        <item text="Common Interface"><screen module="Ci" screen="CiSelection" /></item>
                        <!--<item text="Parental Control"><setup id="parental" /></item>-->
index 41ecdcf0f75344d92cc65c5bfd5d3811178be8cc..08e4dcb760c5903213b950ba5e846ce78dfd675c 100644 (file)
                        <item text="AC3 default">config.av.defaultac3</item>
                        <item text="VCR Switch">config.av.vcrswitch</item>
                </setup>
-               <setup key="usage" title="Usage settings">
-                       <item text="Ask before zapping">config.recording.asktozap</item>
+               <setup key="usage" title="Customize">
+                       <item text="Recordings always have priority">config.recording.asktozap</item>
                        <item text="Margin before record (minutes)">config.recording.margin_before</item>
                        <item text="Margin after record">config.recording.margin_after</item>
-                       <item text="Visualize positioner movement">config.usage.showdish</item>
-                       <item text="Multi bouquets">config.usage.multibouquet</item>
+                       <item text="Show positioner movement">config.usage.showdish</item>
+                       <item text="Enable multiple bouquets">config.usage.multibouquet</item>
                        <item text="Change bouquets in quickzap">config.usage.quickzap_bouquet_change</item>
-                       <item text="Enigma1 like radiomode">config.usage.e1like_radio_mode</item>
+                       <item text="Alternative radio mode">config.usage.e1like_radio_mode</item>
                </setup>
                <setup key="network" title="Network setup">
                        <item text="Use DHCP">config.network.dhcp</item>
@@ -33,7 +33,7 @@
 <!--                   <item text="MAC Address">config.network.mac</item>-->
                        <item text="Activate network settings">config.network.activate</item>
                </setup>
-               <setup key="RFmod" title="UHF Modulator">
+               <setup key="RFmod" title="RF output">
                        <item text="Modulator">config.rfmod.enable</item>
                        <item text="Test mode">config.rfmod.test</item>
                        <item text="Sound">config.rfmod.sound</item>
                        <item text="Alpha">config.osd.alpha</item>
                        <item text="Brightness">config.osd.bright</item>
                        <item text="Contrast">config.osd.contrast</item>
-<!--                   <item text="Language">config.osd.language</item>-->
                </setup>
                <setup key="lcd" title="LCD Setup">
                        <item text="Brightness">config.lcd.bright</item>
                        <item text="Contrast">config.lcd.contrast</item>
                        <item text="Standby">config.lcd.standby</item>
-                       <item text="Invert">config.lcd.invert</item>
-               </setup>
-               <setup key="parental" title="Parental Control">
-                       <item text="Parental Lock">config.parental.lock</item>
-                       <item text="Setup Lock">config.parental.setuplock</item>
-               </setup>
-               <setup key="expert" title="Expert Setup">
-                       <item text="Record Splitsize">config.expert.splitsize</item>
-                       <item text="Show Satposition">config.expert.satpos</item>
-                       <item text="Fast zapping">config.expert.fastzap</item>
-                       <item text="Skip confirmations">config.expert.skipconfirm</item>
-                       <item text="Hide error windows">config.expert.hideerrors</item>
-                       <item text="Auto show inforbar">config.expert.autoinfo</item>
+                       <item text="Invert display">config.lcd.invert</item>
                </setup>
                <setup key="satconfig" title="Sat / Dish Setup">
                        <item text="Tuner Slot">config.sat.tunerslot</item>
@@ -74,7 +61,7 @@
                        <item text="DiSEqC">config.sat.diseqc</item>
                        <item text="Longitude">config.sat.diseqca</item>
                        <item text="Latitude">config.sat.diseqcb</item>
-                       <item text="use power delta" >config.sat.diseqcc</item>
+                       <item text="Use power measurement" >config.sat.diseqcc</item>
                        <!--<item text="DiSEqC D">config.sat.diseqcd</item>-->
                </setup>
 </setupxml>
index 5f1cf6d610193b848db2aba773613a11ff83ce87..060270b1a63b1fe27b810d7f8b8c55d9dcd2cd41 100644 (file)
@@ -1,5 +1,6 @@
 from Components.HTMLSkin import *
 from Components.GUISkin import *
+from Components.Sources.Source import Source
 
 import sys
 
@@ -99,7 +100,7 @@ class Screen(dict, HTMLSkin, GUISkin):
                for x in self.onShow:
                        x()
                for val in self.values() + self.renderer:
-                       if isinstance(val, GUIComponent):
+                       if isinstance(val, GUIComponent) or isinstance(val, Source):
                                val.onShow()
 
        def hide(self):
@@ -110,5 +111,5 @@ class Screen(dict, HTMLSkin, GUISkin):
                for x in self.onHide:
                        x()
                for val in self.values() + self.renderer:
-                       if isinstance(val, GUIComponent):
+                       if isinstance(val, GUIComponent) or isinstance(val, Source):
                                val.onHide()
index 41a9cf5136a91eedf6faecfe900a6ca0db77d1f9..0d4764acfb214e0a8a2ad605181665ecf9643348 100644 (file)
@@ -23,16 +23,6 @@ except:
 setupdom = xml.dom.minidom.parseString(setupfile.read())
 setupfile.close()
 
-def getValbyAttr(x, attr):
-       for p in range(x.attributes.length):
-               a = x.attributes.item(p)
-               attrib = str(a.name)
-               value = str(a.value)
-               if attrib == attr:
-                       return value
-       
-       return ""
-
 class SetupSummary(Screen):
        skin = """
        <screen position="0,0" size="132,64">
@@ -78,12 +68,11 @@ class Setup(Screen):
                        if x.nodeType != xml.dom.minidom.Element.nodeType:
                                continue
                        elif x.tagName == 'setup':
-                               ItemText = getValbyAttr(x, "key")
-                               if ItemText != setup:
+                               if x.getAttribute("key") != setup:
                                        continue
                                self.addItems(list, x.childNodes);
-                               myTitle = getValbyAttr(x, "title")
-               
+                               myTitle = x.getAttribute("title").encode("UTF-8")
+
                #check for list.entries > 0 else self.close
                
                self["config"] = ConfigList(list)
@@ -136,9 +125,9 @@ class Setup(Screen):
                        if x.nodeType != xml.dom.minidom.Element.nodeType:
                                continue
                        elif x.tagName == 'item':
-                               ItemText = _(getValbyAttr(x, "text"))
+                               item_text = _(x.getAttribute("text").encode("UTF-8") or "??")
                                b = eval(XMLTools.mergeText(x.childNodes));
-                               print "item " + ItemText + " " + b.configPath
+                               print "item " + item_text + " " + b.configPath
                                if b == "":
                                        continue
                                #add to configlist
@@ -146,7 +135,7 @@ class Setup(Screen):
                                
                                # the first b is the item itself, ignored by the configList.
                                # the second one is converted to string.
-                               list.append( (ItemText, item) )
+                               list.append( (item_text, item) )
 
        def handleKey(self, key):
                # ignore keys when not enabled
@@ -178,3 +167,9 @@ class Setup(Screen):
                
        def keyNumberGlobal(self, number):
                self.handleKey(str(number))
+
+def getSetupTitle(id):
+       xmldata = setupdom.childNodes[0].childNodes
+       for x in elementsWithTag(xmldata, "setup"):
+               if x.getAttribute("key") == id:
+                       return x.getAttribute("title").encode("UTF-8")