예제 #1
0
def getReasons(session):
    recordings = session.nav.getRecordings()
    jobs = len(job_manager.getPendingJobs())
    reasons = []
    next_rec_time = -1
    if not recordings:
        next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
    if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
        reasons.append(
            _("Recording(s) are in progress or coming up in few seconds!"))
    if jobs:
        if jobs == 1:
            job = job_manager.getPendingJobs()[0]
            reasons.append("%s: %s (%d%%)" %
                           (job.getStatustext(), job.name,
                            int(100 * job.progress / float(job.end))))
        else:
            reasons.append(
                (ngettext("%d job is running in the background!",
                          "%d jobs are running in the background!", jobs) %
                 jobs))
    if eStreamServer.getInstance().getConnectedClients() or StreamServiceList:
        reasons.append(_("Client is streaming from this box!"))
    if not reasons and internalHDDNotSleeping():
        reasons.append(_("Harddisk is not in sleepmode it could be in use!"))
    return "\n".join(reasons)
예제 #2
0
	def __init__(self, session, retvalue=1, timeout=-1, default_yes = False):
		self.retval = retvalue
		recordings = session.nav.getRecordings()
		jobs = len(job_manager.getPendingJobs())
		self.connected = False
		reason = ""
		next_rec_time = -1
		if not recordings:
			next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
		if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
			reason = _("Recording(s) are in progress or coming up in few seconds!") + '\n'
		if jobs:
			if jobs == 1:
				job = job_manager.getPendingJobs()[0]
				reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end)))
			else:
				reason += (ngettext("%d job is running in the background!", "%d jobs are running in the background!", jobs) % jobs) + '\n'
		if reason:
			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 settop box and reboot now?") }.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="0,0" size="0,0"/>"""
		Screen.__init__(self, session)
		self.close(True)
예제 #3
0
파일: Standby.py 프로젝트: popazerty/12
	def __init__(self, session, retvalue=1, timeout=-1, default_yes = True):
		self.retval=retvalue
		recordings = session.nav.getRecordings()
		jobs = len(job_manager.getPendingJobs())
		self.connected = False
		reason = ""
		next_rec_time = -1
		if not recordings:
			next_rec_time = session.nav.RecordTimer.getNextRecordingTime()	
		if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
			reason = _("Recording(s) are in progress or coming up in few seconds!") + '\n'
		if jobs:
			if jobs == 1:
				job = job_manager.getPendingJobs()[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!") % jobs) + '\n'
		if reason:
			if retvalue == 1:
				MessageBox.__init__(self, session, reason+_("Really shutdown now?"), type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes)
			elif retvalue == 2:
				MessageBox.__init__(self, session, reason+_("Really reboot now?"), type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes)
			elif retvalue == 4:
				pass
			else:
				MessageBox.__init__(self, session, reason+_("Really restart now?"), type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes)
			self.skinName = "MessageBox"
			session.nav.record_event.append(self.getRecordEvent)
			self.connected = True
			self.onShow.append(self.__onShow)
			self.onHide.append(self.__onHide)
		else:
			self.skin = """<screen name="TryQuitMainloop" position="0,0" size="0,0" flags="wfNoBorder"/>"""
			Screen.__init__(self, session)
			self.close(True)
예제 #4
0
def getReasons(session, retvalue=QUIT_SHUTDOWN):
    recordings = session.nav.getRecordings()
    jobs = len(job_manager.getPendingJobs())
    reasons = []
    next_rec_time = -1
    if not recordings:
        next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
    if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
        reasons.append(
            _("Recording(s) are in progress or coming up in few seconds!"))
    if jobs:
        if jobs == 1:
            job = job_manager.getPendingJobs()[0]
            reasons.append("%s: %s (%d%%)" %
                           (job.getStatustext(), job.name,
                            int(100 * job.progress / float(job.end))))
        else:
            reasons.append(
                (ngettext("%d job is running in the background!",
                          "%d jobs are running in the background!", jobs) %
                 jobs))
    if eStreamServer.getInstance().getConnectedClients() or StreamServiceList:
        reasons.append(_("Client is streaming from this box!"))
    if not reasons and mediafilesInUse(session) and retvalue in (
            QUIT_SHUTDOWN, QUIT_REBOOT, QUIT_UPGRADE_FP, QUIT_UPGRADE_PROGRAM,
            QUIT_UPGRADE_FPANEL):
        reasons.append(_("A file from media is in use!"))
    return "\n".join(reasons)
예제 #5
0
 def doPowerOffRun(self):
     if self.session:
         if self.wait_nextday:
             if time() >= self.nextday_time:
                 print "[PowerOffTimer] Cancel waiting shutdown, over limit, set next day."
                 self.powerStateTimerChanged()
                 return
         try_poweroff = True
         if isExternalToolsRunning():
             try_poweroff = False
         if RecordTimerEntry.wasInDeepStandby:
             try_poweroff = False
         if try_poweroff:
             if not self.session.nav.getRecordings():
                 rec_time = self.session.nav.RecordTimer.getNextRecordingTime(
                 )
                 if rec_time > 0 and (rec_time - time()) < 360:
                     try_poweroff = False
             else:
                 try_poweroff = False
         if try_poweroff:
             jobs = len(job_manager.getPendingJobs())
             if Standby.inStandby is None:
                 if not config.usage.poweroff_force.value:
                     try_poweroff = False
             elif jobs or self.session.screen[
                     "TunerInfo"].tuner_use_mask or internalHDDNotSleeping(
                     ):
                 try_poweroff = False
         if try_poweroff:
             if Standby.inStandby is None:
                 reason = _("Power off timer") + '\n\n'
                 if jobs:
                     if jobs == 1:
                         job = job_manager.getPendingJobs()[0]
                         reason += "%s: %s (%d%%)\n" % (
                             job.getStatustext(), job.name,
                             int(100 * job.progress / float(job.end)))
                     else:
                         reason += (ngettext(
                             "%d job is running in the background!",
                             "%d jobs are running in the background!", jobs)
                                    % jobs) + '\n'
                 if self.session.nav.getClientsStreaming():
                     clients = ClientsStreaming("SHORT_ALL")
                     reason += clients.getText() + '\n'
                 self.session.openWithCallback(self.doPowerOffAnswer,
                                               MessageBox,
                                               reason +
                                               _("Really shutdown now?"),
                                               type=MessageBox.TYPE_YESNO,
                                               timeout=180)
             else:
                 self.doPowerOffAnswer(True)
         else:
             print "[PowerOffTimer] Don't shutdown, box in use. Wait 5 min..."
             self.doPowerOffTimer.start(self.wait_nextday_time * 1000, True)
             self.wait_nextday = True
예제 #6
0
	def checkJobs(self):
		reason = ""
		jobs = len(job_manager.getPendingJobs())
		if jobs:
			if jobs == 1:
				job = job_manager.getPendingJobs()[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!") % jobs) + '\n'
		return reason
예제 #7
0
    def __init__(self, session, timeout=-1, default_yes=True):
        #		self.retval = retvalue
        recordings = session.nav.getRecordings()
        jobs = len(job_manager.getPendingJobs())
        self.connected = False
        reason = ""
        next_rec_time = -1
        self.testTimer = eTimer()
        self.testTimer.callback.append(self.switchAndroid)

        if not recordings:
            next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
        if recordings or (next_rec_time > 0 and
                          (next_rec_time - time()) < 360):
            reason = _(
                "Recording(s) are in progress or coming up in few seconds!"
            ) + '\n'
        if jobs:
            if jobs == 1:
                job = job_manager.getPendingJobs()[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!") %
                           jobs) + '\n'

        if reason:
            text = "Are you sure you want to switch to Android now?"
            MessageBox.__init__(self,
                                session,
                                reason + text,
                                type=MessageBox.TYPE_YESNO,
                                timeout=timeout,
                                default=default_yes)
            self.skinName = "MessageBox"
            session.nav.record_event.append(self.getRecordEvent)
            self.connected = True
            self.onShow.append(self.__onShow)
            self.onHide.append(self.__onHide)
            return
        else:
            text = "Are you sure you want to switch to Android now?"
            MessageBox.__init__(self,
                                session,
                                text,
                                type=MessageBox.TYPE_YESNO,
                                timeout=timeout,
                                default=default_yes)
            self.skinName = "MessageBox"
            self.onShow.append(self.__onShow)
            self.onHide.append(self.__onHide)
            return
예제 #8
0
	def __init__(self, session, retvalue=1, timeout=-1, default_yes = True):
		self.retval = retvalue
		self.ptsmainloopvalue = retvalue
		recordings = session.nav.getRecordings()
		jobs = len(job_manager.getPendingJobs())
		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 jobs:
			reason = (ngettext("%d job is running in the background!", "%d jobs are running in the background!", jobs) % jobs) + '\n'
			if jobs == 1:
				job = job_manager.getPendingJobs()[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!") % jobs) + '\n'
			if job.name == "VFD Checker":		
				reason = ""
		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 STB_BOX and reboot now?"),
				43: _("Really reflash your STB_BOX and reboot now?"),				
				44: _("Really upgrade the front panel and reboot now?")}.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)
예제 #9
0
	def rebuildTaskList(self):
		self.tasklist = []
		for job in job_manager.getPendingJobs():
			self.tasklist.append((job,job.name,job.getStatustext(),int(100*job.progress/float(job.end)) ,str(100*job.progress/float(job.end)) + "%" ))
		self['tasklist'].setList(self.tasklist)
		self['tasklist'].updateList(self.tasklist)
		self.Timer.startLongTimer(2)
예제 #10
0
    def start_download(self, path):
        image = self['downloadmenu'].getCurrent()
        if image:
            self.image_url = self['downloadmenu'].getCurrent()[0]
            self.image_name = self['downloadmenu'].getCurrent()[4]
            self.path = path
            self.file_name = os.path.join(self.path + '/',
                                          os.path.basename(self.image_url))
            if fileExists(self.file_name) and self.verify_download():
                self.download_finished(True)
            else:
                job_name = _('Download %s') % self.image_name
                job_manager.AddJob(
                    downloadJob(self.image_url, self.file_name, job_name))
                tasklist = []
                for job in job_manager.getPendingJobs():
                    if job.name == job_name:
                        tasklist.append(
                            (job, job.name, job.getStatustext(),
                             int(100 * job.progress / float(job.end)),
                             str(100 * job.progress / float(job.end)) + '%'))
                        break

                if len(tasklist):
                    self.session.openWithCallback(self.download_finished,
                                                  DownloadTaskScreen,
                                                  self.skin_path, tasklist,
                                                  job_name)
예제 #11
0
    def LastJobView(self):
		currentjob = None
		for job in JobManager.getPendingJobs():
			currentjob = job

		if currentjob is not None:
			self.session.open(JobView, currentjob)
예제 #12
0
	def checkBackgroundJobs(self):
		for job in job_manager.getPendingJobs():
			print "type(job):", type(job)
			print "Process.DVDJob:", Process.DVDJob
			if type(job) == Process.DVDJob:
				self.backgroundJob = job
				return
		self.backgroundJob = None
예제 #13
0
 def openTasklist(self):
     self.tasklist = []
     for job in job_manager.getPendingJobs():
         self.tasklist.append(
             (job, job.name, job.getStatustext(),
              int(100 * job.progress / float(job.end)),
              str(100 * job.progress / float(job.end)) + "%"))
     self.session.open(TaskListScreen, self.tasklist)
예제 #14
0
def viewdownloads(session, plugin_path=None):
    tasklist = []
    for job in job_manager.getPendingJobs():
        tasklist.append((job, job.name, job.getStatustext(),
                         int(100 * job.progress / float(job.end)),
                         str(100 * job.progress / float(job.end)) + "%"))

    session.open(downloadTasksScreen, plugin_path, tasklist)
예제 #15
0
파일: TitleList.py 프로젝트: TwolDE2/ATV65
 def checkBackgroundJobs(self):
     for job in job_manager.getPendingJobs():
         print("type(job):", type(job))
         print("Process.DVDJob:", Process.DVDJob)
         if isinstance(job, Process.DVDJob):
             self.backgroundJob = job
             return
     self.backgroundJob = None
예제 #16
0
 def checkBackgroundJobs(self):
     for job in job_manager.getPendingJobs():
         print("[DVDBurn] type(job):", type(job))
         print("[DVDBurn] Process.DVDJob:", Process.DVDJob)
         if type(job) == Process.DVDJob:
             self.backgroundJob = job
             return
     self.backgroundJob = None
예제 #17
0
	def __init__(self, session, retvalue=QUIT_SHUTDOWN, timeout=-1, default_yes = True):
		self.retval = retvalue
		self.ptsmainloopvalue = retvalue
		recordings = session.nav.getRecordings(False,Components.RecordingConfig.recType(config.recording.warn_box_restart_rec_types.getValue()))
		jobs = len(job_manager.getPendingJobs())
		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 jobs:
#			reason = (ngettext("%d job is running in the background!", "%d jobs are running in the background!", jobs) % jobs) + '\n'
#			if jobs == 1:
#				job = job_manager.getPendingJobs()[0]
#				if job.name == "VFD Checker":
#					reason = ""
#				else:
#					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!") % jobs) + '\n'
		if inTimeshift:
			reason = _("You seem to be in timeshift!") + '\n'
			default_yes = True
			timeout=30
		if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
			reason = _("Recording(s) are in progress or coming up in few seconds!") + '\n'
			default_yes = False
			timeout=30

		if reason and inStandby:
			session.nav.record_event.append(self.getRecordEvent)
			self.skinName = ""
		elif reason and not inStandby:
			text = {
				QUIT_SHUTDOWN: _("Really shutdown now?"),
				QUIT_REBOOT: _("Really reboot now?"),
				QUIT_RESTART: _("Really restart now?"),
				QUIT_UPGRADE_FP: _("Really upgrade the frontprocessor and reboot now?"),
				QUIT_MAINT: _("Really reboot into Recovery Mode?"),
				QUIT_UPGRADE_PROGRAM: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()),
				QUIT_IMAGE_RESTORE: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName()),
				QUIT_UPGRADE_FRONTPANEL: _("Really upgrade the front panel and reboot now?"),
				QUIT_WOLSHUTDOWN: _("Really WOL now?")
				}.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)
예제 #18
0
	def doFormat(self):
		self.reset()
		try:
			job_manager.AddJob(self.internalHdd.createInitializeJob(), onSuccess=self.formatSucceeded, onFail=self.formatFailed)
			for job in job_manager.getPendingJobs():
				if job.name == _("Initializing storage device..."):
					self.showJobView(job)
					break
		except Exception, ex:
			self.session.open(MessageBox, _("Can't start job to format HDD\n")+str(ex), type=MessageBox.TYPE_ERROR, timeout=10)
	def updateDownloadList(self):
		self.progressTimer.stop()
		downloadList = []
		for job in job_manager.getPendingJobs():
			progress = job.progress / float(job.end) * 100
			downloadList.append((job, job.name, job.getStatustext(),
				int(progress), str(progress) + "%"))
		self['list'].updateList(downloadList)
		if downloadList:
			self.progressTimer.startLongTimer(2)
예제 #20
0
	def doFormat(self):
		self.reset()
		try:
			job_manager.AddJob(self.internalHdd.createInitializeJob(), onSuccess=self.formatSucceeded, onFail=self.formatFailed)
			for job in job_manager.getPendingJobs():
				if job.name == _("Initializing storage device..."):
					self.showJobView(job)
					break
		except Exception, ex:
			self.session.open(MessageBox, _("Can't start job to format HDD\n")+str(ex), type=MessageBox.TYPE_ERROR, timeout=10)
예제 #21
0
    def openTasklist(self):
        self.tasklist = []
        for job in job_manager.getPendingJobs():
            self.tasklist.append((job,
             job.name,
             job.getStatustext(),
             int(100 * job.progress / float(job.end)),
             str(100 * job.progress / float(job.end)) + '%'))

        self.session.open(TaskListScreen, self.tasklist)
예제 #22
0
	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 config.usage.task_warning.value and 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 eStreamServer.getInstance().getConnectedClients() or StreamServiceList:
			reason += _("A client is streaming from this box!") + '\n'

		if reason and inStandby:
			session.nav.record_event.append(self.getRecordEvent)
			self.skinName = ""
		elif reason and not inStandby:
			text = {
				QUIT_SHUTDOWN: _("Really shutdown now?"),
				QUIT_REBOOT: _("Really reboot now?"),
				QUIT_RESTART: _("Really restart now?"),
				QUIT_ANDROID: _("Really reboot into Android Mode?"),
				QUIT_MAINT: _("Really reboot into Recovery Mode?"),
				QUIT_UPGRADE_FP: _("Really upgrade the frontprocessor and reboot now?"),
				QUIT_UPGRADE_PROGRAM: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()),
				QUIT_IMAGE_RESTORE: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName())
			}.get(retvalue)
			if text:
				MessageBox.__init__(self, session, "%s\n%s" % (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)
예제 #23
0
파일: Standby.py 프로젝트: hd75hd/enigma2
def getReasons(session):
	recordings = session.nav.getRecordings()
	jobs = len(job_manager.getPendingJobs())
	reasons = []
	next_rec_time = -1
	if not recordings:
		next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
	if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
		reasons.append(_("Recording(s) are in progress or coming up in few seconds!"))
	if jobs:
		if jobs == 1:
			job = job_manager.getPendingJobs()[0]
			reasons.append("%s: %s (%d%%)" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end))))
		else:
			reasons.append((ngettext("%d job is running in the background!", "%d jobs are running in the background!", jobs) % jobs))
	if eStreamServer.getInstance().getConnectedClients() or StreamServiceList:
			reasons.append(_("Client is streaming from this box!"))
	#if not reasons and internalHDDNotSleeping():
	#		reasons.append(_("Harddisk is not in sleepmode it could be in use!"))
	return "\n".join(reasons)
예제 #24
0
	def hddConfirmed(self, confirmed):
		if not confirmed:
			return
		try:
			job_manager.AddJob(self.action())
			for job in job_manager.getPendingJobs():
				if job.name in (_("Initializing storage device..."), _("Checking filesystem..."),_("Converting ext3 to ext4...")):
					self.showJobView(job)
					break
		except Exception, ex:
			self.session.open(MessageBox, str(ex), type=MessageBox.TYPE_ERROR, timeout=10)
예제 #25
0
파일: Standby.py 프로젝트: OpenViX/enigma2
	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 config.usage.task_warning.value and 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 eStreamServer.getInstance().getConnectedClients() or StreamServiceList:
			reason += _("A client is streaming from this box!") + '\n'

		if reason and inStandby:
			session.nav.record_event.append(self.getRecordEvent)
			self.skinName = ""
		elif reason and not inStandby:
			text = {
				QUIT_SHUTDOWN: _("Really shutdown now?"),
				QUIT_REBOOT: _("Really reboot now?"),
				QUIT_RESTART: _("Really restart now?"),
				QUIT_MAINT: _("Really reboot into Recovery Mode?"),
				QUIT_UPGRADE_FP: _("Really upgrade the frontprocessor and reboot now?"),
				QUIT_UPGRADE_PROGRAM: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()),
				QUIT_IMAGE_RESTORE: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName())
			}.get(retvalue)
			if text:
				MessageBox.__init__(self, session, "%s\n%s" % (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)
예제 #26
0
def getReasons(session, retvalue=1):
	recordings = session.nav.getRecordings()
	jobs = len(job_manager.getPendingJobs())
	reasons = []
	next_rec_time = -1
	if not recordings:
		next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
	if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
		reasons.append(_("Recording(s) are in progress or coming up in few seconds!"))
	if jobs:
		if jobs == 1:
			job = job_manager.getPendingJobs()[0]
			reasons.append("%s: %s (%d%%)" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end))))
		else:
			reasons.append((ngettext("%d job is running in the background!", "%d jobs are running in the background!", jobs) % jobs))
	if eStreamServer.getInstance().getConnectedClients() or StreamServiceList:
			reasons.append(_("Client is streaming from this box!"))
	if not reasons and mediafilesInUse(session) and retvalue in (1, 2, 4, 42):
			reasons.append(_("A file from media is in use!"))
	return "\n".join(reasons)
	def hddConfirmed(self, confirmed):
		if not confirmed:
			return
		try:
			job_manager.AddJob(self.action())
			for job in job_manager.getPendingJobs():
				if job.name in (_("Initializing storage device..."), _("Checking filesystem..."),_("Converting ext3 to ext4...")):
					self.showJobView(job)
					break
		except Exception, ex:
			self.session.open(MessageBox, str(ex), type=MessageBox.TYPE_ERROR, timeout=10)
예제 #28
0
	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 or saving 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 soon, or you are saving timeshift!") + '\n'

		if reason and inStandby:
			session.nav.record_event.append(self.getRecordEvent)
			self.skinName = ""
		elif reason and not inStandby:
			text = {
				QUIT_SHUTDOWN: _("Really shutdown now?"),
				QUIT_REBOOT: _("Really reboot now?"),
				QUIT_RESTART: _("Really restart now?"),
				QUIT_UPGRADE_FP: _("Really upgrade the front processor and reboot now?"),
				QUIT_FACTORY_RESET: _("Really do a factory reset and reboot now?"),
				QUIT_RESTORE_BACKUP: _("Really restore settings and reboot now?"),
				QUIT_UPGRADE_PROGRAM: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()),
				QUIT_IMAGE_RESTORE: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName()),
				QUIT_UPGRADE_MICOM: _("Really upgrade the front panel and reboot now?")
			}.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)
	def updateDownloadList(self):
		self.progressTimer.stop()
		downloadList = []
		for job in job_manager.getPendingJobs():
			task = job.tasks[job.current_task]
			totalSize = ''
			if hasattr(task, 'totalSize') and task.totalSize > 0:
				totalSize = _('%.1fMB') % (task.totalSize / 1000000.0)
			downloadList.append((job, '%s ...' % job.name, job.getStatustext(),
				int(task.progress), '%s%%' % str(task.progress), totalSize))
		self['list'].setList(downloadList)
		if downloadList:
			self.progressTimer.startLongTimer(1)
예제 #30
0
	def __init__(self, session, timeout=-1, default_yes = True):
#		self.retval = retvalue
		recordings = session.nav.getRecordings()
		jobs = len(job_manager.getPendingJobs())
		self.connected = False
		reason = ""
		next_rec_time = -1
		self.testTimer = eTimer()
		self.testTimer.callback.append(self.switchAndroid)

		if not recordings:
			next_rec_time = session.nav.RecordTimer.getNextRecordingTime()	
		if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
			reason = _("Recording(s) are in progress or coming up in few seconds!") + '\n'
		if jobs:
			if jobs == 1:
				job = job_manager.getPendingJobs()[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!") % jobs) + '\n'

		if reason:
			text = "Are you sure you want to switch to Android now?"
			MessageBox.__init__(self, session, reason+text, type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes)
			self.skinName = "MessageBox"
			session.nav.record_event.append(self.getRecordEvent)
			self.connected = True
			self.onShow.append(self.__onShow)
			self.onHide.append(self.__onHide)
			return
		else:
			text = "Are you sure you want to switch to Android now?"
			MessageBox.__init__(self, session, text, type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes)
			self.skinName = "MessageBox"
			self.onShow.append(self.__onShow)
			self.onHide.append(self.__onHide)
			return
예제 #31
0
    def rebuildTaskList(self):
        self.tasklist = []
        for job in job_manager.getPendingJobs():
            if self.job_name == job.name:
                self.tasklist.append(
                    (job, job.name, job.getStatustext(),
                     int(100 * job.progress / float(job.end)),
                     str(100 * job.progress / float(job.end)) + '%'))

        if len(self.tasklist):
            self['tasklist'].setList(self.tasklist)
            self['tasklist'].updateList(self.tasklist)
            self.Timer.startLongTimer(2)
        else:
            self.close(True)
예제 #32
0
    def doShutDown(self):
        do_shutdown = True

        jobs = job_manager.getPendingJobs()
        if jobs:
            print(
                "[AutoShutDown] there are running jobs  --> ignore shutdown callback"
            )
            do_shutdown = False

        if config.autoshutdown.disable_net_device.value and checkIP(
                config.autoshutdown.net_device.value):
            print(
                "[AutoShutDown] network device is not down  --> ignore shutdown callback"
            )
            do_shutdown = False

        if config.autoshutdown.exclude_time_off.value:
            begin = config.autoshutdown.exclude_time_off_begin.value
            end = config.autoshutdown.exclude_time_off_end.value
            if checkExcludeTime(begin, end):
                print(
                    "[AutoShutDown] shutdown timer end but we are in exclude interval --> ignore power off"
                )
                do_shutdown = False

        if config.autoshutdown.epgrefresh.value == True and os.path.exists(
                "/usr/lib/enigma2/python/Plugins/Extensions/EPGRefresh/EPGRefresh.py"
        ):
            begin = config.plugins.epgrefresh.begin.value
            end = config.plugins.epgrefresh.end.value
            if checkExcludeTime(begin, end):
                print(
                    "[AutoShutDown] in EPGRefresh interval => restart of Timer"
                )
                do_shutdown = False

        if config.autoshutdown.disable_hdd.value and checkHardDisk():
            print(
                "[AutoShutDown] At least one hard disk is active  --> ignore shutdown callback"
            )
            do_shutdown = False

        if do_shutdown:
            print("[AutoShutDown] PowerOff STB")
            session.open(Screens.Standby.TryQuitMainloop, 1)
        else:
            self.cancelShutDown()
예제 #33
0
	def rebuildTaskList(self):
		idx = self['tasklist'].getIndex()
		self.tasklist = []
		for job in job_manager.getPendingJobs():
			#self.tasklist.append((job,job.name,job.getStatustext(),int(100*job.progress/float(job.end)) ,str(100*job.progress/float(job.end)) + "%" ))
			progress = job.getProgress()
			if job.name.startswith(_('Run script')) and job.status == job.IN_PROGRESS: #fake progress for scripts
				if progress >= 99:
					job.tasks[job.current_task].setProgress(51)
				else:
					job.tasks[job.current_task].setProgress(progress + 1)
			self.tasklist.append((job, job.name, job.getStatustext(), progress, str(progress) + " %" ))
		self['tasklist'].setList(self.tasklist)
		self['tasklist'].updateList(self.tasklist)
		self['tasklist'].setIndex(idx)
		self.Timer.startLongTimer(1)
예제 #34
0
    def rebuildTaskList(self):
        self.tasklist = []
        for job in job_manager.getPendingJobs():
            if self.job_name == job.name:
                self.tasklist.append((job,
                 job.name,
                 job.getStatustext(),
                 int(100 * job.progress / float(job.end)),
                 str(100 * job.progress / float(job.end)) + '%'))

        if len(self.tasklist):
            self['tasklist'].setList(self.tasklist)
            self['tasklist'].updateList(self.tasklist)
            self.Timer.startLongTimer(2)
        else:
            self.close(True)
예제 #35
0
    def rebuildTaskList(self):
        size=''

            
        try:
            txt=open("/tmp/filesize").read()
            size=str(int(txt)/(1024*1024))+"MB"
           
        except:
            size=" "
        
        self.tasklist = []
        
        for job in job_manager.getPendingJobs():
            
            status=job.getStatustext()
            try:fsize=freespace()
            except:fsize=''
            sizestr=dlocation+" "+fsize
            self['title'].setText(_(sizestr))
            
            if 'progress' in status.lower():
               
                
                try:
                    filesize=os.path.getsize(dlocation+job.name)
                    filesize=str(int(filesize)/(1024*1024))+"MB"
                except:
                    filesize=''
                size=filesize+"/"+size    
                self.tasklist.append((job,
                 job.name,
                 status,
                 int(100 * job.progress / float(job.end)),
                 str(100 * job.progress / float(job.end)) + '%'+" "+size))
            else :
                self.tasklist.append((job,
                 job.name,
                 status,
                 int(100 * job.progress / float(job.end)),
                 str(100 * job.progress / float(job.end)) + '%'))
        self['tasklist'].setList(self.tasklist)
        self['tasklist'].updateList(self.tasklist)
        self.Timer.startLongTimer(2)
예제 #36
0
 def __init__(self, session, retvalue = 1, timeout = -1, default_yes = True):
     self.retval = retvalue
     self.ptsmainloopvalue = retvalue
     recordings = session.nav.getRecordings()
     jobs = len(job_manager.getPendingJobs())
     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 inTimeshift:
         reason = _('You seem to be in timeshift!') + '\n'
         default_yes = True
         timeout = 30
     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()),
          44: _('Really upgrade the front panel and reboot now?'),
          45: _('Really WOL now?')}.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)
예제 #37
0
	def close(self, value):
		if not value:
			MessageBox.close(self, True)
		else:
			if self.connected_jobs:
				self.connected_jobs = False
				self.check_jobs_timer.stop()
				for job in job_manager.getPendingJobs():
					job.abort()
				reason = self.checkTimers()
				if reason:
					self["text"].setText(reason + self.question)
					self.session.nav.record_event.append(self.getRecordEvent)
					self.connected_timers = True
				else:
					quitMainloop(self.retval)
			else:
				if self.connected_timers:
					self.connected_timers = False
					self.session.nav.record_event.remove(self.getRecordEvent)
				quitMainloop(self.retval)
예제 #38
0
def viewdownloads(session, plugin_path = None):
    tasklist = []
    size=''
    try:
        txt=open("/tmp/filesize").read()
        size=str(int(txt)/(1024*1024))+"MB"
       
    except:
        size=" "

        
    for job in job_manager.getPendingJobs():        
        status=job.getStatustext()

        
        if 'progress' in status.lower():
          
             try:
                filesize=os.path.getsize(dlocation+job.name)
                filesize=str(int(filesize)/(1024*1024))+"MB"
             except:
                filesize=''
             size=filesize+"/"+size  
            
             tasklist.append((job,
             job.name,
             status,
             int(100 * job.progress / float(job.end)),
             str(100 * job.progress / float(job.end)) + '%'+" "+size))
        else :
             tasklist.append((job,
             job.name,
             status,
             int(100 * job.progress / float(job.end)),
             str(100 * job.progress / float(job.end)) + '%'))
    session.open(downloadTasksScreen, plugin_path, tasklist)
예제 #39
0
    def start_download(self, path):
        image = self['downloadmenu'].getCurrent()
        if image:
            self.image_url = self['downloadmenu'].getCurrent()[0]
            self.image_name = self['downloadmenu'].getCurrent()[4]
            self.path = path
            self.file_name = os.path.join(self.path + '/', os.path.basename(self.image_url))
            if fileExists(self.file_name) and self.verify_download():
                self.download_finished(True)
            else:
                job_name = _('Download %s') % self.image_name
                job_manager.AddJob(downloadJob(self.image_url, self.file_name, job_name))
                tasklist = []
                for job in job_manager.getPendingJobs():
                    if job.name == job_name:
                        tasklist.append((job,
                         job.name,
                         job.getStatustext(),
                         int(100 * job.progress / float(job.end)),
                         str(100 * job.progress / float(job.end)) + '%'))
                        break

                if len(tasklist):
                    self.session.openWithCallback(self.download_finished, DownloadTaskScreen, self.skin_path, tasklist, job_name)
예제 #40
0
파일: Standby.py 프로젝트: ostende/EGAMI-2
 def __init__(self, session, retvalue=1, timeout=-1, default_yes=True):
     self.retval = retvalue
     self.ptsmainloopvalue = retvalue
     recordings = session.nav.getRecordings(
         False,
         Components.RecordingConfig.recType(
             config.recording.warn_box_restart_rec_types.getValue()))
     jobs = len(job_manager.getPendingJobs())
     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 inTimeshift:
         reason = _('You seem to be in timeshift!') + '\n'
         default_yes = True
         timeout = 30
     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?'),
             16:
             _('Really reboot into Recovery Mode?'),
             42:
             _('Really upgrade your %s %s and reboot now?') %
             (getMachineBrand(), getMachineName()),
             43:
             _('Really reflash your %s %s and reboot now?') %
             (getMachineBrand(), getMachineName()),
             44:
             _('Really upgrade the front panel and reboot now?'),
             45:
             _('Really WOL now?')
         }.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)
예제 #41
0
	def splitTaimerStop(self):
		self.splitTaimer.stop()
		if self.action == 'startup':
			from YouTubeVideoUrl import YouTubeVideoUrl
			self.ytdl = YouTubeVideoUrl()
			self.createBuild()
			self.createMainList()
			for job in job_manager.getPendingJobs():
				self.activeDownloads += 1
		elif self.action in ['playVideo', 'downloadVideo']:
			videoUrl = self.value[6]
			if not videoUrl: # remember video url
				videoUrl, urlError = self.getVideoUrl()
				if urlError:
					self.session.open(MessageBox,
						_('There was an error in extract video url:\n%s') % urlError, 
						MessageBox.TYPE_INFO, timeout = 8)
				else:
					count = 0
					for entry in self.entryList:
						if entry[0] == self.value[0]:
							entryList = entry
							self.entryList[count] = (
									entryList[0], # Id
									entryList[1], # Thumbnail url
									entryList[2], # Thumbnail
									entryList[3], # Title
									entryList[4], # Views
									entryList[5], # Duration
									videoUrl,     # Video url
									entryList[7], # Description
									entryList[8], # Likes
									entryList[9], # Dislikes
									entryList[10] # Big thumbnail url
								)
							break
						count += 1
			if videoUrl:
				if self.action == 'playVideo':
					service = eServiceReference(4097, 0, videoUrl)
					service.setName(self.value[3])
					current = [self.value[3], self.value[4], self.value[5], self.value[7],
						self.value[8], self.value[9], self.value[10]]
					print "[YouTube] Play:", videoUrl
					self.session.openWithCallback(self.playCallback,\
						YouTubePlayer, service = service, current = current)
				else:
					self.videoDownload(videoUrl, self.value[3])
					self.setEntryList()
					self.setPreviousList()
			else:
				self.setEntryList()
				self.setPreviousList()
		else:
			entryList = self.createEntryList()
			if not entryList:
				self.session.open(MessageBox,
					_('There was an error in creating entry list!\nMaybe try other feeds...'), 
					MessageBox.TYPE_INFO, timeout = 8)
				self.setEntryList()
				self.setPreviousList()
				self.prevEntryList.pop()
			else:
				self.entryList = entryList
				self.text = self.value[1]
				self.setEntryList()
예제 #42
0
    def __init__(self, session, retvalue=1, timeout=-1, default_yes=True):
        self.retval = retvalue
        self.ptsmainloopvalue = retvalue
        recordings = session.nav.getRecordings()
        jobs = len(job_manager.getPendingJobs())
        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 jobs:
            reason = (ngettext("%d job is running in the background!",
                               "%d jobs are running in the background!", jobs)
                      % jobs) + '\n'
            if jobs == 1:
                job = job_manager.getPendingJobs()[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!") %
                           jobs) + '\n'
            if job.name == "VFD Checker":
                reason = ""
        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 STB_BOX and reboot now?"),
                43: _("Really reflash your STB_BOX and reboot now?"),
                44: _("Really upgrade the front panel and reboot now?")
            }.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)
예제 #43
0
파일: Standby.py 프로젝트: aitchala/enigma2
 def __init__(self, session, retvalue=1, timeout=-1, default_yes=True):
     self.retval = retvalue
     recordings = session.nav.getRecordings()
     jobs = len(job_manager.getPendingJobs())
     self.connected = False
     reason = ""
     next_rec_time = -1
     if not recordings:
         next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
     if recordings or (next_rec_time > 0 and
                       (next_rec_time - time()) < 360):
         reason = _(
             "Recording(s) are in progress or coming up in few seconds!"
         ) + '\n'
     if jobs:
         if jobs == 1:
             job = job_manager.getPendingJobs()[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!") %
                        jobs) + '\n'
     if retvalue == 16:
         reason += _("Really reboot into Recovery Mode?\n")
     if reason:
         if retvalue == 1:
             MessageBox.__init__(self,
                                 session,
                                 reason + _("Really shutdown now?"),
                                 type=MessageBox.TYPE_YESNO,
                                 timeout=timeout,
                                 default=default_yes)
         elif retvalue == 2:
             MessageBox.__init__(self,
                                 session,
                                 reason + _("Really reboot now?"),
                                 type=MessageBox.TYPE_YESNO,
                                 timeout=timeout,
                                 default=default_yes)
         elif retvalue == 4:
             pass
         elif retvalue == 16:
             MessageBox.__init__(
                 self,
                 session,
                 reason +
                 _("You won't be able to leave Recovery Mode without physical access to the device!"
                   ),
                 type=MessageBox.TYPE_YESNO,
                 timeout=timeout,
                 default=default_yes)
         else:
             MessageBox.__init__(self,
                                 session,
                                 reason + _("Really restart now?"),
                                 type=MessageBox.TYPE_YESNO,
                                 timeout=timeout,
                                 default=default_yes)
         self.skinName = "MessageBox"
         session.nav.record_event.append(self.getRecordEvent)
         self.connected = True
         self.onShow.append(self.__onShow)
         self.onHide.append(self.__onHide)
     else:
         self.skin = """<screen name="TryQuitMainloop" position="0,0" size="0,0" flags="wfNoBorder"/>"""
         Screen.__init__(self, session)
         self.close(True)
예제 #44
0
	def hddConfirmed(self, confirmed):
		if not confirmed:
			return
		try:
			job_manager.AddJob(self.action())
			for job in job_manager.getPendingJobs():