aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Element.py
blob: 6f812b207a6f9a4d7b5e0849c0068dd214ea18f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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()