PDC - possible display with pixmap, added posibility display running status for nex...
authorims <ims21@users.sourceforge.net>
Fri, 27 Mar 2015 16:17:58 +0000 (17:17 +0100)
committerErik Slagter <erik@openpli.org>
Sat, 28 Mar 2015 17:44:21 +0000 (18:44 +0100)
Signed-off-by: Erik Slagter <erik@openpli.org>

lib/python/Components/Converter/EventName.py

index e3ec653..d71c81f 100644 (file)
@@ -15,6 +15,7 @@ class EventName(Converter, object):
        SRATING = 9
        PDC = 10
        PDCTIME = 11
        SRATING = 9
        PDC = 10
        PDCTIME = 11
+       ISRUNNINGSTATUS = 12
 
        def __init__(self, type):
                Converter.__init__(self, type)
 
        def __init__(self, type):
                Converter.__init__(self, type)
@@ -40,10 +41,24 @@ class EventName(Converter, object):
                        self.type = self.PDC
                elif type == "PdcTime":
                        self.type = self.PDCTIME
                        self.type = self.PDC
                elif type == "PdcTime":
                        self.type = self.PDCTIME
+               elif type == "IsRunningStatus":
+                       self.type = self.ISRUNNINGSTATUS
                else:
                        self.type = self.NAME
 
        @cached
                else:
                        self.type = self.NAME
 
        @cached
+       def getBoolean(self):
+               event = self.source.event
+               if event is None:
+                       return False
+               if self.type == self.PDC:
+                       if event.getPdcPil():
+                               return True
+               return False
+
+       boolean = property(getBoolean)
+
+       @cached
        def getText(self):
                event = self.source.event
                if event is None:
        def getText(self):
                event = self.source.event
                if event is None:
@@ -110,5 +125,22 @@ class EventName(Converter, object):
                        if pil:
                                return _("%d.%02d. %d:%02d") % ((pil & 0xF8000) >> 15, (pil & 0x7800) >> 11, (pil & 0x7C0) >> 6, (pil & 0x3F))
                        return ""
                        if pil:
                                return _("%d.%02d. %d:%02d") % ((pil & 0xF8000) >> 15, (pil & 0x7800) >> 11, (pil & 0x7C0) >> 6, (pil & 0x3F))
                        return ""
+               elif self.type == self.ISRUNNINGSTATUS:
+                       if event.getPdcPil():
+                               running_status = event.getRunningStatus()
+                               if running_status == 1:
+                                       return "not running"
+                               if running_status == 2:
+                                       return "starts in a few seconds"
+                               if running_status == 3:
+                                       return "pausing"
+                               if running_status == 4:
+                                       return "running"
+                               if running_status == 5:
+                                       return "service off-air"
+                               if running_status in (6,7):
+                                       return "reserved for future use"
+                               return "undefined"
+                       return ""
 
 
-       text = property(getText)
+       text = property(getText)
\ No newline at end of file