add parameter to Console screen to set the console window title
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Fri, 10 Mar 2006 20:57:09 +0000 (20:57 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Fri, 10 Mar 2006 20:57:09 +0000 (20:57 +0000)
lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py
lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py
lib/python/Screens/Console.py

index 8f0f37a01e11c33e822e96c93755fe91a013dc09..5bffb71ce82a893f0f78a33eaa62c38aaccb7211 100644 (file)
@@ -135,16 +135,16 @@ class BackupSetup(Screen):
                                self.path = BackupPath[str(currentConfigSelectionElement(config.backup.location))]
                                if currentConfigSelectionElement(config.backup.type) == "full":
                                        print "Backup Mode: Full"
-                                       self.session.open(Console, ["Backup running", "tar -czvf " + self.path + "/" + str(dt) + "_full_backup.tar.gz /etc/"])
+                                       self.session.open(Console, title = "Backup running", cmdlist = ["tar -czvf " + self.path + "/" + str(dt) + "_full_backup.tar.gz /etc/"])
                                if currentConfigSelectionElement(config.backup.type) == "settings":
                                        print "Backup Mode: Settings"
-                                       self.session.open(Console, ["Backup running", "tar -czvf " + self.path + "/" + str(dt) + "_settings_backup.tar.gz /etc/enigma2/"])
+                                       self.session.open(Console, title = "Backup running", cmdlist = ["tar -czvf " + self.path + "/" + str(dt) + "_settings_backup.tar.gz /etc/enigma2/"])
                                if currentConfigSelectionElement(config.backup.type) == "var":
                                        print "Backup Mode: var"
-                                       self.session.open(Console, ["Backup running", "tar -czvf " + self.path + "/" + str(dt) + "_var_backup.tar.gz /var/"])
+                                       self.session.open(Console, title = "Backup running", cmdlist = [ "tar -czvf " + self.path + "/" + str(dt) + "_var_backup.tar.gz /var/"])
                                if currentConfigSelectionElement(config.backup.type) == "skin":
                                        print "Backup Mode: skin"
-                                       self.session.open(Console, ["Backup running", "tar -czvf " + self.path + "/" + str(dt) + "_skin_backup.tar.gz /usr/share/enigma2/"])
+                                       self.session.open(Console, title ="Backup running", cmdlist = [ "tar -czvf " + self.path + "/" + str(dt) + "_skin_backup.tar.gz /usr/share/enigma2/"])
                        else:
                                self.session.open(MessageBox, _("Sorry your Backup destination does not exist\n\nPlease choose an other one."), MessageBox.TYPE_INFO)
 
@@ -213,7 +213,7 @@ class RestoreMenu(Screen):
        def startRestore(self, ret = False):
                if (ret == True):
                        self.exe = True
-                       self.session.open(Console, ["Restore running", "tar -xzvf " + self.path + "/" + self.sel + " -C /", "killall enigma2"])
+                       self.session.open(Console, title = "Restore running", cmdlist = ["tar -xzvf " + self.path + "/" + self.sel + " -C /", "killall enigma2"])
                        
        def Exit(self):
                self.close()
index af4d8982c73b42008d35b644072caf3d983ce123..c0649b13a15b989de5bdef865b647ec550cba076 100644 (file)
@@ -59,7 +59,7 @@ class UpdatePluginMenu(Screen):
                                self.session.open(MessageBox, _("Function not yet implemented"), MessageBox.TYPE_ERROR)
        def runUpgrade(self, result):
                if result:
-                       self.session.open(Console, ["ipkg update", "ipkg upgrade -force-defaults -force-overwrite"])
+                       self.session.open(Console, title = "Upgrade running...", cmdlist = ["ipkg update", "ipkg upgrade -force-defaults -force-overwrite"])
 
 class IPKGSource(Screen):
        skin = """
index 82fc8d1c310f976f750813ca2d838e6284935fab..98c373d5c2e94895449324654ddea8ee1a16354e 100644 (file)
@@ -10,7 +10,7 @@ class Console(Screen):
                        <widget name="text" position="0,0" size="550,400" font="Regular;15" />
                </screen>"""
                
-       def __init__(self, session, args = None):
+       def __init__(self, session, title = "Console", cmdlist = None):
                self.skin = Console.skin
                Screen.__init__(self, session)
 
@@ -23,7 +23,10 @@ class Console(Screen):
                        "down": self["text"].pageDown
                }, -1)
                
-               self.cmdlist = args
+               self.cmdlist = cmdlist
+               self.newtitle = title
+               
+               self.onShown.append(self.updateTitle)
                
                self.container = eConsoleAppContainer()
                self.run = 0
@@ -31,6 +34,9 @@ class Console(Screen):
                self.container.dataAvail.get().append(self.dataAvail)
                self.onLayoutFinish.append(self.startRun) # dont start before gui is finished
 
+       def updateTitle(self):
+               self.setTitle(self.newtitle)
+
        def startRun(self):
                self["text"].setText(_("Execution Progress:") + "\n\n")
                print "Console: executing in run", self.run, " the command:", self.cmdlist[self.run]