a9636cacc8df03696921a1411bb8afab7137248f
[enigma2.git] / lib / python / Screens / SessionGlobals.py
1 from enigma import iPlayableService
2 from Screens.Screen import Screen
3 from Components.Sources.CurrentService import CurrentService
4 from Components.Sources.EventInfo import EventInfo
5 from Components.Sources.FrontendStatus import FrontendStatus
6 from Components.Sources.FrontendInfo import FrontendInfo
7 from Components.Sources.Source import Source
8 from Components.Sources.TunerInfo import TunerInfo
9 from Components.Sources.RecordState import RecordState
10 from Components.Renderer.FrontpanelLed import FrontpanelLed
11
12 class SessionGlobals(Screen):
13         def __init__(self, session):
14                 Screen.__init__(self, session)
15                 self["CurrentService"] = CurrentService(session.nav)
16                 self["Event_Now"] = EventInfo(session.nav, EventInfo.NOW)
17                 self["Event_Next"] = EventInfo(session.nav, EventInfo.NEXT)
18                 self["FrontendStatus"] = FrontendStatus(service_source = session.nav.getCurrentService)
19                 self["FrontendInfo"] = FrontendInfo(service_source = session.nav.getCurrentService)
20                 self["VideoPicture"] = Source()
21                 self["TunerInfo"] = TunerInfo()
22                 self["RecordState"] = RecordState(session)
23                 session.nav.event.append(self.serviceEvent)
24                 self.service_state = 0
25
26                 FrontpanelLed().connect(self["RecordState"])
27
28         def serviceEvent(self, evt):
29                 if evt == iPlayableService.evStart:
30                         self.service_state = 1
31                 elif evt == iPlayableService.evEnd:
32                         self.service_state = 0
33                 elif evt == iPlayableService.evUpdatedInfo and self.service_state == 1:
34                         self.service_state = 2
35                         self["FrontendInfo"].updateFrontendData()