diff options
Diffstat (limited to 'lib/python/Components')
| -rw-r--r-- | lib/python/Components/Ipkg.py | 39 | ||||
| -rw-r--r-- | lib/python/Components/Makefile.am | 2 | ||||
| -rw-r--r-- | lib/python/Components/SelectionList.py | 43 |
3 files changed, 63 insertions, 21 deletions
diff --git a/lib/python/Components/Ipkg.py b/lib/python/Components/Ipkg.py index df700d6b..dbc99653 100644 --- a/lib/python/Components/Ipkg.py +++ b/lib/python/Components/Ipkg.py @@ -1,6 +1,6 @@ from enigma import eConsoleAppContainer -class Ipkg: +class IpkgComponent: EVENT_INSTALL = 0 EVENT_DOWNLOAD = 1 EVENT_INFLATING = 2 @@ -35,25 +35,24 @@ class Ipkg: print "executing", self.ipkg, cmd self.cmd.execute(self.ipkg + " " + cmd) - def cmdFetchList(self, installed_only = False): - self.fetchedList = [] - if installed_only: - self.runCmd("list_installed") - else: - self.runCmd("list") - self.setCurrentCommand(self.CMD_LIST) - - def cmdUpgrade(self, test_only = False): - append = "" - if test_only: - append = " -test" - self.runCmd("upgrade" + append) - self.setCurrentCommand(self.CMD_UPGRADE) - - def cmdUpdate(self): - self.runCmd("update") - self.setCurrentCommand(self.CMD_UPDATE) - + def startCmd(self, cmd, args = None): + if cmd == self.CMD_UPDATE: + self.runCmd("update") + elif cmd == self.CMD_UPGRADE: + append = "" + if args["test_only"]: + append = " -test" + self.runCmd("upgrade" + append) + elif cmd == self.CMD_LIST: + self.fetchedList = [] + if args['installed_only']: + self.runCmd("list_installed") + else: + self.runCmd("list") + elif cmd == self.CMD_INSTALL: + self.runCmd("install " + args['package']) + self.setCurrentCommand(cmd) + def cmdFinished(self, retval): self.callCallbacks(self.EVENT_DONE) diff --git a/lib/python/Components/Makefile.am b/lib/python/Components/Makefile.am index b51d53fd..9de7984a 100644 --- a/lib/python/Components/Makefile.am +++ b/lib/python/Components/Makefile.am @@ -17,4 +17,4 @@ install_PYTHON = \ FIFOList.py ServiceEventTracker.py Input.py TimerSanityCheck.py FileList.py \ MultiContent.py MediaPlayer.py TunerInfo.py VideoWindow.py ChoiceList.py \ Element.py Playlist.py ParentalControl.py ParentalControlList.py \ - Ipkg.py + Ipkg.py SelectionList.py diff --git a/lib/python/Components/SelectionList.py b/lib/python/Components/SelectionList.py new file mode 100644 index 00000000..1500254a --- /dev/null +++ b/lib/python/Components/SelectionList.py @@ -0,0 +1,43 @@ +from GUIComponent import GUIComponent +from MenuList import MenuList +from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE +from enigma import eListboxPythonMultiContent, loadPNG, eListbox, gFont, RT_HALIGN_LEFT + +selectionpng = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "selectioncross-fs8.png")) + +def SelectionEntryComponent(description, value, index, selected): + res = [ (description, value, index, selected) ] + res.append((eListboxPythonMultiContent.TYPE_TEXT, 30, 3, 500, 30, 0, RT_HALIGN_LEFT, description)) + if selected: + res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 30, 30, selectionpng)) + return res + +class SelectionList(MenuList, GUIComponent): + def __init__(self, list = []): + GUIComponent.__init__(self) + self.l = eListboxPythonMultiContent() + self.list = list + self.setList(list) + self.l.setFont(0, gFont("Regular", 20)) + + GUI_WIDGET = eListbox + + def postWidgetCreate(self, instance): + instance.setContent(self.l) + instance.setItemHeight(30) + + def addSelection(self, description, value, index, selected = True): + self.list.append(SelectionEntryComponent(description, value, index, selected)) + self.setList(self.list) + + def toggleSelection(self): + item = self.list[self.getSelectedIndex()][0] + self.list[self.getSelectedIndex()] = SelectionEntryComponent(item[0], item[1], item[2], not item[3]) + self.setList(self.list) + + def getSelectionsList(self): + list = [] + for item in self.list: + if item[0][3]: + list.append((item[0][0], item[0][1], item[0][2])) + return list
\ No newline at end of file |
