aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-01-25 12:09:25 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-01-25 12:09:25 +0000
commit1681d7dadff09e071c4f79954a90969fb7815210 (patch)
treedeb99c3bb93e7e494b780905c7be36cecafc306b /lib/python
parent738adbb747be92f19cd7864490c982cac558358c (diff)
downloadenigma2-1681d7dadff09e071c4f79954a90969fb7815210.tar.gz
enigma2-1681d7dadff09e071c4f79954a90969fb7815210.zip
add selchanged signal to listbox
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/EpgList.py22
-rw-r--r--lib/python/enigma_python.i1
2 files changed, 22 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()
diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i
index 53238e4a..35290230 100644
--- a/lib/python/enigma_python.i
+++ b/lib/python/enigma_python.i
@@ -144,6 +144,7 @@ typedef long time_t;
%immutable eComponentScan::statusChanged;
%immutable eComponentScan::newService;
%immutable pNavigation::m_event;
+%immutable eListbox::selectionChanged;
%include <lib/gdi/font.h>
%include <lib/gdi/gpixmap.h>