From eaa8bc374ff5eca1bb3caf9517dc6772cae34dd6 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 19 Dec 2006 07:19:55 +0000 Subject: add IpkgInstaller Media Scanner plugin --- .../Plugins/Extensions/IpkgInstaller/Makefile.am | 5 ++ .../Plugins/Extensions/IpkgInstaller/__init__.py | 0 .../Plugins/Extensions/IpkgInstaller/plugin.py | 69 ++++++++++++++++++++++ lib/python/Plugins/Extensions/Makefile.am | 2 +- 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 lib/python/Plugins/Extensions/IpkgInstaller/Makefile.am create mode 100644 lib/python/Plugins/Extensions/IpkgInstaller/__init__.py create mode 100644 lib/python/Plugins/Extensions/IpkgInstaller/plugin.py (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/IpkgInstaller/Makefile.am b/lib/python/Plugins/Extensions/IpkgInstaller/Makefile.am new file mode 100644 index 00000000..ece0698f --- /dev/null +++ b/lib/python/Plugins/Extensions/IpkgInstaller/Makefile.am @@ -0,0 +1,5 @@ +installdir = $(LIBDIR)/enigma2/python/Plugins/Extensions/IpkgInstaller + +install_PYTHON = \ + __init__.py \ + plugin.py diff --git a/lib/python/Plugins/Extensions/IpkgInstaller/__init__.py b/lib/python/Plugins/Extensions/IpkgInstaller/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lib/python/Plugins/Extensions/IpkgInstaller/plugin.py b/lib/python/Plugins/Extensions/IpkgInstaller/plugin.py new file mode 100644 index 00000000..f6dfc965 --- /dev/null +++ b/lib/python/Plugins/Extensions/IpkgInstaller/plugin.py @@ -0,0 +1,69 @@ +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 = """ + + + + + + + + """ + + 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): + session.open(IpkgInstaller, list) # list + +def filescan(): + # we expect not to be called if the MediaScanner plugin is not available, + # thus we don't catch an ImportError exception here + from Plugins.Extensions.MediaScanner.plugin import Scanner, ScanPath + return \ + Scanner(extensions = ["ipk"], + 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) ] \ No newline at end of file diff --git a/lib/python/Plugins/Extensions/Makefile.am b/lib/python/Plugins/Extensions/Makefile.am index 92251841..86834701 100644 --- a/lib/python/Plugins/Extensions/Makefile.am +++ b/lib/python/Plugins/Extensions/Makefile.am @@ -1,2 +1,2 @@ -SUBDIRS = TuxboxPlugins WebInterface FileManager CutListEditor FritzCall PicturePlayer MediaScanner +SUBDIRS = TuxboxPlugins WebInterface FileManager CutListEditor FritzCall PicturePlayer MediaScanner IpkgInstaller # SimpleRSS is still not finished -- cgit v1.2.3