aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Screens/Satconfig.py
blob: 75e5e8944e24f7d04eaa1f064ec33a02d57058fd (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from Screen import Screen
from Components.ActionMap import ActionMap
from Components.ConfigList import ConfigList
from Components.config import *

class setupSelection:
	def __init__(self, parent):
		self.parent = parent

	def handleKey(self, key):
		if key == config.key["prevElement"]:
			self.parent.value = self.parent.value - 1
		if key == config.key["nextElement"]:
			self.parent.value = self.parent.value + 1

	def __call__(self, selected):     #needed by configlist
		print "value" + str(self.parent.value)
		return ("text", self.parent.vals[self.parent.value])

class setupElement:
	def __init__(self, configPath, control, defaultValue, vals):
		self.configPath = configPath
		self.defaultValue = defaultValue
		self.controlType = control
		self.vals = vals
		self.notifierList = [ ]
		self.enabled = True
		self.value = self.defaultValue

class Satconfig(Screen):
	def keyLeft(self):
		if (self["config"].getCurrent()[1].parent.enabled == True):
			self["config"].handleKey(config.key["prevElement"])
	def keyRight(self):
		if (self["config"].getCurrent()[1].parent.enabled == True):
			self["config"].handleKey(config.key["nextElement"])

	def __init__(self, session):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["SetupActions"],
			{
				"cancel": self.close,
				#"ok": self.close,
				"left": self.keyLeft,
				"right": self.keyRight,
			})

		blasel = setupElement("blub", setupSelection, 1, ("A", "B"))
		item = blasel.controlType(blasel)
		list = []
		list.append( ("Tuner-Slot",item) );
		self["config"] = ConfigList(list)