remove VolumeControl from infobar
[enigma2.git] / lib / python / Screens / InfoBar.py
1 from Screen import Screen
2
3 from Screens.MovieSelection import MovieSelection
4 from Screens.ChannelSelection import ChannelSelectionRadio
5 from Screens.MessageBox import MessageBox
6 from ServiceReference import ServiceReference
7
8 from Components.Clock import Clock
9 from Components.ActionMap import ActionMap, HelpableActionMap
10 from Components.ServicePosition import ServicePosition
11
12 from Tools.Notifications import AddNotificationWithCallback
13
14 from Screens.InfoBarGenerics import InfoBarShowHide, \
15         InfoBarPowerKey, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, \
16         InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarSeek, InfoBarInstantRecord, \
17         InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \
18         InfoBarSubserviceSelection, InfoBarTuner, InfoBarShowMovies, InfoBarTimeshift
19
20 from Screens.HelpMenu import HelpableScreen, HelpMenu
21
22 from enigma import *
23
24 import time
25
26 class InfoBar(Screen, InfoBarShowHide, InfoBarPowerKey,
27         InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG,
28         InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, 
29         HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
30         InfoBarSubserviceSelection, InfoBarTuner):
31
32         def __init__(self, session):
33                 Screen.__init__(self, session)
34
35                 self["actions"] = HelpableActionMap(self, "InfobarActions",
36                         {
37                                 "showMovies": (self.showMovies, _("Play recorded movies...")),
38                                 "showRadio": (self.showRadio, _("Show the radio player..."))
39                         })
40                 
41                 for x in HelpableScreen, \
42                                 InfoBarShowHide, InfoBarPowerKey, \
43                                 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \
44                                 InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
45                                 InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
46                                 InfoBarTuner:
47                         x.__init__(self)
48
49                 self.helpList.append((self["actions"], "InfobarActions", [("showMovies", "Watch a Movie...")]))
50                 self.helpList.append((self["actions"], "InfobarActions", [("showRadio", "Hear Radio...")]))
51
52                 self["CurrentTime"] = Clock()
53
54         def showRadio(self):
55                 self.session.open(ChannelSelectionRadio)
56
57         def showMovies(self):
58                 self.session.openWithCallback(self.movieSelected, MovieSelection)
59
60         def movieSelected(self, service):
61                 if service is not None:
62                         self.session.open(MoviePlayer, service)
63
64 class MoviePlayer(Screen, InfoBarShowHide, InfoBarPowerKey, \
65                 InfoBarMenu, \
66                 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications):
67                 
68         def __init__(self, session, service):
69                 Screen.__init__(self, session)
70                 
71                 self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
72                         {
73                                 "leavePlayer": (self.leavePlayer, _("leave movie player..."))
74                         })
75                 
76                 for x in HelpableScreen, InfoBarShowHide, InfoBarPowerKey, InfoBarMenu, InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, InfoBarNotifications:
77                         x.__init__(self)
78
79                 self["CurrentTime"] = ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING)
80                 
81                 self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference()
82                 self.session.nav.playService(service)
83
84         def leavePlayer(self):
85                 self.session.openWithCallback(self.leavePlayerConfirmed, MessageBox, _("Stop playing this movie?"))
86         
87         def leavePlayerConfirmed(self, answer):
88                 if answer == True:
89                         self.session.nav.playService(self.lastservice)
90                         self.close()
91                         
92         def showMovies(self):
93                 ref = self.session.nav.getCurrentlyPlayingServiceReference()
94                 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
95
96         def movieSelected(self, service):
97                 if service is not None:
98                         self.session.nav.playService(service)