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