fix frontend number query
[enigma2.git] / lib / python / Components / Converter / ConditionalShowHide.py
1 from Converter import Converter
2
3 class ConditionalShowHide(Converter, object):
4         def __init__(self, type):
5                 Converter.__init__(self, type)
6                 self.invert = type == "Invert"
7
8         def calcVisibility(self):
9                 b = self.source.boolean
10                 if b is None:
11                         return True
12                 b ^= self.invert
13                 return b
14
15         def changed(self, what):
16                 vis = self.calcVisibility()
17                 for x in self.downstream_elements:
18                         x.visible = vis
19
20         def connectDownstream(self, downstream):
21                 Converter.connectDownstream(self, downstream)
22                 downstream.visible = self.calcVisibility()