1 from Screen import Screen
2 from Components.ActionMap import ActionMap
3 from Components.config import config
4 from Components.AVSwitch import AVSwitch
5 from enigma import eDVBVolumecontrol, eDBoxLCD, eServiceReference
6 from Components.Sources.Clock import Clock
10 class Standby(Screen):
14 self.avswitch.setInput("ENCODER")
15 #restart last played service
16 if self.prev_running_service:
17 self.session.nav.playService(self.prev_running_service)
20 #set brightness of lcd
21 eDBoxLCD.getInstance().setLCDBrightness(config.lcd.bright.value * 20)
26 if (eDVBVolumecontrol.getInstance().isMuted()):
28 print "mute already active"
31 eDVBVolumecontrol.getInstance().volumeToggleMute()
34 if self.wasMuted == 0:
35 eDVBVolumecontrol.getInstance().volumeToggleMute()
37 def __init__(self, session):
38 Screen.__init__(self, session)
39 self.avswitch = AVSwitch()
43 self["actions"] = ActionMap( [ "StandbyActions" ],
50 #get currently playing service reference
51 self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceReference()
52 #stop actual played dvb-service
53 self.session.nav.stopService()
54 #set input to vcr scart
55 self.avswitch.setInput("SCART")
56 #set lcd brightness to standby value
57 eDBoxLCD.getInstance().setLCDBrightness(config.lcd.standby.value * 20)
58 self.onShow.append(self.__onShow)
59 self.onHide.append(self.__onHide)
61 def createSummary(self):
72 class StandbySummary(Screen):
74 <screen position="0,0" size="132,64">
75 <widget source="CurrentTime" render="Label" position="0,0" size="132,64" font="Regular;40" halign="center">
76 <convert type="ClockToText" />
80 def __init__(self, session, parent):
81 Screen.__init__(self, session)
82 self["CurrentTime"] = Clock()
84 from enigma import quitMainloop, iRecordableService
85 from Screens.MessageBox import MessageBox
88 inTryQuitMainloop = False
90 class TryQuitMainloop(MessageBox):
91 def __init__(self, session, retvalue=1, timeout=-1):
93 recordings = len(session.nav.getRecordings())
94 self.connected = False
97 next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
98 if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
100 MessageBox.__init__(self, session, _("Recording(s) are in progress or coming up in few seconds... really shutdown now?"), type = MessageBox.TYPE_YESNO, timeout = timeout)
102 MessageBox.__init__(self, session, _("Recording(s) are in progress or coming up in few seconds... really reboot now?"), type = MessageBox.TYPE_YESNO, timeout = timeout)
106 MessageBox.__init__(self, session, _("Recording(s) are in progress or coming up in few seconds... really restart now?"), type = MessageBox.TYPE_YESNO, timeout = timeout)
107 self.skinName = "MessageBox"
108 session.nav.record_event.append(self.getRecordEvent)
109 self.connected = True
110 self.onShow.append(self.__onShow)
111 self.onHide.append(self.__onHide)
113 self.skin = """<screen position="0,0" size="0,0"/>"""
114 Screen.__init__(self, session)
117 def getRecordEvent(self, recservice, event):
118 if event == iRecordableService.evEnd:
119 recordings = self.session.nav.getRecordings()
120 if not len(recordings): # no more recordings exist
121 rec_time = self.session.nav.RecordTimer.getNextRecordingTime()
122 if rec_time > 0 and (rec_time - time()) < 360:
123 self.initTimeout(360) # wait for next starting timer
126 self.close(True) # immediate shutdown
127 elif event == iRecordableService.evStart:
130 def close(self, value):
132 self.conntected=False
133 self.session.nav.record_event.remove(self.getRecordEvent)
135 quitMainloop(self.retval)
137 MessageBox.close(self, True)
140 global inTryQuitMainloop
141 inTryQuitMainloop = True
144 global inTryQuitMainloop
145 inTryQuitMainloop = False