aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Plugins
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2009-02-16 18:25:23 +0100
committerFelix Domke <tmbinc@elitedvb.net>2009-02-16 18:25:23 +0100
commitd58ca4cf34b7621aea4e2c1ff07bed6b2cd6b763 (patch)
treef96b8eae81d7aa0c2d11eda8bcda1e4b87f96e78 /lib/python/Plugins
parent4510fa62a33b31fec442fd0d77eb682d93ebf7e6 (diff)
parentfbaf2a5f2fa5236b09a4d14f059d99eace24f2d5 (diff)
downloadenigma2-d58ca4cf34b7621aea4e2c1ff07bed6b2cd6b763.tar.gz
enigma2-d58ca4cf34b7621aea4e2c1ff07bed6b2cd6b763.zip
Merge branch 'master' of /home/tmbinc/enigma2-git into tmbinc/FixTimingBugs
Diffstat (limited to 'lib/python/Plugins')
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/DVDProject.py4
-rw-r--r--lib/python/Plugins/Extensions/DVDPlayer/plugin.py8
-rw-r--r--lib/python/Plugins/Extensions/IpkgInstaller/Makefile.am5
-rw-r--r--lib/python/Plugins/Extensions/IpkgInstaller/plugin.py67
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/Extensions/Makefile.am2
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/Extensions/MediaScanner/plugin.py3
-rw-r--r--lib/python/Plugins/SystemPlugins/ConfigurationBackup/.cvsignore4
-rw-r--r--lib/python/Plugins/SystemPlugins/ConfigurationBackup/Makefile.am8
-rw-r--r--lib/python/Plugins/SystemPlugins/ConfigurationBackup/__init__.py0
-rw-r--r--lib/python/Plugins/SystemPlugins/ConfigurationBackup/backup.pngbin3711 -> 0 bytes
-rw-r--r--lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py221
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/Makefile.am2
-rw-r--r--lib/python/Plugins/SystemPlugins/SoftwareManager/.cvsignore (renamed from lib/python/Plugins/Extensions/IpkgInstaller/.cvsignore)0
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py312
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py120
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/SoftwareManager/LICENSE (renamed from lib/python/Plugins/SystemPlugins/ConfigurationBackup/LICENSE)5
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/Makefile.am12
-rw-r--r--lib/python/Plugins/SystemPlugins/SoftwareManager/__init__.py (renamed from lib/python/Plugins/Extensions/IpkgInstaller/__init__.py)0
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/SoftwareManager/blue.png (renamed from lib/python/Plugins/SystemPlugins/ConfigurationBackup/blue.png)bin3495 -> 3495 bytes
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/SoftwareManager/green.png (renamed from lib/python/Plugins/SystemPlugins/ConfigurationBackup/green.png)bin3454 -> 3454 bytes
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/imagewizard.xml100
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/installable.pngbin0 -> 2272 bytes
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/installed.pngbin0 -> 2225 bytes
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py738
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/SoftwareManager/red.png (renamed from lib/python/Plugins/SystemPlugins/ConfigurationBackup/red.png)bin3742 -> 3742 bytes
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/SoftwareManager/update.png (renamed from lib/python/Plugins/SystemPlugins/SoftwareUpdate/update.png)bin3630 -> 3630 bytes
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/upgradeable.pngbin0 -> 2094 bytes
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/SoftwareManager/yellow.png (renamed from lib/python/Plugins/SystemPlugins/ConfigurationBackup/yellow.png)bin3732 -> 3732 bytes
-rw-r--r--lib/python/Plugins/SystemPlugins/SoftwareUpdate/.cvsignore4
-rw-r--r--lib/python/Plugins/SystemPlugins/SoftwareUpdate/Makefile.am8
-rw-r--r--lib/python/Plugins/SystemPlugins/SoftwareUpdate/__init__.py0
-rw-r--r--lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py360
32 files changed, 1294 insertions, 689 deletions
diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py
index 7ea32dfe..660234f2 100644
--- a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py
+++ b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py
@@ -2,8 +2,8 @@ from Tools.Directories import fileExists
from Components.config import config, ConfigSubsection, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence, ConfigSubList
class ConfigColor(ConfigSequence):
- def __init__(self):
- ConfigSequence.__init__(self, seperator = "#", limits = [(0,255),(0,255),(0,255)])
+ def __init__(self, default = [128,128,128]):
+ ConfigSequence.__init__(self, seperator = "#", limits = [(0,255),(0,255),(0,255)], default = default)
class ConfigFilename(ConfigText):
def __init__(self):
diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
index 421a2b4e..8e2a9f3a 100644
--- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
+++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
@@ -369,9 +369,6 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
self.onFirstExecBegin.append(self.showFileBrowser)
self.service = None
self.in_menu = False
- self.old_aspect = open("/proc/stb/video/aspect", "r").read()
- self.old_policy = open("/proc/stb/video/policy", "r").read()
- self.old_wss = open("/proc/stb/denc/0/wss", "r").read()
def keyNumberGlobal(self, number):
print "You pressed number " + str(number)
@@ -635,11 +632,6 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
pass
def __onClose(self):
- for i in (("/proc/stb/video/aspect", self.old_aspect), ("/proc/stb/video/policy", self.old_policy), ("/proc/stb/denc/0/wss", self.old_wss)):
- try:
- open(i[0], "w").write(i[1])
- except IOError:
- print "restore", i[0], "failed"
self.restore_infobar_seek_config()
self.session.nav.playService(self.oldService)
diff --git a/lib/python/Plugins/Extensions/IpkgInstaller/Makefile.am b/lib/python/Plugins/Extensions/IpkgInstaller/Makefile.am
deleted file mode 100644
index ece0698f..00000000
--- a/lib/python/Plugins/Extensions/IpkgInstaller/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-installdir = $(LIBDIR)/enigma2/python/Plugins/Extensions/IpkgInstaller
-
-install_PYTHON = \
- __init__.py \
- plugin.py
diff --git a/lib/python/Plugins/Extensions/IpkgInstaller/plugin.py b/lib/python/Plugins/Extensions/IpkgInstaller/plugin.py
deleted file mode 100644
index 4893dc47..00000000
--- a/lib/python/Plugins/Extensions/IpkgInstaller/plugin.py
+++ /dev/null
@@ -1,67 +0,0 @@
-from Components.ActionMap import ActionMap
-from Components.Ipkg import IpkgComponent
-from Components.Label import Label
-from Components.SelectionList import SelectionList
-from Plugins.Plugin import PluginDescriptor
-from Screens.Ipkg import Ipkg
-from Screens.Screen import Screen
-
-class IpkgInstaller(Screen):
- skin = """
- <screen position="100,100" size="550,400" title="..." >
- <widget name="red" halign="center" valign="center" position="0,0" size="140,60" backgroundColor="red" font="Regular;21" />
- <widget name="green" halign="center" valign="center" position="140,0" text="Install selected" size="140,60" backgroundColor="green" font="Regular;21" />
- <widget name="yellow" halign="center" valign="center" position="280,0" size="140,60" backgroundColor="yellow" font="Regular;21" />
- <widget name="blue" halign="center" valign="center" position="420,0" size="140,60" backgroundColor="blue" font="Regular;21" />
- <widget name="list" position="0,60" size="550,360" />
- </screen>
- """
-
- def __init__(self, session, list):
- self.skin = IpkgInstaller.skin
- Screen.__init__(self, session)
-
- self.list = SelectionList()
- self["list"] = self.list
- for listindex in range(len(list)):
- self.list.addSelection(list[listindex], list[listindex], listindex, True)
-
- self["red"] = Label()
- self["green"] = Label()
- self["yellow"] = Label()
- self["blue"] = Label()
-
- self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
- {
- "ok": self.list.toggleSelection,
- "cancel": self.close,
- "green": self.install
- }, -1)
-
- def install(self):
- list = self.list.getSelectionsList()
- cmdList = []
- for item in list:
- cmdList.append((IpkgComponent.CMD_INSTALL, { "package": item[1] }))
- print cmdList
- self.session.open(Ipkg, cmdList = cmdList)
-
-def filescan_open(list, session, **kwargs):
- filelist = [x.path for x in list]
- session.open(IpkgInstaller, filelist) # list
-
-def filescan(**kwargs):
- from Components.Scanner import Scanner, ScanPath
- return \
- Scanner(mimetypes = ["application/x-debian-package"],
- paths_to_scan =
- [
- ScanPath(path = "ipk", with_subdirs = True),
- ScanPath(path = "", with_subdirs = False),
- ],
- name = "Ipkg",
- description = "Install software updates...",
- openfnc = filescan_open, )
-
-def Plugins(**kwargs):
- return [ PluginDescriptor(name="Ipkg", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan) ]
diff --git a/lib/python/Plugins/Extensions/Makefile.am b/lib/python/Plugins/Extensions/Makefile.am
index 9f3737aa..edbd2084 100644..100755
--- a/lib/python/Plugins/Extensions/Makefile.am
+++ b/lib/python/Plugins/Extensions/Makefile.am
@@ -1 +1 @@
-SUBDIRS = TuxboxPlugins FileManager CutListEditor PicturePlayer MediaScanner MediaPlayer IpkgInstaller GraphMultiEPG SocketMMI DVDPlayer DVDBurn
+SUBDIRS = TuxboxPlugins FileManager CutListEditor PicturePlayer MediaScanner MediaPlayer GraphMultiEPG SocketMMI DVDPlayer DVDBurn
diff --git a/lib/python/Plugins/Extensions/MediaScanner/plugin.py b/lib/python/Plugins/Extensions/MediaScanner/plugin.py
index 88b917ee..2c31197d 100644..100755
--- a/lib/python/Plugins/Extensions/MediaScanner/plugin.py
+++ b/lib/python/Plugins/Extensions/MediaScanner/plugin.py
@@ -42,6 +42,9 @@ def scan(session):
parts = [ (r.description, r.mountpoint, session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
if len(parts):
+ for x in parts:
+ if not access(x[1], F_OK|R_OK):
+ parts.remove(x)
session.openWithCallback(mountpoint_choosen, ChoiceBox, title = _("Please Select Medium to be Scanned"), list = parts)
def main(session, **kwargs):
diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/.cvsignore b/lib/python/Plugins/SystemPlugins/ConfigurationBackup/.cvsignore
deleted file mode 100644
index 138b9cc2..00000000
--- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.pyc
-*.pyo
-Makefile
-Makefile.in
diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/Makefile.am b/lib/python/Plugins/SystemPlugins/ConfigurationBackup/Makefile.am
deleted file mode 100644
index d50236d8..00000000
--- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/ConfigurationBackup
-
-install_PYTHON = \
- __init__.py \
- plugin.py red.png yellow.png green.png blue.png backup.png
-
-install_DATA = LICENSE
-
diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/__init__.py b/lib/python/Plugins/SystemPlugins/ConfigurationBackup/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/__init__.py
+++ /dev/null
diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/backup.png b/lib/python/Plugins/SystemPlugins/ConfigurationBackup/backup.png
deleted file mode 100644
index 4962a058..00000000
--- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/backup.png
+++ /dev/null
Binary files differ
diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py b/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py
deleted file mode 100644
index 7a918da6..00000000
--- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py
+++ /dev/null
@@ -1,221 +0,0 @@
-from Screens.Screen import Screen
-from Screens.MessageBox import MessageBox
-from Screens.Console import Console
-from Components.ActionMap import ActionMap, NumberActionMap
-from Components.Pixmap import Pixmap
-from Components.Label import Label
-from Components.MenuList import MenuList
-from Components.config import ConfigSelection, ConfigSubsection, KEY_LEFT, KEY_RIGHT, KEY_0, getConfigListEntry
-from Components.ConfigList import ConfigList
-from Plugins.Plugin import PluginDescriptor
-
-from Tools.Directories import *
-from os import path, makedirs, listdir
-from time import localtime
-from datetime import date
-
-plugin_path = ""
-
-# FIXME: harddiskmanager has a better overview about available mointpoints!
-BackupPath = {
- "hdd" : "/media/hdd/backup",
- "usb" : "/media/usb/backup",
- "cf" : "/media/cf/backup"
- }
-
-MountPoints = {
- "hdd" : "/media/hdd",
- "usb" : "/media/usb",
- "cf" : "/media/cf"
- }
-
-class BackupSetup(Screen):
- skin = """
- <screen position="135,144" size="450,300" title="Backup and Restore" >
- <widget name="config" position="10,10" size="430,240" />
- <widget name="cancel" position="10,255" size="100,40" pixmap="~/red.png" transparent="1" alphatest="on" />
- <widget name="canceltext" position="0,0" size="0,0" valign="center" halign="center" zPosition="2" font="Regular;20" transparent="1" foregroundColor="black" />
- <widget name="ok" position="120,255" size="100,40" pixmap="~/green.png" transparent="1" alphatest="on" />
- <widget name="oktext" position="0,0" size="0,0" valign="center" halign="center" zPosition="2" font="Regular;20" transparent="1" foregroundColor="black" />
- <widget name="restore" position="230,255" size="100,40" pixmap="~/yellow.png" transparent="1" alphatest="on" />
- <widget name="restoretext" position="0,0" size="0,0" valign="center" halign="center" zPosition="2" font="Regular;20" transparent="1" foregroundColor="black" />
- <widget name="backup" position="340,255" size="100,40" pixmap="~/blue.png" transparent="1" alphatest="on" />
- <widget name="backuptext" position="0,0" size="0,0" valign="center" halign="center" zPosition="2" font="Regular;20" transparent="1" foregroundColor="black" />
- </screen>"""
-
- def keyLeft(self):
- self["config"].handleKey(KEY_LEFT)
-
- def keyRight(self):
- self["config"].handleKey(KEY_RIGHT)
-
- def keyNumberGlobal(self, number):
- print "You pressed number", number
- if (self["config"].getCurrent()[1].parent.enabled == True):
- self["config"].handleKey(KEY_0+number)
-
- def keyCancel(self):
- for x in self["config"].list:
- x[1].cancel()
- self.close()
-
- def keySave(self):
- for x in self["config"].list:
- x[1].save()
- self.close()
-
- def __init__(self, session, args = None):
- Screen.__init__(self, session)
- self.skin_path = plugin_path
-
- self["oktext"] = Label(_("OK"))
- self["canceltext"] = Label(_("Cancel"))
- self["backuptext"] = Label(_("Backup"))
- self["restoretext"] = Label(_("Restore"))
- self["restore"] = Pixmap()
- self["backup"] = Pixmap()
- self["ok"] = Pixmap()
- self["cancel"] = Pixmap()
-
- self.path = ""
- self.list = []
- self["config"] = ConfigList(self.list)
- self.createSetup()
-
- self["actions"] = NumberActionMap(["SetupActions"],
- {
- "ok": self.keySave,
- "cancel": self.keyCancel,
- "left": self.keyLeft,
- "right": self.keyRight
- }, -1)
-
- self["shortcuts"] = ActionMap(["ShortcutActions"],
- {
- "red": self.keyCancel,
- "green": self.keySave,
- "blue": self.Backup,
- "yellow": self.Restore,
- })
-
-
- def createSetup(self):
- print "Creating BackupSetup"
- self.list = [ ]
- self["config"] = ConfigList(self.list)
- self.backup = ConfigSubsection()
- self.backup.type = ConfigSelection(choices = [("settings", _("enigma2 and network")), ("var", _("/var directory")), ("skin", _("/usr/share/enigma2 directory"))], default="settings")
- self.backup.location = ConfigSelection(choices = [("hdd", _("Harddisk")), ("usb", _("USB Stick")), ("cf", _("CF Drive"))])
- self.list.append(getConfigListEntry(_("Backup Mode"), self.backup.type))
- self.list.append(getConfigListEntry(_("Backup Location"), self.backup.location))
-
- def createBackupfolders(self):
- self.path = BackupPath[self.backup.location.value]
- print "Creating Backup Folder if not already there..."
- if (path.exists(self.path) == False):
- makedirs(self.path)
-
- def Backup(self):
- print "this will start the backup now!"
- self.session.openWithCallback(self.runBackup, MessageBox, _("Do you want to backup now?\nAfter pressing OK, please wait!"))
-
- def Restore(self):
- print "this will start the restore now!"
- self.session.open(RestoreMenu, self.backup)
-
- def runBackup(self, result):
- if result:
- if path.ismount(MountPoints[self.backup.location.value]):
- self.createBackupfolders()
- d = localtime()
- dt = date(d.tm_year, d.tm_mon, d.tm_mday)
- self.path = BackupPath[self.backup.location.value]
- if self.backup.type.value == "settings":
- print "Backup Mode: Settings"
- self.session.open(Console, title = "Backup running", cmdlist = ["tar -czvf " + self.path + "/" + str(dt) + "_settings_backup.tar.gz /etc/enigma2/ /etc/network/interfaces /etc/wpa_supplicant.conf"])
- elif self.backup.type.value == "var":
- print "Backup Mode: var"
- self.session.open(Console, title = "Backup running", cmdlist = [ "tar -czvf " + self.path + "/" + str(dt) + "_var_backup.tar.gz /var/"])
- elif self.backup.type.value == "skin":
- print "Backup Mode: skin"
- self.session.open(Console, title ="Backup running", cmdlist = [ "tar -czvf " + self.path + "/" + str(dt) + "_skin_backup.tar.gz /usr/share/enigma2/"])
- else:
- self.session.open(MessageBox, _("Sorry your Backup destination does not exist\n\nPlease choose an other one."), MessageBox.TYPE_INFO)
-
-class RestoreMenu(Screen):
- skin = """
- <screen position="135,144" size="450,300" title="Restore Backups" >
- <widget name="filelist" position="10,10" size="430,240" scrollbarMode="showOnDemand" />
- <widget name="cancel" position="120,255" size="100,40" pixmap="~/red.png" transparent="1" alphatest="on" />
- <widget name="canceltext" position="0,0" size="0,0" valign="center" halign="center" zPosition="2" font="Regular;20" transparent="1" foregroundColor="black" />
- <widget name="restore" position="230,255" size="100,40" pixmap="~/yellow.png" transparent="1" alphatest="on" />
- <widget name="restoretext" position="0,0" size="0,0" valign="center" halign="center" zPosition="2" font="Regular;20" transparent="1" foregroundColor="black" />
- </screen>"""
-
- def __init__(self, session, backup):
- Screen.__init__(self, session)
- self.skin_path = plugin_path
- self.backup = backup
-
- self["canceltext"] = Label(_("Cancel"))
- self["restoretext"] = Label(_("Restore"))
- self["restore"] = Pixmap()
- self["cancel"] = Pixmap()
-
- self.sel = []
- self.val = []
- self.entry = False
- self.exe = False
-
- self.path = ""
-
- self["actions"] = NumberActionMap(["SetupActions"],
- {
- "ok": self.KeyOk,
- "cancel": self.keyCancel
- }, -1)
-
- self["shortcuts"] = ActionMap(["ShortcutActions"],
- {
- "red": self.keyCancel,
- "yellow": self.KeyOk,
- })
- self.flist = []
- self["filelist"] = MenuList(self.flist)
- self.fill_list()
-
- def fill_list(self):
- self.flist = []
- self.path = BackupPath[self.backup.location.value]
- if (path.exists(self.path) == False):
- makedirs(self.path)
- for file in listdir(self.path):
- if (file.endswith(".tar.gz")):
- self.flist.append((file))
- self.entry = True
- self["filelist"].l.setList(self.flist)
-
- def KeyOk(self):
- if (self.exe == False) and (self.entry == True):
- self.sel = self["filelist"].getCurrent()
- self.val = self.path + self.sel
- self.session.openWithCallback(self.startRestore, MessageBox, _("are you sure you want to restore\nfollowing backup:\n" + self.sel + "\nEnigma2 will restart after the restore"))
-
- def keyCancel(self):
- self.close()
-
- def startRestore(self, ret = False):
- if (ret == True):
- self.exe = True
- self.session.open(Console, title = "Restore running", cmdlist = ["tar -xzvf " + self.path + "/" + self.sel + " -C /", "killall -9 enigma2"])
-
- def Exit(self):
- self.close()
-
-def BackupMain(session, **kwargs):
- session.open(BackupSetup)
-
-def Plugins(path, **kwargs):
- global plugin_path
- plugin_path = path
- return PluginDescriptor(name="Backup/Restore", description="Backup and Restore your Settings", icon="backup.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=BackupMain)
diff --git a/lib/python/Plugins/SystemPlugins/Makefile.am b/lib/python/Plugins/SystemPlugins/Makefile.am
index 4491eafc..10151f2c 100644..100755
--- a/lib/python/Plugins/SystemPlugins/Makefile.am
+++ b/lib/python/Plugins/SystemPlugins/Makefile.am
@@ -1 +1 @@
-SUBDIRS = SoftwareUpdate FrontprocessorUpgrade PositionerSetup ConfigurationBackup Satfinder SkinSelector SatelliteEquipmentControl Videomode VideoTune Hotplug DefaultServicesScanner NFIFlash DiseqcTester
+SUBDIRS = SoftwareManager FrontprocessorUpgrade PositionerSetup Satfinder SkinSelector SatelliteEquipmentControl Videomode VideoTune Hotplug DefaultServicesScanner NFIFlash DiseqcTester
diff --git a/lib/python/Plugins/Extensions/IpkgInstaller/.cvsignore b/lib/python/Plugins/SystemPlugins/SoftwareManager/.cvsignore
index 138b9cc2..138b9cc2 100644
--- a/lib/python/Plugins/Extensions/IpkgInstaller/.cvsignore
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/.cvsignore
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py
new file mode 100755
index 00000000..947452e9
--- /dev/null
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py
@@ -0,0 +1,312 @@
+from Screens.Screen import Screen
+from Screens.MessageBox import MessageBox
+from Screens.Console import Console
+from Components.ActionMap import ActionMap, NumberActionMap
+from Components.Pixmap import Pixmap
+from Components.Label import Label
+from Components.MenuList import MenuList
+from Components.config import getConfigListEntry, configfile, ConfigSelection, ConfigSubsection, ConfigText, ConfigLocations
+from Components.config import config
+from Components.ConfigList import ConfigList,ConfigListScreen
+from Components.FileList import MultiFileSelectList
+from Plugins.Plugin import PluginDescriptor
+from enigma import eTimer
+from Tools.Directories import *
+from os import popen, path, makedirs, listdir, access, stat, rename, remove, W_OK, R_OK
+from time import gmtime, strftime, localtime
+from datetime import date
+
+
+config.plugins.configurationbackup = ConfigSubsection()
+config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False)
+config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf'])
+
+def getBackupPath():
+ backuppath = config.plugins.configurationbackup.backuplocation.value
+ if backuppath.endswith('/'):
+ return backuppath + 'backup'
+ else:
+ return backuppath + '/backup'
+
+def getBackupFilename():
+ return "enigma2settingsbackup.tar.gz"
+
+
+class BackupScreen(Screen, ConfigListScreen):
+ skin = """
+ <screen position="135,144" size="350,310" title="Backup running..." >
+ <widget name="config" position="10,10" size="330,250" transparent="1" scrollbarMode="showOnDemand" />
+ </screen>"""
+
+ def __init__(self, session, runBackup = False):
+ Screen.__init__(self, session)
+ self.session = session
+ self.runBackup = runBackup
+ self["actions"] = ActionMap(["WizardActions", "DirectionActions"],
+ {
+ "ok": self.close,
+ "back": self.close,
+ "cancel": self.close,
+ }, -1)
+ self.finished_cb = None
+ self.backuppath = getBackupPath()
+ self.backupfile = getBackupFilename()
+ self.fullbackupfilename = self.backuppath + "/" + self.backupfile
+ self.list = []
+ ConfigListScreen.__init__(self, self.list)
+ self.onLayoutFinish.append(self.layoutFinished)
+ if self.runBackup:
+ self.onShown.append(self.doBackup)
+
+ def layoutFinished(self):
+ self.setWindowTitle()
+
+ def setWindowTitle(self):
+ self.setTitle(_("Backup running..."))
+
+ def doBackup(self):
+ try:
+ if (path.exists(self.backuppath) == False):
+ makedirs(self.backuppath)
+ self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value )
+ if path.exists(self.fullbackupfilename):
+ dt = str(date.fromtimestamp(stat(self.fullbackupfilename).st_ctime))
+ self.newfilename = self.backuppath + "/" + dt + '-' + self.backupfile
+ if path.exists(self.newfilename):
+ remove(self.newfilename)
+ rename(self.fullbackupfilename,self.newfilename)
+ if self.finished_cb:
+ self.session.openWithCallback(self.finished_cb, Console, title = _("Backup running"), cmdlist = ["tar -czvf " + self.fullbackupfilename + " " + self.backupdirs],finishedCallback = self.backupFinishedCB,closeOnSuccess = True)
+ else:
+ self.session.open(Console, title = _("Backup running"), cmdlist = ["tar -czvf " + self.fullbackupfilename + " " + self.backupdirs],finishedCallback = self.backupFinishedCB, closeOnSuccess = True)
+ except OSError:
+ if self.finished_cb:
+ self.session.openWithCallback(self.finished_cb, MessageBox, _("Sorry your backup destination is not writeable.\nPlease choose an other one."), MessageBox.TYPE_INFO)
+ else:
+ self.session.openWithCallback(self.backupErrorCB,MessageBox, _("Sorry your backup destination is not writeable.\nPlease choose an other one."), MessageBox.TYPE_INFO)
+
+ def backupFinishedCB(self,retval = None):
+ self.close(True)
+
+ def backupErrorCB(self,retval = None):
+ self.close(False)
+
+ def runAsync(self, finished_cb):
+ self.finished_cb = finished_cb
+ self.doBackup()
+
+
+class BackupSelection(Screen):
+ skin = """
+ <screen position="135,125" size="450,310" title="Select files/folders to backup...">
+ <widget name="checkList" position="10,10" size="430,250" transparent="1" scrollbarMode="showOnDemand" />
+ <ePixmap position="0,265" zPosition="1" size="135,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
+ <widget name="key_red" position="0,265" zPosition="2" size="135,40" halign="center" valign="center" font="Regular;22" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
+ <ePixmap position="135,265" zPosition="1" size="135,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
+ <widget name="key_green" position="135,265" zPosition="2" size="135,40" halign="center" valign="center" font="Regular;22" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
+ <ePixmap position="270,265" zPosition="1" size="135,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
+ <widget name="key_yellow" position="270,265" zPosition="2" size="135,40" halign="center" valign="center" font="Regular;22" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
+ </screen>"""
+
+ def __init__(self, session):
+ Screen.__init__(self, session)
+ self["key_red"] = Label(_("Cancel"))
+ self["key_green"] = Label(_("Save"))
+ self["key_yellow"] = Label()
+
+ self.selectedFiles = config.plugins.configurationbackup.backupdirs.value
+ defaultDir = '/'
+ inhibitDirs = ["/bin", "/boot", "/dev", "/autofs", "/lib", "/proc", "/sbin", "/sys", "/hdd", "/tmp", "/mnt", "/media"]
+ self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs = inhibitDirs )
+ self["checkList"] = self.filelist
+
+ self["actions"] = ActionMap(["DirectionActions", "OkCancelActions", "ShortcutActions"],
+ {
+ "cancel": self.exit,
+ "red": self.exit,
+ "yellow": self.changeSelectionState,
+ "green": self.saveSelection,
+ "ok": self.okClicked,
+ "left": self.left,
+ "right": self.right,
+ "down": self.down,
+ "up": self.up
+ }, -1)
+ if not self.selectionChanged in self["checkList"].onSelectionChanged:
+ self["checkList"].onSelectionChanged.append(self.selectionChanged)
+ self.onLayoutFinish.append(self.layoutFinished)
+
+ def layoutFinished(self):
+ idx = 0
+ self["checkList"].moveToIndex(idx)
+ self.setWindowTitle()
+ self.selectionChanged()
+
+ def setWindowTitle(self):
+ self.setTitle(_("Select files/folders to backup..."))
+
+ def selectionChanged(self):
+ current = self["checkList"].getCurrent()[0]
+ if current[2] is True:
+ self["key_yellow"].setText(_("Deselect"))
+ else:
+ self["key_yellow"].setText(_("Select"))
+
+ def up(self):
+ self["checkList"].up()
+
+ def down(self):
+ self["checkList"].down()
+
+ def left(self):
+ self["checkList"].pageUp()
+
+ def right(self):
+ self["checkList"].pageDown()
+
+ def changeSelectionState(self):
+ self["checkList"].changeSelectionState()
+ self.selectedFiles = self["checkList"].getSelectedList()
+
+ def saveSelection(self):
+ self.selectedFiles = self["checkList"].getSelectedList()
+ config.plugins.configurationbackup.backupdirs.value = self.selectedFiles
+ config.plugins.configurationbackup.backupdirs.save()
+ config.plugins.configurationbackup.save()
+ config.save()
+ self.close(None)
+
+ def exit(self):
+ self.close(None)
+
+ def okClicked(self):
+ if self.filelist.canDescent():
+ self.filelist.descent()
+
+
+class RestoreMenu(Screen):
+ skin = """
+ <screen position="135,144" size="450,300" title="Restore backups..." >
+ <widget name="filelist" position="10,10" size="430,240" scrollbarMode="showOnDemand" />
+ <widget name="cancel" position="120,255" size="100,40" pixmap="~/red.png" transparent="1" alphatest="on" />
+ <widget name="canceltext" position="0,0" size="0,0" valign="center" halign="center" zPosition="2" font="Regular;20" transparent="1" foregroundColor="black" />
+ <widget name="restore" position="230,255" size="100,40" pixmap="~/yellow.png" transparent="1" alphatest="on" />
+ <widget name="restoretext" position="0,0" size="0,0" valign="center" halign="center" zPosition="2" font="Regular;20" transparent="1" foregroundColor="black" />
+ </screen>"""
+
+ def __init__(self, session, plugin_path):
+ Screen.__init__(self, session)
+ self.skin_path = plugin_path
+
+ self["canceltext"] = Label(_("Cancel"))
+ self["restoretext"] = Label(_("Restore"))
+ self["restore"] = Pixmap()
+ self["cancel"] = Pixmap()
+
+ self.sel = []
+ self.val = []
+ self.entry = False
+ self.exe = False
+
+ self.path = ""
+
+ self["actions"] = NumberActionMap(["SetupActions"],
+ {
+ "ok": self.KeyOk,
+ "cancel": self.keyCancel
+ }, -1)
+
+ self["shortcuts"] = ActionMap(["ShortcutActions"],
+ {
+ "red": self.keyCancel,
+ "yellow": self.KeyOk,
+ })
+ self.flist = []
+ self["filelist"] = MenuList(self.flist)
+ self.fill_list()
+ self.onLayoutFinish.append(self.layoutFinished)
+
+ def layoutFinished(self):
+ self.setWindowTitle()
+
+ def setWindowTitle(self):
+ self.setTitle(_("Restore backups..."))
+
+
+ def fill_list(self):
+ self.flist = []
+ self.path = getBackupPath()
+ if (path.exists(self.path) == False):
+ makedirs(self.path)
+ for file in listdir(self.path):
+ if (file.endswith(".tar.gz")):
+ self.flist.append((file))
+ self.entry = True
+ self["filelist"].l.setList(self.flist)
+
+ def KeyOk(self):
+ if (self.exe == False) and (self.entry == True):
+ self.sel = self["filelist"].getCurrent()
+ self.val = self.path + self.sel
+ self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n" + self.sel + "\nSystem will restart after the restore!"))
+
+ def keyCancel(self):
+ self.close()
+
+ def startRestore(self, ret = False):
+ if (ret == True):
+ self.exe = True
+ self.session.open(Console, title = _("Restore running"), cmdlist = ["tar -xzvf " + self.path + "/" + self.sel + " -C /", "killall -9 enigma2"])
+
+ def Exit(self):
+ self.close()
+
+class RestoreScreen(Screen, ConfigListScreen):
+ skin = """
+ <screen position="135,144" size="350,310" title="Restore running..." >
+ <widget name="config" position="10,10" size="330,250" transparent="1" scrollbarMode="showOnDemand" />
+ </screen>"""
+
+ def __init__(self, session, runRestore = False):
+ Screen.__init__(self, session)
+ self.session = session
+ self.runRestore = runRestore
+ self["actions"] = ActionMap(["WizardActions", "DirectionActions"],
+ {
+ "ok": self.close,
+ "back": self.close,
+ "cancel": self.close,
+ }, -1)
+ self.finished_cb = None
+ self.backuppath = getBackupPath()
+ self.backupfile = getBackupFilename()
+ self.fullbackupfilename = self.backuppath + "/" + self.backupfile
+ self.list = []
+ ConfigListScreen.__init__(self, self.list)
+ self.onLayoutFinish.append(self.layoutFinished)
+ if self.runRestore:
+ self.onShown.append(self.doRestore)
+
+ def layoutFinished(self):
+ self.setWindowTitle()
+
+ def setWindowTitle(self):
+ self.setTitle(_("Restore running..."))
+
+ def doRestore(self):
+ if self.finished_cb:
+ self.session.openWithCallback(self.finished_cb, Console, title = _("Restore running"), cmdlist = ["tar -xzvf " + self.fullbackupfilename + " -C /", "killall -9 enigma2"])
+ else:
+ self.session.open(Console, title = _("Restore running"), cmdlist = ["tar -xzvf " + self.fullbackupfilename + " -C /", "killall -9 enigma2"])
+
+ def backupFinishedCB(self,retval = None):
+ self.close(True)
+
+ def backupErrorCB(self,retval = None):
+ self.close(False)
+
+ def runAsync(self, finished_cb):
+ self.finished_cb = finished_cb
+ self.doRestore()
+
+ \ No newline at end of file
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py
new file mode 100755
index 00000000..1797e4fe
--- /dev/null
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py
@@ -0,0 +1,120 @@
+from Screens.Wizard import WizardSummary
+from Screens.WizardLanguage import WizardLanguage
+from Screens.Wizard import wizardManager
+from Screens.Rc import Rc
+from Components.Label import Label
+from Components.MenuList import MenuList
+from Components.PluginComponent import plugins
+from Plugins.Plugin import PluginDescriptor
+from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
+from Components.Pixmap import Pixmap, MovingPixmap, MultiPixmap
+from os import popen, path, makedirs, listdir, access, stat, rename, remove, W_OK, R_OK
+
+from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations, ConfigBoolean
+from Components.Harddisk import harddiskmanager
+config.misc.firstrun = ConfigBoolean(default = True)
+config.plugins.configurationbackup = ConfigSubsection()
+config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False)
+config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf'])
+
+
+backupfile = "enigma2settingsbackup.tar.gz"
+
+def checkConfigBackup():
+ parts = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
+ for x in parts:
+ if x[1] == '/':
+ parts.remove(x)
+ if len(parts):
+ for x in parts:
+ if x[1].endswith('/'):
+ fullbackupfile = x[1] + 'backup/' + backupfile
+ if fileExists(fullbackupfile):
+ config.plugins.configurationbackup.backuplocation.value = str(x[1])
+ config.plugins.configurationbackup.backuplocation.save()
+ config.plugins.configurationbackup.save()
+ return x
+ else:
+ fullbackupfile = x[1] + '/backup/' + backupfile
+ if fileExists(fullbackupfile):
+ config.plugins.configurationbackup.backuplocation.value = str(x[1])
+ config.plugins.configurationbackup.backuplocation.save()
+ config.plugins.configurationbackup.save()
+ return x
+ return None
+
+def checkBackupFile():
+ backuplocation = config.plugins.configurationbackup.backuplocation.value
+ if backuplocation.endswith('/'):
+ fullbackupfile = backuplocation + 'backup/' + backupfile
+ if fileExists(fullbackupfile):
+ return True
+ else:
+ return False
+ else:
+ fullbackupfile = backuplocation + '/backup/' + backupfile
+ if fileExists(fullbackupfile):
+ return True
+ else:
+ return False
+
+if checkConfigBackup() is None:
+ backupAvailable = 0
+else:
+ backupAvailable = 1
+
+class ImageWizard(WizardLanguage, Rc):
+ skin = """
+ <screen name="ImageWizard" position="0,0" size="720,576" title="Welcome..." flags="wfNoBorder" >
+ <widget name="text" position="153,40" size="340,330" font="Regular;22" />
+ <widget source="list" render="Listbox" position="43,340" size="490,180" scrollbarMode="showOnDemand" >
+ <convert type="StringList" />
+ </widget>
+ <widget name="config" position="53,340" zPosition="1" size="440,180" transparent="1" scrollbarMode="showOnDemand" />
+ <ePixmap pixmap="skin_default/buttons/button_red.png" position="40,225" zPosition="0" size="15,16" transparent="1" alphatest="on" />
+ <widget name="languagetext" position="55,225" size="95,30" font="Regular;18" />
+ <widget name="wizard" pixmap="skin_default/wizard.png" position="40,50" zPosition="10" size="110,174" alphatest="on" />
+ <widget name="rc" pixmaps="skin_default/rc.png,skin_default/rcold.png" position="530,50" zPosition="10" size="154,500" alphatest="on" />
+ <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+ <widget name="arrowdown2" pixmap="skin_default/arrowdown.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+ <widget name="arrowup" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+ <widget name="arrowup2" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+ </screen>"""
+ def __init__(self, session):
+ self.xmlfile = resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/imagewizard.xml")
+ WizardLanguage.__init__(self, session, showSteps = False, showStepSlider = False)
+ Rc.__init__(self)
+ self.session = session
+ self["wizard"] = Pixmap()
+ self.selectedDevice = None
+
+ def markDone(self):
+ pass
+
+ def listDevices(self):
+ list = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
+ for x in list:
+ result = access(x[1], W_OK) and access(x[1], R_OK)
+ if result is False or x[1] == '/':
+ list.remove(x)
+ for x in list:
+ if x[1].startswith('/autofs/'):
+ list.remove(x)
+ return list
+
+ def deviceSelectionMade(self, index):
+ self.deviceSelect(index)
+
+ def deviceSelectionMoved(self):
+ self.deviceSelect(self.selection)
+
+ def deviceSelect(self, device):
+ self.selectedDevice = device
+ config.plugins.configurationbackup.backuplocation.value = self.selectedDevice
+ config.plugins.configurationbackup.backuplocation.save()
+ config.plugins.configurationbackup.save()
+
+
+if config.misc.firstrun.value:
+ wizardManager.registerWizard(ImageWizard, backupAvailable, priority = 10)
+
diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/LICENSE b/lib/python/Plugins/SystemPlugins/SoftwareManager/LICENSE
index 99700593..835b9dc6 100644..100755
--- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/LICENSE
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/LICENSE
@@ -10,3 +10,8 @@ is licensed by Dream Multimedia GmbH.
This plugin is NOT free software. It is open source, you are allowed to
modify it (if you keep the license), but it may not be commercially
distributed other than under the conditions noted above.
+
+Some Icons used are taken from NX10 icons by Mazenl77
+(http://www.iconspedia.com/pack/nx10-1-6/)
+licensed under Creative Commons Attribution 3.0 Unported
+http://creativecommons.org/licenses/by/3.0/
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/Makefile.am b/lib/python/Plugins/SystemPlugins/SoftwareManager/Makefile.am
new file mode 100755
index 00000000..f94498f5
--- /dev/null
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/Makefile.am
@@ -0,0 +1,12 @@
+installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/SoftwareManager
+
+install_PYTHON = \
+ __init__.py \
+ plugin.py \
+ BackupRestore.py \
+ ImageWizard.py \
+ imagewizard.xml \
+ *.png
+
+install_DATA = LICENSE
+
diff --git a/lib/python/Plugins/Extensions/IpkgInstaller/__init__.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/__init__.py
index e69de29b..e69de29b 100644
--- a/lib/python/Plugins/Extensions/IpkgInstaller/__init__.py
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/__init__.py
diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/blue.png b/lib/python/Plugins/SystemPlugins/SoftwareManager/blue.png
index a392bbe6..a392bbe6 100644..100755
--- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/blue.png
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/blue.png
Binary files differ
diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/green.png b/lib/python/Plugins/SystemPlugins/SoftwareManager/green.png
index f168e4d0..f168e4d0 100644..100755
--- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/green.png
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/green.png
Binary files differ
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/imagewizard.xml b/lib/python/Plugins/SystemPlugins/SoftwareManager/imagewizard.xml
new file mode 100755
index 00000000..98658b7d
--- /dev/null
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/imagewizard.xml
@@ -0,0 +1,100 @@
+<wizard>
+ <step id="restorequestion">
+ <condition>
+from Plugins.SystemPlugins.SoftwareManager.ImageWizard import checkConfigBackup
+self.backuppath = checkConfigBackup()
+self.condition = (self.backuppath is not None and config.misc.firstrun.value)
+ </condition>
+ <text value="Do you want to restore your settings?" />
+ <list>
+ <listentry caption="Yes, restore the settings now" step="restore" />
+ <listentry caption="No, just start my dreambox" step="end" />
+ </list>
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+ </code>
+ </step>
+
+ <step id="welcome">
+ <text value="Welcome to the Image upgrade wizard. The wizard will assist you in upgrading the firmware of your Dreambox by providing a backup facility for your current settings and a short explanation of how to upgrade your firmware." />
+ <list>
+ <listentry caption="OK, guide me through the upgrade process" step="backupquestion" />
+ <listentry caption="Exit the wizard" step="end" />
+ </list>
+ </step>
+
+ <step id="backupquestion">
+ <text value="The wizard can backup your current settings. Do you want to do a backup now?" />
+ <list>
+ <listentry caption="Yes, backup my settings!" step="backupwhere" />
+ <listentry caption="No backup needed" step="upgrade" />
+ </list>
+ </step>
+
+ <step id="backupwhere" nextstep="backup">
+ <text value="Where do you want to backup your settings?" />
+ <list type="dynamic" source="listDevices" evaluation="deviceSelectionMade" onselect="deviceSelectionMoved" />
+ </step>
+
+ <step id="backup" nextstep="backupresult">
+ <text value="You have chosen to backup your settings. Please press OK to start the backup now." />
+ <config screen="BackupScreen" module="Plugins.SystemPlugins.SoftwareManager.BackupRestore" type="ConfigList" />
+ <code pos="after" async="yes">
+self.currStep = self.getStepWithID('backupresult')
+self.afterAsyncCode()
+ </code>
+ </step>
+
+ <step id="backupresult" nextstep="upgrade">
+ <condition>
+from Plugins.SystemPlugins.SoftwareManager.ImageWizard import checkBackupFile
+self.backuppath = checkBackupFile()
+self.condition = (self.backuppath is True)
+ </condition>
+ <text value="Your backup succeeded. We will now continue to explain the further upgrade process." />
+ </step>
+
+ <step id="backupresult" nextstep="backupwhere">
+ <condition>
+from Plugins.SystemPlugins.SoftwareManager.ImageWizard import checkBackupFile
+self.backuppath = checkBackupFile()
+self.condition = (self.backuppath is False)
+ </condition>
+ <text value="The backup failed. Please choose a different backup location." />
+ </step>
+
+ <step id="restore" nextstep="backupresult">
+ <text value="You have chosen to restore your settings. Enigma2 will restart after restore. Please press OK to start the restore now." />
+ <config screen="RestoreScreen" module="Plugins.SystemPlugins.SoftwareManager.BackupRestore" type="ConfigList" />
+ </step>
+
+
+ <step id="upgradehow">
+ <text value="The wizard can backup your current settings. Do you want to do a backup now?" />
+ <list>
+ <listentry caption="Install a new image with your web browser" step="upgrade" />
+ <listentry caption="Install a new image with a USB stick" step="upgradeUSB" />
+ </list>
+ </step>
+
+ <step id="upgrade">
+ <text value="You need a PC connected to your dreambox. If you need further instructions, please visit the website http://www.dm7025.de.\nYour dreambox will now be halted. After you have performed the update instructions from the website, your new firmware will ask you to restore your settings." />
+ <list>
+ <listentry caption="Yes, perform a shutdown now." step="shutdown" />
+ <listentry caption="No, do nothing." step="end" />
+ </list>
+ </step>
+
+ <step id="shutdown" nextstep="shutdown">
+ <code>
+from enigma import quitMainloop
+quitMainloop(1)
+ </code>
+ <text value="Your dreambox is shutting down. Please stand by..." />
+ </step>
+
+ <step id="end">
+ <text value="The wizard is finished now." />
+ </step>
+</wizard>
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/installable.png b/lib/python/Plugins/SystemPlugins/SoftwareManager/installable.png
new file mode 100755
index 00000000..710f4201
--- /dev/null
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/installable.png
Binary files differ
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/installed.png b/lib/python/Plugins/SystemPlugins/SoftwareManager/installed.png
new file mode 100755
index 00000000..d6a1bc10
--- /dev/null
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/installed.png
Binary files differ
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py
new file mode 100755
index 00000000..09b61bd5
--- /dev/null
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py
@@ -0,0 +1,738 @@
+from Plugins.Plugin import PluginDescriptor
+from Screens.Console import Console
+from Screens.ChoiceBox import ChoiceBox
+from Screens.MessageBox import MessageBox
+from Screens.Screen import Screen
+from Screens.Ipkg import Ipkg
+from Components.ActionMap import ActionMap, NumberActionMap
+from Components.Input import Input
+from Components.Ipkg import IpkgComponent
+from Components.Label import Label
+from Components.MenuList import MenuList
+from Components.Sources.List import List
+from Components.Slider import Slider
+from Components.Harddisk import harddiskmanager
+from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations
+from Components.Console import Console
+from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
+from Components.SelectionList import SelectionList
+from Components.PluginComponent import plugins
+from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
+from Tools.LoadPixmap import LoadPixmap
+from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont
+from cPickle import dump, load
+
+from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK
+from time import time, gmtime, strftime, localtime
+from stat import ST_MTIME
+from datetime import date
+
+from ImageWizard import ImageWizard
+from BackupRestore import BackupSelection, RestoreMenu, BackupScreen, RestoreScreen, getBackupPath, getBackupFilename
+
+config.plugins.configurationbackup = ConfigSubsection()
+config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False)
+config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf'])
+
+def write_cache(cache_file, cache_data):
+ #Does a cPickle dump
+ if not os_path.isdir( os_path.dirname(cache_file) ):
+ try:
+ mkdir( os_path.dirname(cache_file) )
+ except OSError:
+ print os_path.dirname(cache_file), 'is a file'
+ fd = open(cache_file, 'w')
+ dump(cache_data, fd, -1)
+ fd.close()
+
+def valid_cache(cache_file, cache_ttl):
+ #See if the cache file exists and is still living
+ try:
+ mtime = stat(cache_file)[ST_MTIME]
+ except:
+ return 0
+ curr_time = time()
+ if (curr_time - mtime) > cache_ttl:
+ return 0
+ else:
+ return 1
+
+def load_cache(cache_file):
+ #Does a cPickle load
+ fd = open(cache_file)
+ cache_data = load(fd)
+ fd.close()
+ return cache_data
+
+
+class UpdatePluginMenu(Screen):
+ skin = """
+ <screen name="UpdatePluginMenu" position="90,130" size="550,330" title="Softwaremanager..." >
+ <ePixmap pixmap="skin_default/border_menu.png" position="10,10" zPosition="1" size="250,300" transparent="1" alphatest="on" />
+ <widget source="menu" render="Listbox" position="20,20" size="230,260" scrollbarMode="showOnDemand">
+ <convert type="TemplatedMultiContent">
+ {"template": [
+ MultiContentEntryText(pos = (2, 2), size = (230, 22), flags = RT_HALIGN_LEFT, text = 1), # index 0 is the MenuText,
+ ],
+ "fonts": [gFont("Regular", 20)],
+ "itemHeight": 25
+ }
+ </convert>
+ </widget>
+ <widget source="menu" render="Listbox" position="280,10" size="230,300" scrollbarMode="showNever" selectionDisabled="1">
+ <convert type="TemplatedMultiContent">
+ {"template": [
+ MultiContentEntryText(pos = (2, 2), size = (230, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 0 is the MenuText,
+ ],
+ "fonts": [gFont("Regular", 20)],
+ "itemHeight": 230
+ }
+ </convert>
+ </widget>
+ </screen>"""
+
+ def __init__(self, session, args = 0):
+ Screen.__init__(self, session)
+ self.skin_path = plugin_path
+ self.menu = args
+ self.list = []
+ self.oktext = _("\nPress OK on your remote control to continue.")
+ self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value )
+ if self.menu == 0:
+ self.list.append(("software-update", _("Software update"), _("\nOnline update of your Dreambox software." ) + self.oktext) )
+ self.list.append(("software-restore", _("Software restore"), _("\nRestore your Dreambox with a new firmware." ) + self.oktext))
+ self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext))
+ self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your Dreambox settings." ) + self.oktext))
+ if config.usage.setup_level.index >= 2: # expert+
+ self.list.append(("advanced", _("Advanced Options"), _("\nAdvanced options and settings." ) + self.oktext))
+ elif self.menu == 1:
+ self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext))
+ self.list.append(("ipkg-install", _("Install local IPKG"), _("\nScan for local packages and install them." ) + self.oktext))
+ self.list.append(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext))
+ self.list.append(("backuplocation", _("Choose backup location"), _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext ))
+ self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup. Currently selected:\n" ) + self.backupdirs + self.oktext))
+ self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext))
+
+ self["menu"] = List(self.list)
+
+ self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"],
+ {
+ "ok": self.go,
+ "back": self.close,
+ "red": self.close,
+ }, -1)
+
+ self.onLayoutFinish.append(self.layoutFinished)
+ self.backuppath = getBackupPath()
+ self.backupfile = getBackupFilename()
+ self.fullbackupfilename = self.backuppath + "/" + self.backupfile
+ self.onShown.append(self.setWindowTitle)
+
+ def layoutFinished(self):
+ idx = 0
+ self["menu"].index = idx
+
+ def setWindowTitle(self):
+ self.setTitle(_("Software manager..."))
+
+ def go(self):
+ current = self["menu"].getCurrent()
+ if current:
+ current = current[0]
+ if self.menu == 0:
+ if (current == "software-restore"):
+ self.session.open(ImageWizard)
+ elif (current == "software-update"):
+ self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your Dreambox?")+"\n"+_("\nAfter pressing OK, please wait!"))
+ elif (current == "advanced"):
+ self.session.open(UpdatePluginMenu, 1)
+ elif (current == "system-backup"):
+ self.session.openWithCallback(self.backupDone,BackupScreen, runBackup = True)
+ elif (current == "system-restore"):
+ if os_path.exists(self.fullbackupfilename):
+ self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore your Enigma2 backup?\nEnigma2 will restart after the restore"))
+ else:
+ self.session.open(MessageBox, _("Sorry no backups found!"), MessageBox.TYPE_INFO)
+ elif self.menu == 1:
+ if (current == "ipkg-manager"):
+ self.session.open(PacketManager, self.skin_path)
+ elif (current == "ipkg-source"):
+ self.session.open(IPKGSource)
+ elif (current == "ipkg-install"):
+ try:
+ from Plugins.Extensions.MediaScanner.plugin import main
+ main(self.session)
+ except:
+ self.session.open(MessageBox, _("Sorry MediaScanner is not installed!"), MessageBox.TYPE_INFO)
+ elif (current == "backuplocation"):
+ parts = [ (r.description, r.mountpoint, self.session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
+ for x in parts:
+ if not access(x[1], F_OK|R_OK|W_OK) or x[1] == '/':
+ parts.remove(x)
+ for x in parts:
+ if x[1].startswith('/autofs/'):
+ parts.remove(x)
+ if len(parts):
+ self.session.openWithCallback(self.backuplocation_choosen, ChoiceBox, title = _("Please select medium to use as backup location"), list = parts)
+ elif (current == "backupfiles"):
+ self.session.openWithCallback(self.backupfiles_choosen,BackupSelection)
+ elif (current == "advancedrestore"):
+ self.session.open(RestoreMenu, self.skin_path)
+
+ def backupfiles_choosen(self, ret):
+ self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value )
+
+ def backuplocation_choosen(self, option):
+ if option is not None:
+ config.plugins.configurationbackup.backuplocation.value = str(option[1])
+ config.plugins.configurationbackup.backuplocation.save()
+ config.plugins.configurationbackup.save()
+ config.save()
+ self.createBackupfolders()
+
+ def runUpgrade(self, result):
+ if result:
+ self.session.open(UpdatePlugin, self.skin_path)
+
+ """def runFinished(self):
+ self.session.openWithCallback(self.reboot, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO)
+
+ def reboot(self, result):
+ if result is None:
+ return
+ if result:
+ quitMainloop(3)"""
+
+ def createBackupfolders(self):
+ print "Creating backup folder if not already there..."
+ self.backuppath = getBackupPath()
+ try:
+ if (os_path.exists(self.backuppath) == False):
+ makedirs(self.backuppath)
+ except OSError:
+ self.session.open(MessageBox, _("Sorry, your backup destination is not writeable.\n\nPlease choose another one."), MessageBox.TYPE_INFO)
+
+ def backupDone(self,retval = None):
+ if retval is True:
+ self.session.open(MessageBox, _("Backup done."), MessageBox.TYPE_INFO)
+ else:
+ self.session.open(MessageBox, _("Backup failed."), MessageBox.TYPE_INFO)
+
+ def startRestore(self, ret = False):
+ if (ret == True):
+ self.exe = True
+ self.session.open(RestoreScreen, runRestore = True)
+
+
+class IPKGSource(Screen):
+ skin = """
+ <screen position="100,100" size="550,60" title="IPKG source" >
+ <widget name="text" position="0,0" size="550,25" font="Regular;20" backgroundColor="background" foregroundColor="#cccccc" />
+ </screen>"""
+
+ def __init__(self, session, args = None):
+ Screen.__init__(self, session)
+ self.session = session
+
+ #FIXMEEEE add handling for more than one feed conf file!
+ text = ""
+ try:
+ fp = file('/etc/ipkg/official-feed.conf', 'r')
+ sources = fp.readlines()
+ if sources:
+ text = sources[0]
+ fp.close()
+ except IOError:
+ pass
+
+ self["text"] = Input(text, maxSize=False, type=Input.TEXT)
+
+ self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions"],
+ {
+ "ok": self.go,
+ "back": self.close,
+ "left": self.keyLeft,
+ "right": self.keyRight,
+ "home": self.keyHome,
+ "end": self.keyEnd,
+ "deleteForward": self.keyDeleteForward,
+ "deleteBackward": self.keyDeleteBackward,
+ "1": self.keyNumberGlobal,
+ "2": self.keyNumberGlobal,
+ "3": self.keyNumberGlobal,
+ "4": self.keyNumberGlobal,
+ "5": self.keyNumberGlobal,
+ "6": self.keyNumberGlobal,
+ "7": self.keyNumberGlobal,
+ "8": self.keyNumberGlobal,
+ "9": self.keyNumberGlobal,
+ "0": self.keyNumberGlobal
+ }, -1)
+
+ def go(self):
+ text = self["text"].getText()
+ if text:
+ fp = file('/etc/ipkg/official-feed.conf', 'w')
+ fp.write()
+ fp.close()
+ self.close()
+
+ def keyLeft(self):
+ self["text"].left()
+
+ def keyRight(self):
+ self["text"].right()
+
+ def keyHome(self):
+ self["text"].home()
+
+ def keyEnd(self):
+ self["text"].end()
+
+ def keyDeleteForward(self):
+ self["text"].delete()
+
+ def keyDeleteBackward(self):
+ self["text"].deleteBackward()
+
+ def keyNumberGlobal(self, number):
+ print "pressed", number
+ self["text"].number(number)
+
+
+class PacketManager(Screen):
+ skin = """
+ <screen position="90,80" size="530,420" title="IPKG upgrade..." >
+ <widget source="list" render="Listbox" position="5,10" size="520,365" scrollbarMode="showOnDemand">
+ <convert type="TemplatedMultiContent">
+ {"template": [
+ MultiContentEntryText(pos = (5, 1), size = (440, 28), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name
+ MultiContentEntryText(pos = (5, 26), size = (440, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description
+ MultiContentEntryPixmapAlphaTest(pos = (445, 2), size = (48, 48), png = 4), # index 4 is the status pixmap
+ MultiContentEntryPixmapAlphaTest(pos = (5, 50), size = (510, 2), png = 5), # index 4 is the div pixmap
+ ],
+ "fonts": [gFont("Regular", 22),gFont("Regular", 14)],
+ "itemHeight": 52
+ }
+ </convert>
+ </widget>
+ <ePixmap pixmap="skin_default/buttons/red.png" position="10,380" zPosition="2" size="140,40" transparent="1" alphatest="on" />
+ <widget name="closetext" position="20,390" size="140,21" zPosition="10" font="Regular;21" transparent="1" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="160,380" zPosition="2" size="140,40" transparent="1" alphatest="on" />
+ <widget name="reloadtext" position="170,390" size="300,21" zPosition="10" font="Regular;21" transparent="1" />
+ </screen>"""
+
+ def __init__(self, session, plugin_path, args = None):
+ Screen.__init__(self, session)
+ self.session = session
+ self.skin_path = plugin_path
+
+ self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"],
+ {
+ "ok": self.go,
+ "back": self.exit,
+ "red": self.exit,
+ "green": self.reload,
+ }, -1)
+
+ self.list = []
+ self.statuslist = []
+ self["list"] = List(self.list)
+ self["closetext"] = Label(_("Close"))
+ self["reloadtext"] = Label(_("Reload"))
+
+ self.list_updating = True
+ self.packetlist = []
+ self.installed_packetlist = {}
+ self.Console = Console()
+ self.cmdList = []
+ self.cachelist = []
+ self.cache_ttl = 86400 #600 is default, 0 disables, Seconds cache is considered valid (24h should be ok for caching ipkgs)
+ self.cache_file = '/usr/lib/enigma2/python/Plugins/SystemPlugins/SoftwareManager/packetmanager.cache' #Path to cache directory
+ self.oktext = _("\nAfter pressing OK, please wait!")
+
+ self.ipkg = IpkgComponent()
+ self.ipkg.addCallback(self.ipkgCallback)
+ self.onShown.append(self.setWindowTitle)
+ self.onLayoutFinish.append(self.rebuildList)
+
+ def exit(self):
+ self.ipkg.stop()
+ if self.Console is not None:
+ if len(self.Console.appContainers):
+ for name in self.Console.appContainers.keys():
+ self.Console.kill(name)
+ self.close()
+
+ def reload(self):
+ if (os_path.exists(self.cache_file) == True):
+ remove(self.cache_file)
+ self.list_updating = True
+ self.rebuildList()
+
+ def setWindowTitle(self):
+ self.setTitle(_("Packet manager"))
+
+ def setStatus(self,status = None):
+ if status:
+ self.statuslist = []
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
+ if status == 'update':
+ statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installable.png"))
+ self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'',statuspng, divpng ))
+ self['list'].setList(self.statuslist)
+ elif status == 'error':
+ statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installed.png"))
+ self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'',statuspng, divpng ))
+ self['list'].setList(self.statuslist)
+
+ def rebuildList(self):
+ self.setStatus('update')
+ self.inv_cache = 0
+ self.vc = valid_cache(self.cache_file, self.cache_ttl)
+ if self.cache_ttl > 0 and self.vc != 0:
+ try:
+ self.buildPacketList()
+ except:
+ self.inv_cache = 1
+ if self.cache_ttl == 0 or self.inv_cache == 1 or self.vc == 0:
+ self.run = 0
+ self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
+
+ def go(self, returnValue = None):
+ cur = self["list"].getCurrent()
+ if cur:
+ status = cur[3]
+ package = cur[0]
+ self.cmdList = []
+ if status == 'installed':
+ self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package }))
+ if len(self.cmdList):
+ self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n" + package + "\n" + self.oktext))
+ elif status == 'upgradeable':
+ self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package }))
+ if len(self.cmdList):
+ self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to upgrade the package:\n" + package + "\n" + self.oktext))
+ elif status == "installable":
+ self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package }))
+ if len(self.cmdList):
+ self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n" + package + "\n" + self.oktext))
+
+ def runRemove(self, result):
+ if result:
+ self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList)
+
+ def runRemoveFinished(self):
+ self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO)
+
+ def RemoveReboot(self, result):
+ if result is None:
+ return
+ if result is False:
+ cur = self["list"].getCurrent()
+ if cur:
+ item = self['list'].getIndex()
+ self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installable')
+ self.cachelist[item] = [cur[0], cur[1], cur[2], 'installable']
+ self['list'].setList(self.list)
+ write_cache(self.cache_file, self.cachelist)
+ self.reloadPluginlist()
+ if result:
+ quitMainloop(3)
+
+ def runUpgrade(self, result):
+ if result:
+ self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList)
+
+ def runUpgradeFinished(self):
+ self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO)
+
+ def UpgradeReboot(self, result):
+ if result is None:
+ return
+ if result is False:
+ cur = self["list"].getCurrent()
+ if cur:
+ item = self['list'].getIndex()
+ self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installed')
+ self.cachelist[item] = [cur[0], cur[1], cur[2], 'installed']
+ self['list'].setList(self.list)
+ write_cache(self.cache_file, self.cachelist)
+ self.reloadPluginlist()
+ if result:
+ quitMainloop(3)
+
+ def ipkgCallback(self, event, param):
+ if event == IpkgComponent.EVENT_ERROR:
+ self.list_updating = False
+ self.setStatus('error')
+ elif event == IpkgComponent.EVENT_DONE:
+ if self.list_updating:
+ self.list_updating = False
+ if not self.Console:
+ self.Console = Console()
+ cmd = "ipkg list"
+ self.Console.ePopen(cmd, self.IpkgList_Finished)
+ #print event, "-", param
+ pass
+
+ def IpkgList_Finished(self, result, retval, extra_args = None):
+ if len(result):
+ self.packetlist = []
+ for x in result.splitlines():
+ split = x.split(' - ')
+ if not (split[0].strip().endswith('-dbg') or split[0].strip().endswith('-dev')):
+ self.packetlist.append([split[0].strip(), split[1].strip(),split[2].strip()])
+ if not self.Console:
+ self.Console = Console()
+ cmd = "ipkg list_installed"
+ self.Console.ePopen(cmd, self.IpkgListInstalled_Finished)
+
+ def IpkgListInstalled_Finished(self, result, retval, extra_args = None):
+ if len(result):
+ self.installed_packetlist = {}
+ for x in result.splitlines():
+ split = x.split(' - ')
+ if not (split[0].strip().endswith('-dbg') or split[0].strip().endswith('-dev')):
+ self.installed_packetlist[split[0].strip()] = split[1].strip()
+ self.buildPacketList()
+
+ def buildEntryComponent(self, name, version, description, state):
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
+ if state == 'installed':
+ installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installed.png"))
+ return((name, version, description, state, installedpng, divpng))
+ elif state == 'upgradeable':
+ upgradeablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/upgradeable.png"))
+ return((name, version, description, state, upgradeablepng, divpng))
+ else:
+ installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installable.png"))
+ return((name, version, description, state, installablepng, divpng))
+
+ def buildPacketList(self):
+ self.list = []
+ self.cachelist = []
+
+ if self.cache_ttl > 0 and self.vc != 0:
+ print 'Loading packagelist cache from ',self.cache_file
+ try:
+ self.cachelist = load_cache(self.cache_file)
+ if len(self.cachelist) > 0:
+ for x in self.cachelist:
+ self.list.append(self.buildEntryComponent(x[0], x[1], x[2], x[3]))
+ self['list'].setList(self.list)
+ except:
+ self.inv_cache = 1
+
+ if self.cache_ttl == 0 or self.inv_cache == 1 or self.vc == 0:
+ print 'rebuilding fresh package list'
+ for x in self.packetlist:
+ status = ""
+ if self.installed_packetlist.has_key(x[0].strip()):
+ if self.installed_packetlist[x[0].strip()] == x[1].strip():
+ status = "installed"
+ self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status))
+ else:
+ status = "upgradeable"
+ self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status))
+ else:
+ status = "installable"
+ self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status))
+ if not (x[0].strip().endswith('-dbg') or x[0].strip().endswith('-dev')):
+ self.cachelist.append([x[0].strip(), x[1].strip(), x[2].strip(), status])
+ write_cache(self.cache_file, self.cachelist)
+ self['list'].setList(self.list)
+
+ def reloadPluginlist(self):
+ plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
+
+class UpdatePlugin(Screen):
+ skin = """
+ <screen position="100,100" size="550,200" title="Software Update..." >
+ <widget name="activityslider" position="0,0" size="550,5" />
+ <widget name="slider" position="0,100" size="550,30" />
+ <widget name="package" position="10,30" size="540,20" font="Regular;18"/>
+ <widget name="status" position="10,60" size="540,45" font="Regular;18"/>
+ </screen>"""
+
+ def __init__(self, session, args = None):
+ self.skin = UpdatePlugin.skin
+ Screen.__init__(self, session)
+
+ self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }
+
+ self.slider = Slider(0, 4)
+ self["slider"] = self.slider
+ self.activityslider = Slider(0, 100)
+ self["activityslider"] = self.activityslider
+ self.status = Label(_("Upgrading Dreambox... Please wait"))
+ self["status"] = self.status
+ self.package = Label()
+ self["package"] = self.package
+
+ self.packages = 0
+ self.error = 0
+
+ self.activity = 0
+ self.activityTimer = eTimer()
+ self.activityTimer.callback.append(self.doActivityTimer)
+ self.activityTimer.start(100, False)
+
+ self.ipkg = IpkgComponent()
+ self.ipkg.addCallback(self.ipkgCallback)
+
+ self.updating = True
+ self.package.setText(_("Package list update"))
+ self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
+
+ self["actions"] = ActionMap(["WizardActions"],
+ {
+ "ok": self.exit,
+ "back": self.exit
+ }, -1)
+
+ def doActivityTimer(self):
+ self.activity += 1
+ if self.activity == 100:
+ self.activity = 0
+ self.activityslider.setValue(self.activity)
+
+ def ipkgCallback(self, event, param):
+ if event == IpkgComponent.EVENT_DOWNLOAD:
+ self.status.setText(_("Downloading"))
+ 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 == IpkgComponent.EVENT_INSTALL:
+ self.package.setText(param)
+ self.status.setText(_("Installing"))
+ self.packages += 1
+ elif event == IpkgComponent.EVENT_CONFIGURING:
+ self.package.setText(param)
+ self.status.setText(_("Configuring"))
+ elif event == IpkgComponent.EVENT_MODIFIED:
+ self.session.openWithCallback(
+ self.modificationCallback,
+ MessageBox,
+ _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param)
+ )
+ elif event == IpkgComponent.EVENT_ERROR:
+ self.error += 1
+ elif event == IpkgComponent.EVENT_DONE:
+ if self.updating:
+ self.updating = False
+ self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = {'test_only': False})
+ elif self.error == 0:
+ self.slider.setValue(4)
+
+ self.activityTimer.stop()
+ self.activityslider.setValue(0)
+
+ self.package.setText("")
+ self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages)
+ else:
+ self.activityTimer.stop()
+ self.activityslider.setValue(0)
+ error = _("your dreambox might be unusable now. Please consult the manual for further assistance before rebooting your dreambox.")
+ if self.packages == 0:
+ error = _("No packages were upgraded yet. So you can check your network and try again.")
+ if self.updating:
+ error = _("Your dreambox isn't connected to the internet properly. Please check it and try again.")
+ self.status.setText(_("Error") + " - " + error)
+ #print event, "-", param
+ pass
+
+ def modificationCallback(self, res):
+ self.ipkg.write(res and "N" or "Y")
+
+ def exit(self):
+ 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:
+ quitMainloop(2)
+ self.close()
+
+
+
+class IpkgInstaller(Screen):
+ skin = """
+ <screen position="100,100" size="550,400" title="..." >
+ <widget name="red" halign="center" valign="center" position="0,0" size="140,60" backgroundColor="red" font="Regular;21" />
+ <widget name="green" halign="center" valign="center" position="140,0" text="Install selected" size="140,60" backgroundColor="green" font="Regular;21" />
+ <widget name="yellow" halign="center" valign="center" position="280,0" size="140,60" backgroundColor="yellow" font="Regular;21" />
+ <widget name="blue" halign="center" valign="center" position="420,0" size="140,60" backgroundColor="blue" font="Regular;21" />
+ <widget name="list" position="0,60" size="550,360" />
+ </screen>
+ """
+
+ def __init__(self, session, list):
+ self.skin = IpkgInstaller.skin
+ Screen.__init__(self, session)
+
+ self.list = SelectionList()
+ self["list"] = self.list
+ for listindex in range(len(list)):
+ self.list.addSelection(list[listindex], list[listindex], listindex, True)
+
+ self["red"] = Label()
+ self["green"] = Label()
+ self["yellow"] = Label()
+ self["blue"] = Label()
+
+ self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
+ {
+ "ok": self.list.toggleSelection,
+ "cancel": self.close,
+ "green": self.install
+ }, -1)
+
+ def install(self):
+ list = self.list.getSelectionsList()
+ cmdList = []
+ for item in list:
+ cmdList.append((IpkgComponent.CMD_INSTALL, { "package": item[1] }))
+ self.session.open(Ipkg, cmdList = cmdList)
+
+def filescan_open(list, session, **kwargs):
+ filelist = [x.path for x in list]
+ session.open(IpkgInstaller, filelist) # list
+
+def filescan(**kwargs):
+ from Components.Scanner import Scanner, ScanPath
+ return \
+ Scanner(mimetypes = ["application/x-debian-package"],
+ paths_to_scan =
+ [
+ ScanPath(path = "ipk", with_subdirs = True),
+ ScanPath(path = "", with_subdirs = False),
+ ],
+ name = "Ipkg",
+ description = "Install software updates...",
+ openfnc = filescan_open, )
+
+def UpgradeMain(session, **kwargs):
+ session.open(UpdatePluginMenu)
+
+def startSetup(menuid):
+ if menuid != "setup":
+ return [ ]
+ return [(_("Software manager") + "...", UpgradeMain, "software_manager", 50)]
+
+def Plugins(path, **kwargs):
+ global plugin_path
+ plugin_path = path
+ list = [
+ PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup),
+ PluginDescriptor(name=_("Ipkg"), where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)
+ ]
+ if config.usage.setup_level.index >= 2: # expert+
+ list.append(PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=UpgradeMain))
+ return list
diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/red.png b/lib/python/Plugins/SystemPlugins/SoftwareManager/red.png
index 8096045f..8096045f 100644..100755
--- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/red.png
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/red.png
Binary files differ
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/update.png b/lib/python/Plugins/SystemPlugins/SoftwareManager/update.png
index 0ece6c76..0ece6c76 100644..100755
--- a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/update.png
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/update.png
Binary files differ
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/upgradeable.png b/lib/python/Plugins/SystemPlugins/SoftwareManager/upgradeable.png
new file mode 100755
index 00000000..edbbdee1
--- /dev/null
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/upgradeable.png
Binary files differ
diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/yellow.png b/lib/python/Plugins/SystemPlugins/SoftwareManager/yellow.png
index dacb80e6..dacb80e6 100644..100755
--- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/yellow.png
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/yellow.png
Binary files differ
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/.cvsignore b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/.cvsignore
deleted file mode 100644
index 138b9cc2..00000000
--- a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.pyc
-*.pyo
-Makefile
-Makefile.in
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/Makefile.am b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/Makefile.am
deleted file mode 100644
index 9848f3df..00000000
--- a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/SoftwareUpdate
-
-install_PYTHON = \
- __init__.py \
- plugin.py \
- update.png
-
-
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/__init__.py b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/__init__.py
+++ /dev/null
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py
deleted file mode 100644
index 8127514c..00000000
--- a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py
+++ /dev/null
@@ -1,360 +0,0 @@
-from Components.ActionMap import ActionMap, NumberActionMap
-from Components.GUIComponent import GUIComponent
-from Components.Input import Input
-from Components.Ipkg import IpkgComponent
-from Components.Label import Label
-from Components.MenuList import MenuList
-from Components.Slider import Slider
-from Plugins.Plugin import PluginDescriptor
-from Screens.Console import Console
-from Screens.ImageWizard import ImageWizard
-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
-
-
-class UpdatePluginMenu(Screen):
- skin = """
- <screen position="200,100" size="300,250" title="Update..." >
- <widget name="menu" position="10,10" size="290,175" scrollbarMode="showOnDemand" />
- </screen>"""
-
- def __init__(self, session, args = 0):
- self.skin = UpdatePluginMenu.skin
- Screen.__init__(self, session)
-
- self.menu = args
-
- list = []
- if self.menu == 0:
- list.append((_("Image-Upgrade"), "image"))
- list.append((_("Online-Upgrade"), "upgrade"))
- list.append((_("Advanced"), "advanced"))
- elif self.menu == 1:
- list.append((_("Choose source"), "source"))
- list.append((_("Packet management"), "ipkg"))
- list.append((_("Settings"), "setup"))
-
- self["menu"] = MenuList(list)
-
- self["actions"] = ActionMap(["WizardActions", "DirectionActions"],
- {
- "ok": self.go,
- "back": self.close,
- }, -1)
-
- def go(self):
- if self.menu == 0:
- if (self["menu"].l.getCurrentSelection()[1] == "image"):
- self.session.open(ImageWizard)
- if (self["menu"].l.getCurrentSelection()[1] == "upgrade"):
- self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!"))
- if (self["menu"].l.getCurrentSelection()[1] == "advanced"):
- self.session.open(UpdatePluginMenu, 1)
- if self.menu == 1:
- if (self["menu"].l.getCurrentSelection()[1] == "source"):
- self.session.open(IPKGSource)
- elif (self["menu"].l.getCurrentSelection()[1] == "ipkg"):
- self.session.open(Ipkg)
- elif (self["menu"].l.getCurrentSelection()[1] == "setup"):
- self.session.open(MessageBox, _("Function not yet implemented"), MessageBox.TYPE_ERROR)
-
- def runUpgrade(self, result):
- if result:
- self.session.open(Console, title = "Upgrade running...", cmdlist = ["ipkg update", "ipkg upgrade -force-defaults -force-overwrite"], finishedCallback = self.runFinished)
-
- def runFinished(self):
- self.session.openWithCallback(self.reboot, MessageBox, _("Upgrade finished. Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO)
-
- def reboot(self, result):
- if result is None:
- return
- if result:
- quitMainloop(3)
-
-class IPKGSource(Screen):
- skin = """
- <screen position="100,100" size="550,60" title="IPKG source" >
- <widget name="text" position="0,0" size="550,25" font="Regular;20" />
- </screen>"""
-
- def __init__(self, session, args = None):
- self.skin = IPKGSource.skin
- Screen.__init__(self, session)
-
- fp = file('/etc/ipkg/official-feed.conf', 'r')
- sources = fp.readlines()
- fp.close()
-
- self["text"] = Input(sources[0], maxSize=False, type=Input.TEXT)
-
- self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions"],
- {
- "ok": self.go,
- "back": self.close,
- "left": self.keyLeft,
- "right": self.keyRight,
- "home": self.keyHome,
- "end": self.keyEnd,
- "deleteForward": self.deleteForward,
- "deleteBackward": self.deleteBackward,
- "1": self.keyNumberGlobal,
- "2": self.keyNumberGlobal,
- "3": self.keyNumberGlobal,
- "4": self.keyNumberGlobal,
- "5": self.keyNumberGlobal,
- "6": self.keyNumberGlobal,
- "7": self.keyNumberGlobal,
- "8": self.keyNumberGlobal,
- "9": self.keyNumberGlobal,
- "0": self.keyNumberGlobal
- }, -1)
-
- def go(self):
- fp = file('/etc/ipkg/official-feed.conf', 'w')
- fp.write(self["text"].getText())
- fp.close()
- self.close()
-
- def keyLeft(self):
- self["text"].left()
-
- def keyRight(self):
- self["text"].right()
-
- def keyHome(self):
- self["text"].home()
-
- def keyEnd(self):
- self["text"].end()
-
- def keyDeleteForward(self):
- self["text"].delete()
-
- def keyDeleteBackward(self):
- self["text"].deleteBackward()
-
- def keyNumberGlobal(self, number):
- print "pressed", number
- self["text"].number(number)
-
-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 Ipkg2(Screen):
- skin = """
- <screen position="100,100" size="550,400" title="IPKG upgrade..." >
- <widget name="list" position="0,0" size="550,400" scrollbarMode="showOnDemand" />
- </screen>"""
-
- 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 = popen("ipkg list", "r").readlines()
- packetlist = []
- for x in lines:
- split = x.split(' - ')
- packetlist.append([split[0].strip(), split[1].strip()])
-
- lines = 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 = 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()
-
-class UpdatePlugin(Screen):
- skin = """
- <screen position="100,100" size="550,200" title="Software Update..." >
- <widget name="activityslider" position="0,0" size="550,5" />
- <widget name="slider" position="0,100" size="550,30" />
- <widget name="package" position="10,30" size="540,20" font="Regular;18"/>
- <widget name="status" position="10,60" size="540,45" font="Regular;18"/>
- </screen>"""
-
- def __init__(self, session, args = None):
- self.skin = UpdatePlugin.skin
- Screen.__init__(self, session)
-
- self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }
-
- self.slider = Slider(0, 4)
- self["slider"] = self.slider
- self.activityslider = Slider(0, 100)
- self["activityslider"] = self.activityslider
- self.status = Label(_("Upgrading Dreambox... Please wait"))
- self["status"] = self.status
- self.package = Label()
- self["package"] = self.package
-
- self.packages = 0
- self.error = 0
-
- self.activity = 0
- self.activityTimer = eTimer()
- self.activityTimer.callback.append(self.doActivityTimer)
- self.activityTimer.start(100, False)
-
- self.ipkg = IpkgComponent()
- self.ipkg.addCallback(self.ipkgCallback)
-
- self.updating = True
- self.package.setText(_("Package list update"))
- self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
-
- self["actions"] = ActionMap(["WizardActions"],
- {
- "ok": self.exit,
- "back": self.exit
- }, -1)
-
- def doActivityTimer(self):
- self.activity += 1
- if self.activity == 100:
- self.activity = 0
- self.activityslider.setValue(self.activity)
-
- def ipkgCallback(self, event, param):
- if event == IpkgComponent.EVENT_DOWNLOAD:
- self.status.setText(_("Downloading"))
- 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 == IpkgComponent.EVENT_INSTALL:
- self.package.setText(param)
- self.status.setText(_("Installing"))
- self.packages += 1
- elif event == IpkgComponent.EVENT_CONFIGURING:
- self.package.setText(param)
- self.status.setText(_("Configuring"))
- elif event == IpkgComponent.EVENT_MODIFIED:
- self.session.openWithCallback(
- self.modificationCallback,
- MessageBox,
- _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param)
- )
- elif event == IpkgComponent.EVENT_ERROR:
- self.error += 1
- elif event == IpkgComponent.EVENT_DONE:
- if self.updating:
- self.updating = False
- self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = {'test_only': False})
- elif self.error == 0:
- self.slider.setValue(4)
-
- self.activityTimer.stop()
- self.activityslider.setValue(0)
-
- self.package.setText("")
- self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages)
- else:
- self.activityTimer.stop()
- self.activityslider.setValue(0)
- error = _("your dreambox might be unusable now. Please consult the manual for further assistance before rebooting your dreambox.")
- if self.packages == 0:
- error = _("No packages were upgraded yet. So you can check your network and try again.")
- if self.updating:
- error = _("Your dreambox isn't connected to the internet properly. Please check it and try again.")
- self.status.setText(_("Error") + " - " + error)
- #print event, "-", param
- pass
-
- def modificationCallback(self, res):
- self.ipkg.write(res and "N" or "Y")
-
- def exit(self):
- 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:
- quitMainloop(2)
- self.close()
-
-def UpgradeMain(session, **kwargs):
- session.open(UpdatePlugin)
-
-def Plugins(**kwargs):
- return PluginDescriptor(name="Softwareupdate", description=_("Updates your receiver's software"), icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=UpgradeMain)