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 = os.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)
70 def PacketEntryComponent(packet):
73 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0,250, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, packet[0]))
74 res.append((eListboxPythonMultiContent.TYPE_TEXT, 250, 0, 200, 30, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, packet[1]))
75 res.append((eListboxPythonMultiContent.TYPE_TEXT, 450, 0, 100, 30, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, packet[2]))
78 class PacketList(GUIComponent):
79 def __init__(self, list):
80 GUIComponent.__init__(self)
81 self.l = eListboxPythonMultiContent()
83 self.l.setFont(0, gFont("Regular", 20))
84 self.l.setFont(1, gFont("Regular", 18))
87 return self.l.getCurrentSelection()
89 def GUIcreate(self, parent):
90 self.instance = eListbox(parent)
91 self.instance.setContent(self.l)
92 self.instance.setItemHeight(30)
95 self.instance.setContent(None)
103 <screen position="100,100" size="550,400" title="IPKG upgrade..." >
104 <widget name="list" position="0,0" size="550,400" scrollbarMode="showOnDemand" />
107 def __init__(self, session, args = None):
108 self.skin = Ipkg.skin
109 Screen.__init__(self, session)
113 self.fillPacketList()
115 self["list"] = PacketList(self.list)
117 self["actions"] = ActionMap(["WizardActions"],
124 def fillPacketList(self):
125 lines = os.popen("ipkg list", "r").readlines()
128 split = x.split(' - ')
129 packetlist.append([split[0].strip(), split[1].strip()])
131 lines = os.popen("ipkg list_installed", "r").readlines()
135 split = x.split(' - ')
136 installedlist[split[0].strip()] = split[1].strip()
140 if installedlist.has_key(x[0]):
141 if installedlist[x[0]] == x[1]:
144 status = "upgradable"
145 self.list.append(PacketEntryComponent([x[0], x[1], status]))
149 self.session.openWithCallback(self.doUpdate, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!"))
153 def doUpdateDelay(self):
154 lines = os.popen("ipkg update && ipkg upgrade", "r").readlines()
158 self["text"].setText(_("Updating finished. Here is the result:") + "\n\n" + string)
162 def doUpdate(self, val = False):
164 self["text"].setText(_("Updating... Please wait... This can take some minutes..."))
165 self.delayTimer.start(0, 1)
169 def UpgradeMain(session, **kwargs):
170 session.open(Upgrade)
172 def IpkgMain(session, **kwargs):
175 def Plugins(**kwargs):
176 return [PluginDescriptor(name="Old Softwareupdate", description="Updates your receiver's software", icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=UpgradeMain),
177 PluginDescriptor(name="IPKG", description="IPKG frontend", icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=IpkgMain)]