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.sliderPackages = {}
16 self.slider = Slider(0, len(cmdList))
17 self["slider"] = self.slider
18 self.activityslider = Slider(0, 100)
19 self["activityslider"] = self.activityslider
20 self.status = Label(_("Preparing... Please wait"))
21 self["status"] = self.status
22 self.package = Label()
23 self["package"] = self.package
29 self.activityTimer = eTimer()
30 self.activityTimer.timeout.get().append(self.doActivityTimer)
31 #self.activityTimer.start(100, False)
33 self.ipkg = IpkgComponent()
34 self.ipkg.addCallback(self.ipkgCallback)
36 self.runningCmd = None
39 self["actions"] = ActionMap(["WizardActions"],
46 if self.runningCmd is None:
50 print len(self.cmdList), self.runningCmd
51 if len(self.cmdList) - 1 < self.runningCmd:
52 self.activityslider.setValue(0)
53 self.slider.setValue(len(self.cmdList))
55 self.package.setText("")
56 self.status.setText(_("Done - Installed or upgraded %d packages with %d errors") % (self.packages, self.error))
59 cmd = self.cmdList[self.runningCmd]
60 self.slider.setValue(self.runningCmd)
61 self.ipkg.startCmd(cmd[0], args = cmd[1])
62 self.startActivityTimer()
64 def doActivityTimer(self):
65 if not self.ipkg.isRunning():
66 self.stopActivityTimer()
69 if self.activity == 100:
71 self.activityslider.setValue(self.activity)
73 def startActivityTimer(self):
74 self.activityTimer.start(100, False)
76 def stopActivityTimer(self):
77 self.activityTimer.stop()
79 def ipkgCallback(self, event, param):
80 if event == IpkgComponent.EVENT_DOWNLOAD:
81 self.status.setText(_("Downloading"))
82 elif event == IpkgComponent.EVENT_UPGRADE:
83 if self.sliderPackages.has_key(param):
84 self.slider.setValue(self.sliderPackages[param])
85 self.package.setText(param)
86 self.status.setText(_("Upgrading"))
88 elif event == IpkgComponent.EVENT_INSTALL:
89 self.package.setText(param)
90 self.status.setText(_("Installing"))
92 elif event == IpkgComponent.EVENT_CONFIGURING:
93 self.package.setText(param)
94 self.status.setText(_("Configuring"))
95 elif event == IpkgComponent.EVENT_ERROR:
97 elif event == IpkgComponent.EVENT_DONE:
101 if not self.ipkg.isRunning():