aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Screens/ChannelSelection.py
blob: 289d2e5b099527fcdafd3d80592d932b7d4de0c4 (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
54
55
56
57
58
from Screen import Screen
from Components.Button import Button
from Components.ServiceList import ServiceList
from Components.ActionMap import ActionMap

from enigma import eServiceReference

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

		self["key_red"] = Button("red")
		self["key_green"] = Button("green")
		self["key_yellow"] = Button("yellow")
		self["key_blue"] = Button("blue")
		
		self["list"] = ServiceList()
		self["list"].setRoot(eServiceReference("""1:0:1:0:0:0:0:0:0:0:(provider=="ARD") && (type == 1)"""))
		
		#self["okbutton"] = Button("ok", [self.channelSelected])
		
		class ChannelActionMap(ActionMap):
			def action(self, contexts, action):
				if action[:7] == "bouquet":
					print "setting root to " + action[8:]
					self.csel["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:" + action[8:]))
				else:
					ActionMap.action(self, contexts, action)

		self["actions"] = ChannelActionMap(["ChannelSelectActions", "OkCancelActions"], 
			{
				"cancel": self.close,
				"ok": self.channelSelected,
				"mark": self.doMark
			})
		self["actions"].csel = self

	def doMark(self):
		ref = self["list"].getCurrent()
		if self["list"].isMarked(ref):
			self["list"].removeMarked(ref)
		else:
			self["list"].addMarked(ref)
			
	def channelSelected(self):
		self.session.nav.playService(self["list"].getCurrent())
		self.close()

	#called from infoBar
	def zap(self):
		self.session.nav.playService(self["list"].getCurrent())

	def moveUp(self):
		self["list"].moveUp()

	def moveDown(self):
		self["list"].moveDown()