aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/VariableText.py
blob: c95330915c3af65b206df9f60308c65e436b1b4c (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
class VariableText(object):
	"""VariableText can be used for components which have a variable text, based on any widget with setText call"""
	
	def __init__(self):
		object.__init__(self)
		self.message = ""
		self.instance = None
	
	def setText(self, text):
		self.message = text
		if self.instance:
			self.instance.setText(self.message or "")

	def setMarkedPos(self, pos):
		if self.instance:
			self.instance.setMarkedPos(int(pos))

	def getText(self):
		return self.message
	
	text = property(getText, setText)
	
	def postWidgetCreate(self, instance):
		instance.setText(self.message or "")