From f677fd9a66325bcc27a97b5fca55f34d83cfbac9 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 25 Feb 2006 22:36:39 +0000 Subject: [PATCH 1/1] readd old software update to ensure update capability for faulty software conditions --- configure.ac | 1 + lib/python/Plugins/SystemPlugins/Makefile.am | 2 +- .../OldSoftwareUpdate/Makefile.am | 7 + .../OldSoftwareUpdate/__init__.py | 0 .../SystemPlugins/OldSoftwareUpdate/plugin.py | 177 ++++++++++++++++++ .../OldSoftwareUpdate/update.png | Bin 0 -> 1090 bytes 6 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/Makefile.am create mode 100644 lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/__init__.py create mode 100644 lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/plugin.py create mode 100644 lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/update.png diff --git a/configure.ac b/configure.ac index 504a2d8e..b75946ed 100644 --- a/configure.ac +++ b/configure.ac @@ -62,6 +62,7 @@ lib/python/Screens/Makefile lib/python/Plugins/Makefile lib/python/Plugins/SystemPlugins/Makefile lib/python/Plugins/SystemPlugins/SoftwareUpdate/Makefile +lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/Makefile lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/Makefile lib/python/Plugins/DemoPlugins/Makefile lib/python/Plugins/DemoPlugins/TestPlugin/Makefile diff --git a/lib/python/Plugins/SystemPlugins/Makefile.am b/lib/python/Plugins/SystemPlugins/Makefile.am index 2b71624c..41969459 100644 --- a/lib/python/Plugins/SystemPlugins/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Makefile.am @@ -1 +1 @@ -SUBDIRS = SoftwareUpdate FrontprocessorUpgrade +SUBDIRS = SoftwareUpdate FrontprocessorUpgrade OldSoftwareUpdate diff --git a/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/Makefile.am b/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/Makefile.am new file mode 100644 index 00000000..962ff487 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/Makefile.am @@ -0,0 +1,7 @@ +installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/OldSoftwareUpdate + +install_PYTHON = \ + __init__.py \ + plugin.py \ + update.png + diff --git a/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/__init__.py b/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/plugin.py b/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/plugin.py new file mode 100644 index 00000000..51a3fb39 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/plugin.py @@ -0,0 +1,177 @@ +from enigma import * +from Screens.Screen import Screen +from Screens.MessageBox import MessageBox +from Components.ActionMap import ActionMap, NumberActionMap +from Components.ScrollLabel import ScrollLabel +from Components.Label import Label +from Components.GUIComponent import * +from Components.MenuList import MenuList +from Components.Input import Input +from Screens.Console import Console +from Plugins.Plugin import PluginDescriptor + +import os + +class Upgrade(Screen): + skin = """ + + + """ + + def __init__(self, session, args = None): + self.skin = Upgrade.skin + Screen.__init__(self, session) + + self["text"] = ScrollLabel(_("Please press OK!")) + + self["actions"] = ActionMap(["WizardActions"], + { + "ok": self.go, + "back": self.close, + "up": self["text"].pageUp, + "down": self["text"].pageDown + }, -1) + + self.update = True + self.delayTimer = eTimer() + self.delayTimer.timeout.get().append(self.doUpdateDelay) + + def go(self): + if self.update: + self.session.openWithCallback(self.doUpdate, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!")) + else: + self.close() + + def doUpdateDelay(self): + lines = os.popen("ipkg update && ipkg upgrade -force-defaults -force-overwrite", "r").readlines() + string = "" + for x in lines: + string += x + self["text"].setText(_("Updating finished. Here is the result:") + "\n\n" + string) + self.update = False + + + def doUpdate(self, val = False): + if val == True: + self["text"].setText(_("Updating... Please wait... This can take some minutes...")) + self.delayTimer.start(0, 1) + else: + self.close() + +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 ] + + res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0,250, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, packet[0])) + res.append((eListboxPythonMultiContent.TYPE_TEXT, 250, 0, 200, 30, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, packet[1])) + res.append((eListboxPythonMultiContent.TYPE_TEXT, 450, 0, 100, 30, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, packet[2])) + return res + +class PacketList(GUIComponent): + def __init__(self, list): + GUIComponent.__init__(self) + self.l = eListboxPythonMultiContent() + self.l.setList(list) + self.l.setFont(0, gFont("Regular", 20)) + self.l.setFont(1, gFont("Regular", 18)) + + def getCurrent(self): + return self.l.getCurrentSelection() + + def GUIcreate(self, parent): + self.instance = eListbox(parent) + self.instance.setContent(self.l) + self.instance.setItemHeight(30) + + def GUIdelete(self): + self.instance.setContent(None) + self.instance = None + + def invalidate(self): + self.l.invalidate() + +class Ipkg(Screen): + skin = """ + + + """ + + def __init__(self, session, args = None): + self.skin = Ipkg.skin + Screen.__init__(self, session) + + list = [] + self.list = list + self.fillPacketList() + + self["list"] = PacketList(self.list) + + self["actions"] = ActionMap(["WizardActions"], + { + "ok": self.close, + "back": self.close + }, -1) + + + def fillPacketList(self): + lines = os.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() + + installedlist = {} + for x in lines: + split = x.split(' - ') + installedlist[split[0].strip()] = split[1].strip() + + for x in packetlist: + status = "" + if installedlist.has_key(x[0]): + if installedlist[x[0]] == x[1]: + status = "installed" + else: + status = "upgradable" + self.list.append(PacketEntryComponent([x[0], x[1], status])) + + def go(self): + if self.update: + self.session.openWithCallback(self.doUpdate, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!")) + else: + self.close() + + def doUpdateDelay(self): + lines = os.popen("ipkg update && ipkg upgrade", "r").readlines() + string = "" + for x in lines: + string += x + self["text"].setText(_("Updating finished. Here is the result:") + "\n\n" + string) + self.update = False + + + def doUpdate(self, val = False): + if val == True: + self["text"].setText(_("Updating... Please wait... This can take some minutes...")) + self.delayTimer.start(0, 1) + else: + self.close() + +def UpgradeMain(session): + session.open(Upgrade) + +def IpkgMain(session): + session.open(Ipkg) + +def Plugins(): + return [PluginDescriptor(name="Old Softwareupdate", description="Updates your receiver's software", icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=UpgradeMain), + PluginDescriptor(name="IPKG", description="IPKG frotend", icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=IpkgMain)] diff --git a/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/update.png b/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/update.png new file mode 100644 index 0000000000000000000000000000000000000000..6bc17b1e5eea771fb9ba1ed5f80f61e20780ddd3 GIT binary patch literal 1090 zcmV-I1ikx-P)(*7IVvYDRZm<_NM1}vTX1WAh=h}(pQ=bhS1Tq%Lp)b`_ zWj!`vIy782F;^oWHys)-XJLdsIAuOKV{2xJH7;rl1zrjTLJbE`3kF3J3T_DnHyRRk z6b@Pt3rGzKISmOn34^|QlOA!o34hlI72rd#0Ne>G?3kWR_3q2wlfIT*kNkW!OM3+iL zkWfjKVOyk>kiodM)&~PT2?R_J2YL<%au5i41_Lk=33w3+brA`25D9M*3V0Fpm49?CAs;UWf zbq4?c55>g{Wn~8c{}A~25by5~?CcMoo(g?^2& z62rp}sHhE`oD6k!33PM`_VyI-?-T6o6Y1#_=H?RF*%8dl5Q>Tme0&OIWC-Qt9^Ty{ z*w-V<$|0ww8)|70R#gty)g;l+Bge%dhJ_aY|33ZwLH_ibYfxxpP-|vVR#HM-SVu=hH!&|JiG_8IiFsyW zPGVh4J2)+BWm02bRn{kzUH||932;bRa{vGf6951U69E94oEQKA00(qQO+^RR0Rjyo zId8S;(f|MfAW1|)RCwBBC@p463{xZ-#3VF$AaP8CYnjW|+x%ZANv) z3?x@T-A|lmBzH5xokP6MGf-{D5nwZL_!%A+FjbgQg*UX}wxWhMdLluKPy8t?JS3>X zC6r9f`g-|p?u=xn?NQC6nh9#QFwf4{%_bR`8`?RVG8p7oi_@% literal 0 HcmV?d00001 -- 2.30.2