add some new (currently unused) source/renderer based elements
[enigma2.git] / lib / python / Components / Element.py
diff --git a/lib/python/Components/Element.py b/lib/python/Components/Element.py
new file mode 100644 (file)
index 0000000..6f812b2
--- /dev/null
@@ -0,0 +1,30 @@
+from Tools.CList import CList
+
+# down                       up
+# Render Converter Converter Source
+
+# a bidirectional connection
+class Element:
+       def __init__(self):
+               self.downstream_elements = CList()
+               self.upstream_elements = CList()
+               self.master = None
+               self.source = None
+
+       def connectDownstream(self, downstream):
+               self.downstream_elements.append(downstream)
+               if self.master is None:
+                       self.master = downstream
+       
+       def connectUpstream(self, upstream):
+               self.upstream_elements.append(upstream)
+               self.source = upstream # for single-source elements (i.e., most of them.)
+               self.changed()
+       
+       def connect(self, upstream):
+               self.connectUpstream(upstream)
+               upstream.connectDownstream(self)
+
+       # default action: push downstream
+       def changed(self):
+               self.downstream_elements.changed()