1 from Components.ActionMap import ActionMap
2 from Components.Ipkg import IpkgComponent
3 from Components.Label import Label
4 from Components.Slider import Slider
5 from Screens.Screen import Screen
6 from enigma import eTimer
9 def __init__(self, session, cmdList = []):
10 Screen.__init__(self, session)
12 self.cmdList = cmdList
14 self.slider = Slider(0, len(cmdList))
15 self["slider"] = self.slider
16 self.activityslider = Slider(0, 100)
17 self["activityslider"] = self.activityslider
18 self.status = Label(_("Preparing... Please wait"))
19 self["status"] = self.status
20 self.package = Label()
21 self["package"] = self.package
27 self.activityTimer = eTimer()
28 self.activityTimer.timeout.get().append(self.doActivityTimer)
29 #self.activityTimer.start(100, False)
31 self.ipkg = IpkgComponent()
32 self.ipkg.addCallback(self.ipkgCallback)
34 self.runningCmd = None
37 self["actions"] = ActionMap(["WizardActions"],
44 if self.runningCmd is None:
48 print len(self.cmdList), self.runningCmd
49 if len(self.cmdList) - 1 < self.runningCmd:
50 self.activityslider.setValue(0)
51 self.slider.setValue(len(self.cmdList))
53 self.package.setText("")
54 self.status.setText(_("Done - Installed or upgraded %d packages with %d errors") % (self.packages, self.error))
57 cmd = self.cmdList[self.runningCmd]
58 self.slider.setValue(self.runningCmd)
59 self.ipkg.startCmd(cmd[0], args = cmd[1])
60 self.startActivityTimer()
62 def doActivityTimer(self):
63 if not self.ipkg.isRunning():
64 self.stopActivityTimer()
67 if self.activity == 100:
69 self.activityslider.setValue(self.activity)
71 def startActivityTimer(self):
72 self.activityTimer.start(100, False)
74 def stopActivityTimer(self):
75 self.activityTimer.stop()
77 def ipkgCallback(self, event, param):
78 if event == IpkgComponent.EVENT_DOWNLOAD:
79 self.status.setText(_("Downloading"))
80 elif event == IpkgComponent.EVENT_UPGRADE:
81 if self.sliderPackages.has_key(param):
82 self.slider.setValue(self.sliderPackages[param])
83 self.package.setText(param)
84 self.status.setText(_("Upgrading"))
86 elif event == IpkgComponent.EVENT_INSTALL:
87 self.package.setText(param)
88 self.status.setText(_("Installing"))
90 elif event == IpkgComponent.EVENT_CONFIGURING:
91 self.package.setText(param)
92 self.status.setText(_("Configuring"))
93 elif event == IpkgComponent.EVENT_ERROR:
95 elif event == IpkgComponent.EVENT_DONE:
99 if not self.ipkg.isRunning():