1 from Screen import Screen
2 from ChannelSelection import ChannelSelection
3 from Components.Clock import Clock
4 from Components.VolumeBar import VolumeBar
5 from Components.ActionMap import ActionMap
6 from Components.Button import Button
7 from Components.ServiceName import ServiceName
8 from Components.EventInfo import EventInfo
9 from Components.ServicePosition import ServicePosition
10 from Components.config import configfile
12 from Screens.MessageBox import MessageBox
13 from Screens.MovieSelection import MovieSelection
20 from Menu import MainMenu, mdom
22 class InfoBar(Screen):
28 def __init__(self, session):
29 Screen.__init__(self, session)
32 self.servicelist = self.session.instantiateDialog(ChannelSelection)
33 self.volumeBar = VolumeBar()
35 self.state = self.STATE_HIDDEN
37 self.hideTimer = eTimer()
38 self.hideTimer.timeout.get().append(self.doTimerHide)
39 #self.hideTimer.start(1000)
42 self["actions"] = ActionMap( [ "InfobarActions" ],
44 "switchChannelUp": self.switchChannelUp,
45 "switchChannelDown": self.switchChannelDown,
46 "mainMenu": self.mainMenu,
48 "zapDown": self.zapDown,
49 "volumeUp": self.volUp,
50 "volumeDown": self.volDown,
51 "volumeMute": self.volMute,
52 "instantRecord": self.instantRecord,
54 "toggleShow": self.toggleShow,
55 "showMovies": self.showMovies,
58 # self["okbutton"] = Button("mainMenu", [self.mainMenu])
60 self["CurrentTime"] = Clock()
61 # ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING)
64 self["Volume"] = self.volumeBar
66 self["ServiceName"] = ServiceName(self.session.nav)
68 self["Event_Now"] = EventInfo(self.session.nav, EventInfo.Now)
69 self["Event_Next"] = EventInfo(self.session.nav, EventInfo.Next)
71 self["Event_Now_Duration"] = EventInfo(self.session.nav, EventInfo.Now_Duration)
72 self["Event_Next_Duration"] = EventInfo(self.session.nav, EventInfo.Next_Duration)
79 print "loading mainmenu XML..."
80 menu = mdom.childNodes[0]
81 assert menu.tagName == "menu", "root element in menu must be 'menu'!"
82 self.session.open(MainMenu, menu, menu.childNodes)
84 def switchChannelUp(self):
85 self.servicelist.moveUp()
86 self.session.execDialog(self.servicelist)
88 def switchChannelDown(self):
89 self.servicelist.moveDown()
90 self.session.execDialog(self.servicelist)
95 def doTimerHide(self):
96 if self.state == self.STATE_SHOWN:
98 self.state = self.STATE_HIDDEN
100 def toggleShow(self):
101 if self.state == self.STATE_SHOWN:
103 #pls check animation support, sorry
105 self.state = self.STATE_HIDDEN
109 self.state = self.STATE_SHOWN
110 #TODO: make it customizable
111 self.hideTimer.start(5000)
114 self.servicelist.moveUp()
115 self.servicelist.zap()
118 self.servicelist.moveDown()
119 self.servicelist.zap()
122 eDVBVolumecontrol.getInstance().volumeUp()
123 self.volumeBar.setValue(eDVBVolumecontrol.getInstance().getVolume())
126 eDVBVolumecontrol.getInstance().volumeDown()
127 self.volumeBar.setValue(eDVBVolumecontrol.getInstance().getVolume())
130 self.instance.m_animation.startMoveAnimation(ePoint(0, 600), ePoint(0, 380), 100)
131 self.state = self.STATE_SHOWN
134 self.instance.m_animation.startMoveAnimation(ePoint(0, 380), ePoint(0, 600), 100)
135 self.state = self.STATE_HIDDEN
138 eDVBVolumecontrol.getInstance().volumeToggleMute()
139 self.volumeBar.setValue(eDVBVolumecontrol.getInstance().getVolume())
145 def instantRecord(self):
146 #self.session.open(MessageBox, "this would be an instant recording! do you really know what you're doing?!")
149 if self.recording != None:
151 self.session.nav.RecordTimer.removeEntry(self.recording)
152 self.recording = None
154 serviceref = self.session.nav.getCurrentlyPlayingServiceReference()
156 # try to get event info
159 service = self.session.nav.getCurrentService()
160 info = service.info()
161 ev = info.getEvent(0)
166 # fix me, description.
167 self.recording = self.session.nav.recordWithTimer(time.time(), time.time() + 30, serviceref, epg, "instant record")
169 def showMovies(self):
170 self.session.open(MovieSelection)