1 from enigma import RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, eTimer, gFont
2 from Screens.Screen import Screen
3 from Screens.MessageBox import MessageBox
4 from Components.ActionMap import ActionMap
5 from Components.ScrollLabel import ScrollLabel
6 from Components.GUIComponent import GUIComponent
7 from Plugins.Plugin import PluginDescriptor
11 class Upgrade(Screen):
13 <screen position="100,100" size="550,400" title="IPKG upgrade..." >
14 <widget name="text" position="0,0" size="550,400" font="Regular;15" />
17 def __init__(self, session, args = None):
18 self.skin = Upgrade.skin
19 Screen.__init__(self, session)
21 self["text"] = ScrollLabel(_("Please press OK!"))
23 self["actions"] = ActionMap(["WizardActions"],
27 "up": self["text"].pageUp,
28 "down": self["text"].pageDown
32 self.delayTimer = eTimer()
33 self.delayTimer.callback.append(self.doUpdateDelay)
37 self.session.openWithCallback(self.doUpdate, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!"))
41 def doUpdateDelay(self):
42 lines = popen("ipkg update && ipkg upgrade -force-defaults -force-overwrite", "r").readlines()
46 self["text"].setText(_("Updating finished. Here is the result:") + "\n\n" + string)
50 def doUpdate(self, val = False):
52 self["text"].setText(_("Updating... Please wait... This can take some minutes..."))
53 self.delayTimer.start(0, 1)
57 def PacketEntryComponent(packet):
60 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0,250, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, packet[0]))
61 res.append((eListboxPythonMultiContent.TYPE_TEXT, 250, 0, 200, 30, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, packet[1]))
62 res.append((eListboxPythonMultiContent.TYPE_TEXT, 450, 0, 100, 30, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, packet[2]))
65 class PacketList(GUIComponent):
66 def __init__(self, list):
67 GUIComponent.__init__(self)
68 self.l = eListboxPythonMultiContent()
70 self.l.setFont(0, gFont("Regular", 20))
71 self.l.setFont(1, gFont("Regular", 18))
74 return self.l.getCurrentSelection()
76 def GUIcreate(self, parent):
77 self.instance = eListbox(parent)
78 self.instance.setContent(self.l)
79 self.instance.setItemHeight(30)
82 self.instance.setContent(None)
90 <screen position="100,100" size="550,400" title="IPKG upgrade..." >
91 <widget name="list" position="0,0" size="550,400" scrollbarMode="showOnDemand" />
94 def __init__(self, session, args = None):
96 Screen.__init__(self, session)
100 self.fillPacketList()
102 self["list"] = PacketList(self.list)
104 self["actions"] = ActionMap(["WizardActions"],
111 def fillPacketList(self):
112 lines = popen("ipkg list", "r").readlines()
115 split = x.split(' - ')
116 packetlist.append([split[0].strip(), split[1].strip()])
118 lines = popen("ipkg list_installed", "r").readlines()
122 split = x.split(' - ')
123 installedlist[split[0].strip()] = split[1].strip()
127 if installedlist.has_key(x[0]):
128 if installedlist[x[0]] == x[1]:
131 status = "upgradable"
132 self.list.append(PacketEntryComponent([x[0], x[1], status]))
136 self.session.openWithCallback(self.doUpdate, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!"))
140 def doUpdateDelay(self):
141 lines = popen("ipkg update && ipkg upgrade", "r").readlines()
145 self["text"].setText(_("Updating finished. Here is the result:") + "\n\n" + string)
149 def doUpdate(self, val = False):
151 self["text"].setText(_("Updating... Please wait... This can take some minutes..."))
152 self.delayTimer.start(0, 1)
156 def UpgradeMain(session, **kwargs):
157 session.open(Upgrade)
159 def IpkgMain(session, **kwargs):
162 def Plugins(**kwargs):
163 return [PluginDescriptor(name="Old Softwareupdate", description="Updates your receiver's software", icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=UpgradeMain),
164 PluginDescriptor(name="IPKG", description="IPKG frontend", icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=IpkgMain)]