flush config (to flash) on close setup list
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 7 Feb 2006 18:38:56 +0000 (18:38 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 7 Feb 2006 18:38:56 +0000 (18:38 +0000)
data/menu.xml
lib/python/Screens/Menu.py

index 5b5ee866feb125d65cd36a151619854539410385..79a723471790ff59b76f23e549e1556f8f1c4a90 100644 (file)
@@ -27,7 +27,7 @@
                </menu>
 
                <item text="Games / Plugins"><screen module="PluginBrowser" screen="PluginBrowser" /></item>
                </menu>
 
                <item text="Games / Plugins"><screen module="PluginBrowser" screen="PluginBrowser" /></item>
-               <menu text="Setup">
+               <menu text="Setup" flushConfigOnClose="1" >
                        <id val="setup" />
                        <!--<menu text="Service Organising">
                                <item text="New Bouquets"></item>
                        <id val="setup" />
                        <!--<menu text="Service Organising">
                                <item text="New Bouquets"></item>
index db41cd57963ca37142d5c158e5ada7bafdcbec68..e3e3a0a5c6e40441a80a344b8ae2feb33572f307 100644 (file)
@@ -5,6 +5,7 @@ from Components.Header import Header
 from Components.Button import Button
 from Components.Label import Label
 from Components.ProgressBar import ProgressBar
 from Components.Button import Button
 from Components.Label import Label
 from Components.ProgressBar import ProgressBar
+from Components.config import configfile
 
 from Tools.Directories import resolveFilename, SCOPE_SKIN
 
 
 from Tools.Directories import resolveFilename, SCOPE_SKIN
 
@@ -107,10 +108,18 @@ class Menu(Screen):
        def addMenu(self, destList, node):
                MenuTitle = _(getValbyAttr(node, "text"))
                if MenuTitle != "":                                                                                                                                     #check for title
        def addMenu(self, destList, node):
                MenuTitle = _(getValbyAttr(node, "text"))
                if MenuTitle != "":                                                                                                                                     #check for title
-                       a = boundFunction(self.session.openWithCallback, self.menuClosed, Menu, node, node.childNodes)
+                       x = getValbyAttr(node, "flushConfigOnClose")
+                       if x == "1":
+                               a = boundFunction(self.session.openWithCallback, self.menuClosedWithConfigFlush, Menu, node, node.childNodes)
+                       else:
+                               a = boundFunction(self.session.openWithCallback, self.menuClosed, Menu, node, node.childNodes)
                        #TODO add check if !empty(node.childNodes)
                        destList.append((MenuTitle, a))
 
                        #TODO add check if !empty(node.childNodes)
                        destList.append((MenuTitle, a))
 
+       def menuClosedWithConfigFlush(self, *res):
+               configfile.save()
+               self.menuClosed(res)
+
        def menuClosed(self, *res):
                if len(res) and res[0]:
                        self.close(True)
        def menuClosed(self, *res):
                if len(res) and res[0]:
                        self.close(True)