add possibility to use ValueRange as ValueEqual Converter
[enigma2.git] / lib / python / Components / Converter / FrontendInfo.py
index e2923a9..d4788b0 100644 (file)
@@ -6,6 +6,7 @@ class FrontendInfo(Converter, object):
        SNR = 1
        AGC = 2
        LOCK = 3
+       SNRdB = 4
 
        def __init__(self, type):
                Converter.__init__(self, type)
@@ -13,6 +14,8 @@ class FrontendInfo(Converter, object):
                        self.type = self.BER
                elif type == "SNR":
                        self.type = self.SNR
+               elif type == "SNRdB":
+                       self.type = self.SNRdB
                elif type == "AGC":
                        self.type = self.AGC
                else:
@@ -21,6 +24,7 @@ class FrontendInfo(Converter, object):
        @cached
        def getText(self):
                assert self.type != self.LOCK, "the text output of FrontendInfo cannot be used for lock info"
+               percent = None
                if self.type == self.BER: # as count
                        count = self.source.ber
                        if count is not None:
@@ -31,7 +35,11 @@ class FrontendInfo(Converter, object):
                        percent = self.source.agc
                elif self.type == self.SNR:
                        percent = self.source.snr
-               
+               elif self.type == self.SNRdB:
+                       if self.source.snr_db is not None:
+                               return "%3.02f dB" % (self.source.snr_db / 100.0)
+                       elif self.source.snr is not None: #fallback to normal SNR...
+                               percent = self.source.snr
                if percent is None:
                        return "N/A"