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