def __init__(self, session, retvalue=1, timeout=-1, default_yes = True):
self.retval = retvalue
self.ptsmainloopvalue = retvalue
recordings = session.nav.getRecordings()
jobs = []
for job in job_manager.getPendingJobs():
if job.name != dgettext('vix', 'SoftcamCheck'):
jobs.append(job)
inTimeshift = Screens.InfoBar.InfoBar and Screens.InfoBar.InfoBar.instance and Screens.InfoBar.InfoBar.ptsGetTimeshiftStatus(Screens.InfoBar.InfoBar.instance)
self.connected = False
reason = ""
next_rec_time = -1
if not recordings:
next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
if len(jobs):
reason = (ngettext("%d job is running in the background!", "%d jobs are running in the background!", len(jobs)) % len(jobs)) + '\n'
if len(jobs) == 1:
job = jobs[0]
reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end)))
else:
reason += (_("%d jobs are running in the background!") % len(jobs)) + '\n'
if inTimeshift:
reason = _("You seem to be in timeshift!") + '\n'
if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
default_yes = False
reason = _("Recording(s) are in progress or coming up in few seconds!") + '\n'
if reason and inStandby:
session.nav.record_event.append(self.getRecordEvent)
self.skinName = ""
elif reason and not inStandby:
text = { 1: _("Really shutdown now?"),
2: _("Really reboot now?"),
3: _("Really restart now?"),
4: _("Really upgrade the frontprocessor and reboot now?"),
42: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()),
43: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName()) }.get(retvalue)
if text:
MessageBox.__init__(self, session, reason+text, type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes)
self.skinName = "MessageBoxSimple"
session.nav.record_event.append(self.getRecordEvent)
self.connected = True
self.onShow.append(self.__onShow)
self.onHide.append(self.__onHide)
return
self.skin = """<screen position="1310,0" size="0,0"/>"""
Screen.__init__(self, session)
self.close(True)
评论列表
文章目录