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 Components.SystemInfo import SystemInfo
6 from enigma import eDVBVolumecontrol
10 class Standby(Screen):
14 self.avswitch.setInput("ENCODER")
15 #restart last played service
22 if (eDVBVolumecontrol.getInstance().isMuted()):
24 print "mute already active"
27 eDVBVolumecontrol.getInstance().volumeToggleMute()
30 if self.wasMuted == 0:
31 eDVBVolumecontrol.getInstance().volumeToggleMute()
33 def __init__(self, session):
34 Screen.__init__(self, session)
35 self.avswitch = AVSwitch()
39 self["actions"] = ActionMap( [ "StandbyActions" ],
47 self.paused_service = None
48 self.prev_running_service = None
49 if self.session.current_dialog:
50 if self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_STOPS:
51 #get currently playing service reference
52 self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceReference()
53 #stop actual played dvb-service
54 self.session.nav.stopService()
55 elif self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_PAUSES:
56 self.paused_service = self.session.current_dialog
57 self.paused_service.pauseService()
59 #set input to vcr scart
60 if SystemInfo["ScartSwitch"]:
61 self.avswitch.setInput("SCART")
63 self.avswitch.setInput("AUX")
64 self.onFirstExecBegin.append(self.__onFirstExecBegin)
65 self.onClose.append(self.__onClose)
70 if self.prev_running_service:
71 self.session.nav.playService(self.prev_running_service)
72 elif self.paused_service:
73 self.paused_service.unPauseService()
74 self.session.screen["Standby"].boolean = False
76 def __onFirstExecBegin(self):
79 self.session.screen["Standby"].boolean = True
80 config.misc.standbyCounter.value += 1
82 def createSummary(self):
85 class StandbySummary(Screen):
87 <screen position="0,0" size="132,64">
88 <widget source="global.CurrentTime" render="Label" position="0,0" size="132,64" font="Regular;40" halign="center">
89 <convert type="ClockToText" />
91 <widget source="session.RecordState" render="FixedLabel" text=" " position="0,0" size="132,64" zPosition="1" >
92 <convert type="ConfigEntryTest">config.usage.blinking_display_clock_during_recording,True,CheckSourceBoolean</convert>
93 <convert type="ConditionalShowHide">Blink</convert>
97 from enigma import quitMainloop, iRecordableService
98 from Screens.MessageBox import MessageBox
100 from Components.Task import job_manager
102 inTryQuitMainloop = False
104 class TryQuitMainloop(MessageBox):
105 def __init__(self, session, retvalue=1, timeout=-1, default_yes = True):
107 recordings = session.nav.getRecordings()
108 jobs = len(job_manager.getPendingJobs())
109 self.connected = False
113 next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
114 if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
115 reason = _("Recording(s) are in progress or coming up in few seconds!") + '\n'
118 job = job_manager.getPendingJobs()[0]
119 reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end)))
121 reason += (_("%d jobs are running in the background!") % jobs) + '\n'
124 MessageBox.__init__(self, session, reason+_("Really shutdown now?"), type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes)
126 MessageBox.__init__(self, session, reason+_("Really reboot now?"), type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes)
130 MessageBox.__init__(self, session, reason+_("Really restart now?"), type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes)
131 self.skinName = "MessageBox"
132 session.nav.record_event.append(self.getRecordEvent)
133 self.connected = True
134 self.onShow.append(self.__onShow)
135 self.onHide.append(self.__onHide)
137 self.skin = """<screen position="0,0" size="0,0"/>"""
138 Screen.__init__(self, session)
141 def getRecordEvent(self, recservice, event):
142 if event == iRecordableService.evEnd:
143 recordings = self.session.nav.getRecordings()
144 if not recordings: # no more recordings exist
145 rec_time = self.session.nav.RecordTimer.getNextRecordingTime()
146 if rec_time > 0 and (rec_time - time()) < 360:
147 self.initTimeout(360) # wait for next starting timer
150 self.close(True) # immediate shutdown
151 elif event == iRecordableService.evStart:
154 def close(self, value):
156 self.conntected=False
157 self.session.nav.record_event.remove(self.getRecordEvent)
159 # hack .. we dont like to show any other screens when this screen has closed
160 self.onClose = [self.__closed]
161 self.session.dialog_stack = []
162 self.session.summary_stack = [None]
163 MessageBox.close(self, True)
166 quitMainloop(self.retval)
169 global inTryQuitMainloop
170 inTryQuitMainloop = True
173 global inTryQuitMainloop
174 inTryQuitMainloop = False