- add description for timer entries
[enigma2.git] / lib / python / Screens / ChannelSelection.py
1 from Screen import Screen
2 from Components.Button import Button
3 from Components.ServiceList import ServiceList
4 from Components.ActionMap import ActionMap
5
6 from enigma import eServiceReference
7
8 class ChannelSelection(Screen):
9         def __init__(self, session):
10                 Screen.__init__(self, session)
11
12                 self["key_red"] = Button("red")
13                 self["key_green"] = Button("green")
14                 self["key_yellow"] = Button("yellow")
15                 self["key_blue"] = Button("blue")
16                 
17                 self["list"] = ServiceList()
18                 self["list"].setRoot(eServiceReference("""1:0:1:0:0:0:0:0:0:0:(provider=="ARD") && (type == 1)"""))
19                 
20                 #self["okbutton"] = Button("ok", [self.channelSelected])
21                 
22                 class ChannelActionMap(ActionMap):
23                         def action(self, contexts, action):
24                                 if action[:7] == "bouquet":
25                                         print "setting root to " + action[8:]
26                                         self.csel["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:" + action[8:]))
27                                 else:
28                                         ActionMap.action(self, contexts, action)
29
30                 self["actions"] = ChannelActionMap(["ChannelSelectActions", "OkCancelActions"], 
31                         {
32                                 "cancel": self.close,
33                                 "ok": self.channelSelected,
34                                 "mark": self.doMark
35                         })
36                 self["actions"].csel = self
37
38         def doMark(self):
39                 ref = self["list"].getCurrent()
40                 if self["list"].isMarked(ref):
41                         self["list"].removeMarked(ref)
42                 else:
43                         self["list"].addMarked(ref)
44                         
45         def channelSelected(self):
46                 self.session.nav.playService(self["list"].getCurrent())
47                 self.close()
48
49         #called from infoBar
50         def zap(self):
51                 self.session.nav.playService(self["list"].getCurrent())
52
53         def moveUp(self):
54                 self["list"].moveUp()
55
56         def moveDown(self):
57                 self["list"].moveDown()
58