add some new (currently unused) source/renderer based elements
[enigma2.git] / lib / python / Components / Element.py
1 from Tools.CList import CList
2
3 # down                       up
4 # Render Converter Converter Source
5
6 # a bidirectional connection
7 class Element:
8         def __init__(self):
9                 self.downstream_elements = CList()
10                 self.upstream_elements = CList()
11                 self.master = None
12                 self.source = None
13
14         def connectDownstream(self, downstream):
15                 self.downstream_elements.append(downstream)
16                 if self.master is None:
17                         self.master = downstream
18         
19         def connectUpstream(self, upstream):
20                 self.upstream_elements.append(upstream)
21                 self.source = upstream # for single-source elements (i.e., most of them.)
22                 self.changed()
23         
24         def connect(self, upstream):
25                 self.connectUpstream(upstream)
26                 upstream.connectDownstream(self)
27
28         # default action: push downstream
29         def changed(self):
30                 self.downstream_elements.changed()