add possibility to select between different list styles via context menu
[enigma2.git] / lib / python / Components / Converter / EventName.py
index f128133..b1ec62d 100644 (file)
@@ -1,28 +1,28 @@
 from Components.Converter.Converter import Converter
+from Components.Element import cached
 
 class EventName(Converter, object):
        NAME = 0
        SHORT_DESCRIPTION = 1
        EXTENDED_DESCRIPTION = 2
-
+       ID = 3
+       
        def __init__(self, type):
                Converter.__init__(self, type)
                if type == "Description":
                        self.type = self.SHORT_DESCRIPTION
                elif type == "ExtendedDescription":
                        self.type = self.EXTENDED_DESCRIPTION
+               elif type == "ID":
+                       self.type = self.ID
                else:
                        self.type = self.NAME
 
+       @cached
        def getText(self):
-               if self.cache is None:
-                       self.cache = self.__getText()
-               return self.cache
-
-       def __getText(self):
                event = self.source.event
                if event is None:
-                       return "N/A"
+                       return ""
                        
                if self.type == self.NAME:
                        return event.getEventName()
@@ -30,5 +30,7 @@ class EventName(Converter, object):
                        return event.getShortDescription()
                elif self.type == self.EXTENDED_DESCRIPTION:
                        return event.getExtendedDescription()
-                       
+               elif self.type == self.ID:
+                       return str(event.getEventId())
+               
        text = property(getText)