show dolby, crypt and format status in the infobar - we don't have functionality...
[enigma2.git] / lib / python / Screens / InfoBar.py
1 from Screen import Screen
2
3 from Screens.MovieSelection import MovieSelection
4 from Screens.MessageBox import MessageBox
5
6 from Components.Clock import Clock
7 from Components.ActionMap import ActionMap
8 from Components.ServicePosition import ServicePosition
9
10 from Screens.InfoBarGenerics import InfoBarVolumeControl, InfoBarShowHide, \
11         InfoBarPowerKey, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, \
12         InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord, \
13         InfoBarAudioSelection, InfoBarAdditionalInfo
14
15 from Screens.HelpMenu import HelpableScreen, HelpMenu
16
17 from enigma import *
18
19 import time
20
21 class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey,
22         InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG,
23         InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, 
24         HelpableScreen, InfoBarAdditionalInfo):
25
26         def __init__(self, session):
27                 Screen.__init__(self, session)
28
29                 self["actions"] = ActionMap( [ "InfobarActions" ],
30                         {
31                                 "showMovies": self.showMovies,
32                         })
33                 
34                 for x in HelpableScreen, \
35                                 InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \
36                                 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \
37                                 InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
38                                 InfoBarAdditionalInfo:
39                         x.__init__(self)
40
41                 self.helpList.append((self["actions"], "InfobarActions", [("showMovies", "Watch a Movie...")]))
42
43                 self["CurrentTime"] = Clock()
44
45         def showMovies(self):
46                 self.session.openWithCallback(self.movieSelected, MovieSelection)
47
48         def movieSelected(self, service):
49                 if service is not None:
50                         self.session.open(MoviePlayer, service)
51
52 class MoviePlayer(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \
53                 InfoBarMenu, \
54                 InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection, HelpableScreen):
55                 
56         def __init__(self, session, service):
57                 Screen.__init__(self, session)
58                 
59                 self["actions"] = ActionMap( [ "MoviePlayerActions" ],
60                         {
61                                 "leavePlayer": self.leavePlayer
62                         })
63                 
64                 for x in HelpableScreen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, InfoBarMenu, InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection:
65                         x.__init__(self)
66
67                 self["CurrentTime"] = ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING)
68                 
69                 self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference()
70                 self.session.nav.playService(service)
71
72         def leavePlayer(self):
73                 self.session.openWithCallback(self.leavePlayerConfirmed, MessageBox, _("Stop playing this movie?"))
74         
75         def leavePlayerConfirmed(self, answer):
76                 if answer == True:
77                         self.session.nav.playService(self.lastservice)
78                         self.close()