aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/SelectionList.py
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2009-02-24 20:56:21 +0100
committerghost <andreas.monzner@multimedia-labs.de>2009-02-24 20:56:21 +0100
commit574f425cc1ebece0aa5f09fb77a8cb7ad0310a1f (patch)
treee2ded87bb0e66cd9e88ae8d4ffc3846f788343bf /lib/python/Components/SelectionList.py
parent5a6bde9419249a78c957093e0cc438d7c6eeb46c (diff)
downloadenigma2-574f425cc1ebece0aa5f09fb77a8cb7ad0310a1f.tar.gz
enigma2-574f425cc1ebece0aa5f09fb77a8cb7ad0310a1f.zip
small optimizations and cleanups by Moritz Venn
Diffstat (limited to 'lib/python/Components/SelectionList.py')
-rw-r--r--lib/python/Components/SelectionList.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/python/Components/SelectionList.py b/lib/python/Components/SelectionList.py
index a4f1d71a..08af7d02 100644
--- a/lib/python/Components/SelectionList.py
+++ b/lib/python/Components/SelectionList.py
@@ -6,8 +6,10 @@ from Tools.LoadPixmap import LoadPixmap
selectionpng = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/selectioncross.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))
+ res = [
+ (description, value, index, selected),
+ (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
@@ -23,13 +25,11 @@ class SelectionList(MenuList):
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])
+ idx = self.getSelectedIndex()
+ item = self.list[idx][0]
+ self.list[idx] = 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
+ return [ (item[0][0], item[0][1], item[0][2]) for item in self.list if item[0][3] ]
+