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, NumberActionMap
5 from Components.ScrollLabel import ScrollLabel
6 from Components.Label import Label
7 from Components.GUIComponent import *
8 from Components.MenuList import MenuList
9 from Components.Input import Input
10 from Screens.Console import Console
11 from Plugins.Plugin import PluginDescriptor
15 class Upgrade(Screen):
17 <screen position="100,100" size="550,400" title="IPKG upgrade..." >
18 <widget name="text" position="0,0" size="550,400" font="Regular;15" />
21 def __init__(self, session, args = None):
22 self.skin = Upgrade.skin
23 Screen.__init__(self, session)
25 self["text"] = ScrollLabel(_("Please press OK!"))
27 self["actions"] = ActionMap(["WizardActions"],
31 "up": self["text"].pageUp,
32 "down": self["text"].pageDown
36 self.delayTimer = eTimer()
37 self.delayTimer.timeout.get().append(self.doUpdateDelay)
41 self.session.openWithCallback(self.doUpdate, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!"))
45 def doUpdateDelay(self):
46 lines = popen("ipkg update && ipkg upgrade -force-defaults -force-overwrite", "r").readlines()
50 self["text"].setText(_("Updating finished. Here is the result:") + "\n\n" + string)
54 def doUpdate(self, val = False):
56 self["text"].setText(_("Updating... Please wait... This can take some minutes..."))
57 self.delayTimer.start(0, 1)
61 def PacketEntryComponent(packet):
64 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0,250, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, packet[0]))
65 res.append((eListboxPythonMultiContent.TYPE_TEXT, 250, 0, 200, 30, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, packet[1]))
66 res.append((eListboxPythonMultiContent.TYPE_TEXT, 450, 0, 100, 30, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, packet[2]))
69 class PacketList(GUIComponent):
70 def __init__(self, list):
71 GUIComponent.__init__(self)
72 self.l = eListboxPythonMultiContent()
74 self.l.setFont(0, gFont("Regular", 20))
75 self.l.setFont(1, gFont("Regular", 18))
78 return self.l.getCurrentSelection()
80 def GUIcreate(self, parent):
81 self.instance = eListbox(parent)
82 self.instance.setContent(self.l)
83 self.instance.setItemHeight(30)
86 self.instance.setContent(None)
94 <screen position="100,100" size="550,400" title="IPKG upgrade..." >
95 <widget name="list" position="0,0" size="550,400" scrollbarMode="showOnDemand" />
98 def __init__(self, session, args = None):
100 Screen.__init__(self, session)
104 self.fillPacketList()
106 self["list"] = PacketList(self.list)
108 self["actions"] = ActionMap(["WizardActions"],
115 def fillPacketList(self):
116 lines = popen("ipkg list", "r").readlines()
119 split = x.split(' - ')
120 packetlist.append([split[0].strip(), split[1].strip()])
122 lines = popen("ipkg list_installed", "r").readlines()
126 split = x.split(' - ')
127 installedlist[split[0].strip()] = split[1].strip()
131 if installedlist.has_key(x[0]):
132 if installedlist[x[0]] == x[1]:
135 status = "upgradable"
136 self.list.append(PacketEntryComponent([x[0], x[1], status]))
140 self.session.openWithCallback(self.doUpdate, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!"))
144 def doUpdateDelay(self):
145 lines = popen("ipkg update && ipkg upgrade", "r").readlines()
149 self["text"].setText(_("Updating finished. Here is the result:") + "\n\n" + string)
153 def doUpdate(self, val = False):
155 self["text"].setText(_("Updating... Please wait... This can take some minutes..."))
156 self.delayTimer.start(0, 1)
160 def UpgradeMain(session, **kwargs):
161 session.open(Upgrade)
163 def IpkgMain(session, **kwargs):
166 def Plugins(**kwargs):
167 return [PluginDescriptor(name="Old Softwareupdate", description="Updates your receiver's software", icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=UpgradeMain),
168 PluginDescriptor(name="IPKG", description="IPKG frontend", icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=IpkgMain)]