leave update plugin with ok button after the update process (we entered it with ok...
[enigma2.git] / lib / python / Plugins / update.py
index 3653472adf581069fe9a383bbff42d0218b34188..d05d317e2fb27fa25d5b816d233c1b229dc3a4c2 100644 (file)
@@ -20,21 +20,33 @@ class Example(Screen):
                                
                self["actions"] = ActionMap(["WizardActions"], 
                {
-                       "ok": self.ok,
+                       "ok": self.go,
                        "back": self.close
                }, -1)
                
-       def ok(self):
-               self.session.openWithCallback(self.doUpdate, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!"))
+               self.update = True
+               self.delayTimer = eTimer()
+               self.delayTimer.timeout.get().append(self.doUpdateDelay)
                
+       def go(self):
+               if self.update:
+                       self.session.openWithCallback(self.doUpdate, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!"))            
+               else:
+                       self.close()
+       
+       def doUpdateDelay(self):
+               lines = os.popen("ipkg update && ipkg upgrade", "r").readlines()
+               string = ""
+               for x in lines:
+                       string += x
+               self["text"].setText(_("Updating finished. Here is the result:") + "\n\n" + string)
+               self.update = False
+                       
+       
        def doUpdate(self, val = False):
-               
-               if val:
-                       lines = os.popen("ipkg update && ipkg upgrade", "r").readlines()
-                       string = ""
-                       for x in lines:
-                               string += x
-                       self["text"].setText(_("Updating finished. Here is the result:") + "\n\n" + string)
+               if val == True:
+                       self["text"].setText(_("Updating... Please wait... This can take some minutes..."))
+                       self.delayTimer.start(0, 1)
                else:
                        self.close()            
                
@@ -44,7 +56,7 @@ def main(session):
        
 
 def getPicturePath():
-               return ""
+               return "/usr/lib/enigma2/python/Plugins/update.png"
 
 def getPluginName():
                return "Softwareupdate"
\ No newline at end of file