add missing background color
[enigma2.git] / lib / python / Components / Element.py
index 5b8bed866cf1368c88fbb8574b7e46121fc87726..880274b423940ee761435d5c3ef964e45a21b55f 100644 (file)
@@ -7,7 +7,6 @@ from Tools.CList import CList
 class Element:
        def __init__(self):
                self.downstream_elements = CList()
-               self.upstream_elements = CList()
                self.master = None
                self.source = None
 
@@ -17,8 +16,8 @@ class Element:
                        self.master = downstream
        
        def connectUpstream(self, upstream):
-               self.upstream_elements.append(upstream)
-               self.source = upstream # for single-source elements (i.e., most of them.)
+               assert self.source is None
+               self.source = upstream
                self.changed()
        
        def connect(self, upstream):
@@ -31,9 +30,9 @@ class Element:
                # there are still elements depending on us.
                assert len(self.downstream_elements) == 0, "there are still downstream elements left"
                
-               # disconnect all upstream elements from us
-               for upstream in self.upstream_elements:
-                       upstream.disconnectDownstream(self)
+               # Sources don't have a source themselves. don't do anything here.
+               if self.source is not None:
+                       self.source.disconnectDownstream(self)
        
        def disconnectDownstream(self, downstream):
                self.downstream_elements.remove(downstream)
@@ -46,3 +45,7 @@ class Element:
        # default action: push downstream
        def changed(self, *args, **kwargs):
                self.downstream_elements.changed(*args, **kwargs)
+
+       def reconnectUpstream(self, new_upstream):
+               assert self.source is not None
+               self.source = new_upstream