translate the update plugin
[enigma2.git] / lib / python / Plugins / update.py
index 7126875b4766f6df7d669889cfc23381e9c2485e..3653472adf581069fe9a383bbff42d0218b34188 100644 (file)
@@ -1,5 +1,6 @@
 from enigma import *
 from Screens.Screen import Screen
+from Screens.MessageBox import MessageBox
 from Components.ActionMap import ActionMap
 from Components.Label import Label
 
@@ -8,14 +9,14 @@ import os
 class Example(Screen):
        skin = """
                <screen position="100,100" size="550,400" title="IPKG upgrade..." >
-                       <widget name="text" position="0,0" size="550,400" font="Arial;15" />
+                       <widget name="text" position="0,0" size="550,400" font="Regular;15" />
                </screen>"""
                
        def __init__(self, session):
                self.skin = Example.skin
                Screen.__init__(self, session)
 
-               self["text"] = Label("Press OK to upgrade")
+               self["text"] = Label(_("Please press OK!"))
                                
                self["actions"] = ActionMap(["WizardActions"], 
                {
@@ -24,11 +25,18 @@ class Example(Screen):
                }, -1)
                
        def ok(self):
-               lines = os.popen("ipkg update && ipkg upgrade", "r").readlines()
-               string = ""
-               for x in lines:
-                       string += x
-               self["text"].setText(string)
+               self.session.openWithCallback(self.doUpdate, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!"))
+               
+       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)
+               else:
+                       self.close()            
                
                
 def main(session):