Merge commit 'origin/bug_449_fix_wlan_usbstick_recognition'
[enigma2.git] / lib / python / Components / SelectionList.py
old mode 100644 (file)
new mode 100755 (executable)
index a4f1d71..1c5423f
@@ -1,13 +1,15 @@
 from MenuList import MenuList
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
 from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT
 from Tools.LoadPixmap import LoadPixmap
 
-selectionpng = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/selectioncross.png"))
+selectionpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "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] ]
+