add a small ipkg upgrade plugin
[enigma2.git] / lib / python / Plugins / update.py
1 from enigma import *
2 from Screens.Screen import Screen
3 from Components.ActionMap import ActionMap
4 from Components.Label import Label
5
6 import os
7
8 class Example(Screen):
9         skin = """
10                 <screen position="100,100" size="550,400" title="IPKG upgrade..." >
11                         <widget name="text" position="0,0" size="550,400" font="Arial;15" />
12                 </screen>"""
13                 
14         def __init__(self, session):
15                 self.skin = Example.skin
16                 Screen.__init__(self, session)
17
18                 self["text"] = Label("Press OK to upgrade")
19                                 
20                 self["actions"] = ActionMap(["WizardActions"], 
21                 {
22                         "ok": self.ok,
23                         "back": self.close
24                 }, -1)
25                 
26         def ok(self):
27                 lines = os.popen("ipkg update && ipkg upgrade", "r").readlines()
28                 string = ""
29                 for x in lines:
30                         string += x
31                 self["text"].setText(string)
32                 
33                 
34 def main(session):
35         session.open(Example)
36         
37
38 def getPicturePath():
39                 return ""
40
41 def getPluginName():
42                 return "Softwareupdate"