add ServiceEventTracker
authorFelix Domke <tmbinc@elitedvb.net>
Wed, 18 Jan 2006 02:34:36 +0000 (02:34 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Wed, 18 Jan 2006 02:34:36 +0000 (02:34 +0000)
lib/python/Components/Makefile.am
lib/python/Components/ServiceEventTracker.py [new file with mode: 0644]

index fcb5f8f..089d7ce 100644 (file)
@@ -12,4 +12,5 @@ install_PYTHON = \
        EpgList.py ScrollLabel.py Timezones.py Language.py HelpMenuList.py \
        BlinkingPixmap.py Pixmap.py ConditionalWidget.py Slider.py LanguageList.py \
        PluginList.py PluginComponent.py RecordingConfig.py About.py UsageConfig.py \
-       FIFOList.py
+       FIFOList.py ServiceEventTracker.py
+
diff --git a/lib/python/Components/ServiceEventTracker.py b/lib/python/Components/ServiceEventTracker.py
new file mode 100644 (file)
index 0000000..99c02fa
--- /dev/null
@@ -0,0 +1,17 @@
+from enigma import pNavigation
+
+class ServiceEventTracker:
+       """Tracks service events into a screen"""
+       
+       def __init__(self, screen, eventmap):
+               self.__eventmap = eventmap
+               self.session = screen.session
+               self.session.nav.event.append(self.__event)
+               screen.onClose.append(self.__del_event)
+
+       def __del_event(self):
+               self.session.nav.event.remove(self.__event)
+
+       def __event(self, ev):
+               if ev in self.__eventmap:
+                       self.__eventmap[ev]()