diff options
| author | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2006-12-19 07:19:55 +0000 |
|---|---|---|
| committer | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2006-12-19 07:19:55 +0000 |
| commit | eaa8bc374ff5eca1bb3caf9517dc6772cae34dd6 (patch) | |
| tree | 5268b8c6a858b4343dce4131261bd2bc5cdcb286 /lib/python/Plugins/Extensions/IpkgInstaller/plugin.py | |
| parent | 0ccffb6b503d7a285f3d5f7d7e44999d6eb60784 (diff) | |
| download | enigma2-eaa8bc374ff5eca1bb3caf9517dc6772cae34dd6.tar.gz enigma2-eaa8bc374ff5eca1bb3caf9517dc6772cae34dd6.zip | |
add IpkgInstaller Media Scanner plugin
Diffstat (limited to 'lib/python/Plugins/Extensions/IpkgInstaller/plugin.py')
| -rw-r--r-- | lib/python/Plugins/Extensions/IpkgInstaller/plugin.py | 69 |
1 files changed, 69 insertions, 0 deletions
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 = """ + <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): + 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 |
