Merge branch 'obi/master'
[enigma2.git] / lib / python / Components / Converter / MenuEntryCompare.py
1 from Components.Converter.Converter import Converter
2 from Components.Element import cached
3
4 class MenuEntryCompare(Converter, object):
5         def __init__(self, type):
6                 Converter.__init__(self, type)
7                 self.entry_id = type
8
9         def selChanged(self):
10                 self.downstream_elements.changed((self.CHANGED_ALL, 0))
11
12         @cached
13         def getBool(self):
14                 id = self.entry_id
15                 cur = self.source.current
16                 if cur and len(cur) > 2:
17                         EntryID = cur[2]
18                         return EntryID and id and id == EntryID
19                 return False
20
21         boolean = property(getBool)
22
23         def changed(self, what):
24                 if what[0] == self.CHANGED_DEFAULT:
25                         self.source.onSelectionChanged.append(self.selChanged)
26                 Converter.changed(self, what)