X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/ec21f179954efe759b8975185d720be4c537bdcf..452fdf6b7875f8185960f9b1649ba3d8fad4ab24:/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py diff --git a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py index 19ab3eea..c71ffdbb 100644 --- a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py @@ -1,20 +1,20 @@ -from enigma import eTimer, quitMainloop -from Screens.Screen import Screen -from Screens.MessageBox import MessageBox from Components.ActionMap import ActionMap, NumberActionMap -from Components.ScrollLabel import ScrollLabel -from Components.GUIComponent import * -from Components.MenuList import MenuList +from Components.GUIComponent import GUIComponent from Components.Input import Input -from Screens.Console import Console -from Screens.MessageBox import MessageBox +from Components.Ipkg import IpkgComponent +from Components.Label import Label +from Components.MenuList import MenuList +from Components.ScrollLabel import ScrollLabel +from Components.Slider import Slider from Plugins.Plugin import PluginDescriptor +from Screens.Console import Console from Screens.ImageWizard import ImageWizard -from Components.Ipkg import Ipkg -from Components.Slider import Slider -from Components.Label import Label +from Screens.MessageBox import MessageBox +from Screens.MessageBox import MessageBox +from Screens.Screen import Screen +from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont +from os import popen -import os class UpdatePluginMenu(Screen): skin = """ @@ -125,15 +125,6 @@ class IPKGSource(Screen): print "pressed", number self["text"].number(number) -RT_HALIGN_LEFT = 0 -RT_HALIGN_RIGHT = 1 -RT_HALIGN_CENTER = 2 -RT_HALIGN_BLOCK = 4 - -RT_VALIGN_TOP = 0 -RT_VALIGN_CENTER = 8 -RT_VALIGN_BOTTOM = 16 - def PacketEntryComponent(packet): res = [ packet ] @@ -189,13 +180,13 @@ class Ipkg2(Screen): def fillPacketList(self): - lines = os.popen("ipkg list", "r").readlines() + lines = popen("ipkg list", "r").readlines() packetlist = [] for x in lines: split = x.split(' - ') packetlist.append([split[0].strip(), split[1].strip()]) - lines = os.popen("ipkg list_installed", "r").readlines() + lines = popen("ipkg list_installed", "r").readlines() installedlist = {} for x in lines: @@ -218,7 +209,7 @@ class Ipkg2(Screen): self.close() def doUpdateDelay(self): - lines = os.popen("ipkg update && ipkg upgrade", "r").readlines() + lines = popen("ipkg update && ipkg upgrade", "r").readlines() string = "" for x in lines: string += x @@ -238,8 +229,8 @@ class UpdatePlugin(Screen): - - + + """ def __init__(self, session, args = None): @@ -265,12 +256,12 @@ class UpdatePlugin(Screen): self.activityTimer.timeout.get().append(self.doActivityTimer) self.activityTimer.start(100, False) - self.ipkg = Ipkg() + self.ipkg = IpkgComponent() self.ipkg.addCallback(self.ipkgCallback) self.updating = True self.package.setText(_("Package list update")) - self.ipkg.cmdUpdate() + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) self["actions"] = ActionMap(["WizardActions"], { @@ -285,27 +276,27 @@ class UpdatePlugin(Screen): self.activityslider.setValue(self.activity) def ipkgCallback(self, event, param): - if event == Ipkg.EVENT_DOWNLOAD: + if event == IpkgComponent.EVENT_DOWNLOAD: self.status.setText(_("Downloading")) - elif event == Ipkg.EVENT_UPGRADE: + elif event == IpkgComponent.EVENT_UPGRADE: if self.sliderPackages.has_key(param): self.slider.setValue(self.sliderPackages[param]) self.package.setText(param) self.status.setText(_("Upgrading")) self.packages += 1 - elif event == Ipkg.EVENT_INSTALL: + elif event == IpkgComponent.EVENT_INSTALL: self.package.setText(param) self.status.setText(_("Installing")) self.packages += 1 - elif event == Ipkg.EVENT_CONFIGURING: + elif event == IpkgComponent.EVENT_CONFIGURING: self.package.setText(param) self.status.setText(_("Configuring")) - elif event == Ipkg.EVENT_ERROR: + elif event == IpkgComponent.EVENT_ERROR: self.error += 1 - elif event == Ipkg.EVENT_DONE: + elif event == IpkgComponent.EVENT_DONE: if self.updating: self.updating = False - self.ipkg.cmdUpgrade(test_only = False) + self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = {'test_only': False}) elif self.error == 0: self.slider.setValue(4) @@ -327,10 +318,11 @@ class UpdatePlugin(Screen): pass def exit(self): - if self.packages != 0 and self.error == 0: - self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished. Do you want to reboot your Dreambox?")) - else: - self.close() + if not self.ipkg.isRunning(): + if self.packages != 0 and self.error == 0: + self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished. Do you want to reboot your Dreambox?")) + else: + self.close() def exitAnswer(self, result): if result is not None and result: