From: Mladen Horvat Date: Mon, 7 Dec 2009 13:22:39 +0000 (+0100) Subject: Merge commit 'origin/bug_308_add_where_softwaremanager' into experimental X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=28d283c49a8791cc84d70877275f232d5cb526ce;hp=9fba96095af3d4a6b1b596893f4e005dc0b6f16d Merge commit 'origin/bug_308_add_where_softwaremanager' into experimental Conflicts: lib/python/Plugins/Plugin.py --- diff --git a/lib/python/Plugins/Plugin.py b/lib/python/Plugins/Plugin.py index dc68ebf..7cf0c18 100755 --- a/lib/python/Plugins/Plugin.py +++ b/lib/python/Plugins/Plugin.py @@ -54,6 +54,12 @@ class PluginDescriptor: WHERE_AUDIOMENU = 13 + # fnc 'SoftwareSupported' or 'AdvancedSoftwareSupported' must take a parameter and return None + # if the plugin should not be displayed inside Softwaremanger or return a function which is called with session + # and 'None' as parameter to call the plugin from the Softwaremanager menus. "menuEntryName" and "menuEntryDescription" + # should be provided to name and describe the new menu entry. + WHERE_SOFTWAREMANAGER = 14 + def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, internal = False): self.name = name self.internal = internal diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py b/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py old mode 100644 new mode 100755 index 40914e1..28b3330 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py @@ -1,20 +1,28 @@ +from Plugins.Plugin import PluginDescriptor +from Tools.HardwareInfo import HardwareInfo +from Tools.Directories import fileExists +from downloader import NFIDownload, filescan + +def NFIFlasherMain(session, tmp = None, **kwargs): + session.open(NFIDownload, "/home/root" ) + +def NFICallFnc(tmp = None): + return NFIFlasherMain + def Plugins(**kwargs): - from Plugins.Plugin import PluginDescriptor - from Tools.HardwareInfo import HardwareInfo # currently only available for DM8000 if HardwareInfo().get_device_name() != "dm8000": return [PluginDescriptor()] - from Tools.Directories import fileExists if fileExists("/usr/share/bootlogo-flasher.mvi"): import flasher # started from usb stick # don't try to be intelligent and trick this - it's not possible to rewrite the flash memory with a system currently booted from it return [PluginDescriptor(where = PluginDescriptor.WHERE_WIZARD, fnc = (9,flasher.NFIFlash))] else: # started on real enigma2 - import downloader - return [PluginDescriptor(name="NFI Image Flashing", - description = _("Download .NFI-Files for USB-Flasher"), + return [PluginDescriptor(name=_("NFI Image Flashing"), + description=_("Download .NFI-Files for USB-Flasher"), icon = "flash.png", - where = [PluginDescriptor.WHERE_PLUGINMENU], - fnc = downloader.main), PluginDescriptor(name="nfi", where = PluginDescriptor.WHERE_FILESCAN, fnc = downloader.filescan) - ] + where = PluginDescriptor.WHERE_SOFTWAREMANAGER, + fnc={"SoftwareSupported": NFICallFnc, "menuEntryName": lambda x: _("NFI Image Flashing"), + "menuEntryDescription": lambda x: _("Download .NFI-Files for USB-Flasher")}), + PluginDescriptor(name="nfi", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)] diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index ee3bbe1..c70201b 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -108,21 +108,47 @@ class UpdatePluginMenu(Screen): 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(("install-plugins", _("Install extensions"), _("\nInstall new Extensions or Plugins to your dreambox" ) + 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)) - self.list.append(("ipkg-install", _("Install local extension"), _("\nScan for local packages and install them." ) + self.oktext)) + self.list.append(("software-update", _("Software update"), _("\nOnline update of your Dreambox software." ) + self.oktext, None)) + #self.list.append(("install-plugins", _("Install extensions"), _("\nInstall new Extensions or Plugins to your dreambox" ) + self.oktext, None)) + self.list.append(("software-restore", _("Software restore"), _("\nRestore your Dreambox with a new firmware." ) + self.oktext, None)) + self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext, None)) + self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your Dreambox settings." ) + self.oktext, None)) + self.list.append(("ipkg-install", _("Install local extension"), _("\nScan for local packages and install them." ) + self.oktext, None)) + for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): + if p.__call__.has_key("SoftwareSupported"): + callFnc = p.__call__["SoftwareSupported"](None) + if callFnc is not None: + if p.__call__.has_key("menuEntryName"): + menuEntryName = p.__call__["menuEntryName"](None) + else: + menuEntryName = _('Extended Software') + if p.__call__.has_key("menuEntryDescription"): + menuEntryDescription = p.__call__["menuEntryDescription"](None) + else: + menuEntryDescription = _('Extended Software Plugin') + self.list.append(('default-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc)) if config.usage.setup_level.index >= 2: # expert+ - self.list.append(("advanced", _("Advanced Options"), _("\nAdvanced options and settings." ) + self.oktext)) + self.list.append(("advanced", _("Advanced Options"), _("\nAdvanced options and settings." ) + self.oktext, None)) elif self.menu == 1: - 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(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext, None)) + self.list.append(("backuplocation", _("Choose backup location"), _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext, None)) + self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup. Currently selected:\n" ) + self.backupdirs + self.oktext, None)) if config.usage.setup_level.index >= 2: # expert+ - self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext)) - self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext)) + self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext, None)) + self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext, None)) + for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): + if p.__call__.has_key("AdvancedSoftwareSupported"): + callFnc = p.__call__["AdvancedSoftwareSupported"](None) + if callFnc is not None: + if p.__call__.has_key("menuEntryName"): + menuEntryName = p.__call__["menuEntryName"](None) + else: + menuEntryName = _('Advanced Software') + if p.__call__.has_key("menuEntryDescription"): + menuEntryDescription = p.__call__["menuEntryDescription"](None) + else: + menuEntryDescription = _('Advanced Software Plugin') + self.list.append(('advanced-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc)) self["menu"] = List(self.list) self["key_red"] = StaticText(_("Close")) @@ -150,33 +176,36 @@ class UpdatePluginMenu(Screen): def go(self): current = self["menu"].getCurrent() if current: - current = current[0] + currentEntry = current[0] if self.menu == 0: - if (current == "software-update"): + if (currentEntry == "software-update"): self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your Dreambox?")+"\n"+_("\nAfter pressing OK, please wait!")) - elif (current == "software-restore"): + elif (currentEntry == "software-restore"): self.session.open(ImageWizard) - elif (current == "install-plugins"): + elif (currentEntry == "install-plugins"): self.session.open(PluginManager, self.skin_path) - elif (current == "system-backup"): + elif (currentEntry == "system-backup"): self.session.openWithCallback(self.backupDone,BackupScreen, runBackup = True) - elif (current == "system-restore"): + elif (currentEntry == "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, timeout = 10) - elif (current == "ipkg-install"): + elif (currentEntry == "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, timeout = 10) - elif (current == "advanced"): + elif (currentEntry == "default-plugin"): + self.extended = current[3] + self.extended(self.session, None) + elif (currentEntry == "advanced"): self.session.open(UpdatePluginMenu, 1) elif self.menu == 1: - if (current == "ipkg-manager"): + if (currentEntry == "ipkg-manager"): self.session.open(PacketManager, self.skin_path) - elif (current == "backuplocation"): + elif (currentEntry == "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] == '/': @@ -186,12 +215,15 @@ class UpdatePluginMenu(Screen): 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"): + elif (currentEntry == "backupfiles"): self.session.openWithCallback(self.backupfiles_choosen,BackupSelection) - elif (current == "advancedrestore"): + elif (currentEntry == "advancedrestore"): self.session.open(RestoreMenu, self.skin_path) - elif (current == "ipkg-source"): + elif (currentEntry == "ipkg-source"): self.session.open(IPKGMenu, self.skin_path) + elif (currentEntry == "advanced-plugin"): + self.extended = current[3] + self.extended(self.session, None) def backupfiles_choosen(self, ret): self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value )