diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-01-25 12:09:25 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-01-25 12:09:25 +0000 |
| commit | 1681d7dadff09e071c4f79954a90969fb7815210 (patch) | |
| tree | deb99c3bb93e7e494b780905c7be36cecafc306b /lib/python/Components | |
| parent | 738adbb747be92f19cd7864490c982cac558358c (diff) | |
| download | enigma2-1681d7dadff09e071c4f79954a90969fb7815210.tar.gz enigma2-1681d7dadff09e071c4f79954a90969fb7815210.zip | |
add selchanged signal to listbox
Diffstat (limited to 'lib/python/Components')
| -rw-r--r-- | lib/python/Components/EpgList.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/python/Components/EpgList.py b/lib/python/Components/EpgList.py index 26d712e6..cc5bc619 100644 --- a/lib/python/Components/EpgList.py +++ b/lib/python/Components/EpgList.py @@ -42,7 +42,10 @@ class Rect: return self.__width class EPGList(HTMLComponent, GUIComponent): - def __init__(self, type=EPG_TYPE_SINGLE): + def __init__(self, type=EPG_TYPE_SINGLE, selChangedCB=None): + self.onSelChanged = [ ] + if selChangedCB is not None: + self.onSelChanged.append(selChangedCB) GUIComponent.__init__(self) self.type=type if type == EPG_TYPE_SINGLE and SINGLE_CPP > 0: @@ -78,8 +81,24 @@ class EPGList(HTMLComponent, GUIComponent): def moveDown(self): self.instance.moveSelection(self.instance.moveDown) + def connectSelectionChanged(func): + if not self.onSelChanged.count(func): + self.onSelChanged.append(func) + + def disconnectSelectionChanged(func): + self.onSelChanged.remove(func) + + def selectionChanged(self): + for x in self.onSelChanged: + if x is not None: + try: + x() + except: + pass + def GUIcreate(self, parent): self.instance = eListbox(parent) + self.instance.selectionChanged.get().append(self.selectionChanged) self.instance.setContent(self.l) if SINGLE_CPP > 0: self.instance.setItemHeight(25) @@ -191,6 +210,7 @@ class EPGList(HTMLComponent, GUIComponent): cnt+=1 self.l.setList(self.list) print time() - t + self.selectionChanged() def fillSingleEPG(self, service): t = time() |
