def performAfterEvent(self): self["config"].hide() if self.settings.afterEvent.getValue() == "nothing": return elif self.settings.afterEvent.getValue() == "close" and self.job.status == self.job.FINISHED: self.close(False) if self.settings.afterEvent.getValue() == "deepstandby": if not Screens.Standby.inTryQuitMainloop: Notifications.AddNotificationWithCallback(self.sendTryQuitMainloopNotification, MessageBox, _("A sleep timer wants to shut down\nyour receiver. Shutdown now?"), timeout = 20) elif self.settings.afterEvent.getValue() == "standby": if not Screens.Standby.inStandby: Notifications.AddNotificationWithCallback(self.sendStandbyNotification, MessageBox, _("A sleep timer wants to set your\nreceiver to standby. Do that now?"), timeout = 20)
def performAfterEvent(self): self['config'].hide() if self.settings.afterEvent.getValue() == 'nothing': return if self.settings.afterEvent.getValue() == 'close' and self.job.status == self.job.FINISHED: self.close(False) from Screens.MessageBox import MessageBox if self.settings.afterEvent.getValue() == 'deepstandby': if not Screens.Standby.inTryQuitMainloop: Notifications.AddNotificationWithCallback(self.sendTryQuitMainloopNotification, MessageBox, _('A sleep timer wants to shut down\nyour Dreambox. Shutdown now?'), timeout=20, domain='JobManager') elif self.settings.afterEvent.getValue() == 'standby': if not Screens.Standby.inStandby: Notifications.AddNotificationWithCallback(self.sendStandbyNotification, MessageBox, _('A sleep timer wants to set your\nDreambox to standby. Do that now?'), timeout=20, domain='JobManager')
def performAfterEvent(self): self['config'].hide() if self.settings.afterEvent.value == 'nothing': return if self.settings.afterEvent.value == 'close' and self.job.status == self.job.FINISHED: self.close(False) from Screens.MessageBox import MessageBox if self.settings.afterEvent.value == 'deepstandby': if not Screens.Standby.inTryQuitMainloop: Notifications.AddNotificationWithCallback(self.sendTryQuitMainloopNotification, MessageBox, _('A sleep timer wants to shut down\nyour %s %s. Shutdown now?') % (getMachineBrand(), getMachineName()), timeout=20) elif self.settings.afterEvent.value == 'standby': if not Screens.Standby.inStandby: Notifications.AddNotificationWithCallback(self.sendStandbyNotification, MessageBox, _('A sleep timer wants to set your\n%s %s to standby. Do that now?') % (getMachineBrand(), getMachineName()), timeout=20)
def performAfterEvent(self): self["config"].hide() if self.settings.afterEvent.getValue() == "nothing": return elif self.settings.afterEvent.getValue() == "close": self.abort() from Screens.MessageBox import MessageBox if self.settings.afterEvent.getValue() == "deepstandby": if not Screens.Standby.inTryQuitMainloop: Notifications.AddNotificationWithCallback(self.sendTryQuitMainloopNotification, MessageBox, _("A sleep timer wants to shut down\nyour Dreambox. Shutdown now?"), timeout = 20) elif self.settings.afterEvent.getValue() == "standby": if not Screens.Standby.inStandby: Notifications.AddNotificationWithCallback(self.sendStandbyNotification, MessageBox, _("A sleep timer wants to set your\nDreambox to standby. Do that now?"), timeout = 20)
def performAfterEvent(self): self["config"].hide() if self.settings.afterEvent.getValue() == "nothing": return elif self.settings.afterEvent.getValue() == "close" and self.job.status == self.job.FINISHED: self.close(False) if self.settings.afterEvent.getValue() == "deepstandby": if not Screens.Standby.inTryQuitMainloop: msg = _("A sleep timer is about to shut down your receiver. Would you like to proceed?") Notifications.AddNotificationWithCallback(self.sendTryQuitMainloopNotification, MessageBox, msg, timeout=20) elif self.settings.afterEvent.getValue() == "standby": if not Screens.Standby.inStandby: msg = _("A sleep timer is about to put your receiver in standby mode. Would you like to proceed?") Notifications.AddNotificationWithCallback(self.sendStandbyNotification, MessageBox, msg, timeout=20)
def activate(self): if self.state == self.StateRunning: if config.SleepTimer.action.value == "shutdown": if config.SleepTimer.ask.value and not Screens.Standby.inTryQuitMainloop: Notifications.AddNotificationWithCallback(self.shutdown, MessageBox, _("A sleep timer wants to shut down\nyour receiver. Shutdown now?"), timeout = 20) else: self.shutdown(True) elif config.SleepTimer.action.value == "standby": if config.SleepTimer.ask.value and not Screens.Standby.inStandby: Notifications.AddNotificationWithCallback(self.standby, MessageBox, _("A sleep timer wants to set your\nreceiver to standby. Do that now?"), timeout = 20) else: self.standby(True) return True
def _ToDoCallAutotimer(self): if config.plugins.epgrefresh.parse_autotimer.value != "never": if config.plugins.epgrefresh.parse_autotimer.value in ("ask_yes", "ask_no"): defaultanswer = True if config.plugins.epgrefresh.parse_autotimer.value == "ask_yes" else False if self.forcedScan: # only if we are interactive Notifications.AddNotificationWithCallback( self._ToDoCallAutotimerCB, MessageBox, text= _("EPG refresh finished.\nShould AutoTimer be search for new matches?" ), type=MessageBox.TYPE_YESNO, default=defaultanswer, timeout=10) else: self._ToDoCallAutotimerCB(parseAT=defaultanswer) else: if self.forcedScan\ and config.plugins.epgrefresh.parse_autotimer.value == "bg_only": self._nextTodo() else: # config.parse_autotimer = always / bg_only self._ToDoCallAutotimerCB(parseAT=True) else: self._nextTodo()
def isServicePlayable(self, ref, callback): if not config.ParentalControl.configured.value or not config.ParentalControl.servicepinactive.value: return True #Check if configuration has already been read or if the significant values have changed. #If true: read the configuration if self.configInitialized == False or self.storeServicePin != config.ParentalControl.storeservicepin.value: self.getConfigValues() service = ref.toCompareString() if (config.ParentalControl.type.value == LIST_WHITELIST and not self.whitelist.has_key(service)) or ( config.ParentalControl.type.value == LIST_BLACKLIST and self.blacklist.has_key(service)): #Check if the session pin is cached if self.sessionPinCached == True: return True self.callback = callback #Someone started to implement different levels of protection. Seems they were never completed #I did not throw out this code, although it is of no use at the moment levelNeeded = 0 if self.serviceLevel.has_key(service): levelNeeded = self.serviceLevel[service] pinList = self.getPinList()[:levelNeeded + 1] Notifications.AddNotificationWithCallback( boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=pinList, service=ServiceReference(ref).getServiceName(), title=_("this service is protected by a parental control pin"), windowTitle=_("Parental control")) return False else: return True
def __forceRestoreCB(self, backupinfo): try: if backupinfo is None: return else: showError = False backupfile = backupinfo[1].rstrip() if FORCERESTOREGENERALERROR == backupfile: showError = True elif FORCERESTORECANCEL != backupfile and FORCERESTORENOFILES != backupfile: self.executeShScript(EPGBACKUP_SHELL_CONSTANTS["FORCERESTORE"], backupfile) restoredFile = self.executeShScript(EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE"], EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE_RESTORE"]) if restoredFile != "": eEPGCache.getInstance().Lock() eEPGCache.getInstance().load() eEPGCache.getInstance().Unlock() self.session.open(MessageBox, _("Backup-file \"%s\" successfully loaded!") % (restoredFile), type=MessageBox.TYPE_INFO) else: showError = True if showError: errorTxt = self.__getErrortext() Notifications.AddNotificationWithCallback(self.showLogFileCB, MessageBox, text=_("Couldn't load backup-file.\nReason: %s.\nPress OK to see the logfile!") % (errorTxt), type=MessageBox.TYPE_ERROR, timeout=30, domain=EPGBACKUP_NOTIFICATIONDOMAIN) except: debugOut("__forceRestoreCB-Error:\n" + str(format_exc()), forced=True)
def _onSoftwareToolsReady(self, retval=None): if retval is None: return if retval: self.recalcNext(iSoftwareTools.lastDownloadDate) if iSoftwareTools.available_updates is not 0: title = _("There are %s updates available.") % ( iSoftwareTools.available_updates, ) Log.w(title) Log.i(iSoftwareTools.available_updatelist) Notifications.AddNotificationWithCallback( self._onUpdateAnswer, MessageBox, text=_("Do you want to update now?"), windowTitle=title) for fnc in self.onUpdatesAvailable: fnc(iSoftwareTools.available_updates) else: self._session.toastManager.showToast( _("Your Dreambox software is update to date!")) Log.i("There are no updates available.") else: if iSoftwareTools.NetworkConnectionAvailable: Log.w("Package-Feed not available.") else: Log.w("No network connection available.") self._onlineChangedConn = eNetworkManager.getInstance( ).onlineChanged.connect(self.onOnlineStateChanged)
def jobDone(self, job, task, problems): print "job", job, "completed with", problems, "in", task from Tools import Notifications if self.in_background: from Screens.TaskView import JobView self.in_background = False Notifications.AddNotification(JobView, self.active_job) if problems: from Screens.MessageBox import MessageBox if problems[0].RECOVERABLE: Notifications.AddNotificationWithCallback( self.errorCB, MessageBox, _("Error: %s\nRetry?") % (problems[0].getErrorMessage(task))) else: Notifications.AddNotification( MessageBox, _("Error") + (': %s') % (problems[0].getErrorMessage(task)), type=MessageBox.TYPE_ERROR) self.errorCB(False) return #self.failed_jobs.append(self.active_job) self.active_job = None self.kick()
def isServicePlayable(self, ref, callback): if not config.ParentalControl.configured.value or not config.ParentalControl.servicepinactive.value: return True #print "whitelist:", self.whitelist #print "blacklist:", self.blacklist #print "config.ParentalControl.type.value:", config.ParentalControl.type.value #print "not in whitelist:", (service not in self.whitelist) #print "checking parental control for service:", ref.toString() service = ref.toCompareString() if (config.ParentalControl.type.value == "whitelist" and service not in self.whitelist) or ( config.ParentalControl.type.value == "blacklist" and service in self.blacklist): self.callback = callback #print "service:", ServiceReference(service).getServiceName() levelNeeded = 0 if self.serviceLevel.has_key(service): levelNeeded = self.serviceLevel[service] pinList = self.getPinList()[:levelNeeded + 1] Notifications.AddNotificationWithCallback( boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=pinList, service=ServiceReference(ref).getServiceName(), title=_("this service is protected by a parental control pin"), windowTitle=_("Parental control")) return False else: return True
def isServicePlayable(self, ref, callback): if not config.ParentalControl.configured.value or not config.ParentalControl.servicepinactive.value: return True #Check if configuration has already been read or if the significant values have changed. #If true: read the configuration if self.configInitialized == False or self.storeServicePin != config.ParentalControl.storeservicepin.value or self.storeServicePinCancel != config.ParentalControl.storeservicepincancel.value: self.getConfigValues() service = ref.toCompareString() splitted = service.split(':') if splitted[0] == '1' and len(splitted[-1]) and splitted[-1][0] == '/': # check if this is a dvb playback serviceHandler = eServiceCenter.getInstance() info = serviceHandler.info(ref) recrefstr = info and info.getInfoString(ref, iServiceInformation.sServiceref) # get original servicereference of recording... if recrefstr: recref = eServiceReference(recrefstr) service = recref.toCompareString() if (config.ParentalControl.type.value == LIST_WHITELIST and not self.whitelist.has_key(service)) or (config.ParentalControl.type.value == LIST_BLACKLIST and self.blacklist.has_key(service)): #Check if the session pin is cached and return the cached value, if it is. if self.sessionPinCached == True: #As we can cache successful pin- entries as well as canceled pin- entries, #We give back the last action return self.sessionPinCachedValue self.callback = callback #Someone started to implement different levels of protection. Seems they were never completed #I did not throw out this code, although it is of no use at the moment levelNeeded = 0 if self.serviceLevel.has_key(service): levelNeeded = self.serviceLevel[service] pinList = self.getPinList()[:levelNeeded + 1] Notifications.AddNotificationWithCallback(boundFunction(self.servicePinEntered, ref), PinInput, triesEntry = config.ParentalControl.retries.servicepin, pinList = pinList, service = ServiceReference(ref).getServiceName(), title = _("this service is protected by a parental control pin"), windowTitle = _("Parental control"), domain = "ParentalControl") return False else: return True
def switchRCU(self): self.menuKeyCount = 0 # skip non tm rcu self.rcu += 1 if self.rcu == 3: self.rcu += 1 elif self.rcu > 4: self.rcu = 1 rcDevice = os.open("/dev/RCProtocol", os.O_RDWR) fcntl.ioctl(rcDevice, 7, self.rcu) os.close(rcDevice) fd = open(self.rcuSaveFile, "w+") fd.write("%d" % self.rcu) fd.close() # self.session.openWithCallback(self.showVfdMessage, MessageBox, (_("Warning :\n Remote Controller has been set to %s" % self.models.get(self.rcu))), MessageBox.TYPE_WARNING, timeout=7) from Tools import Notifications Notifications.AddNotificationWithCallback( self.showVfdMessage, MessageBox, (_("Warning :\n Remote Controller has been set to %s" % self.models.get(self.rcu))), MessageBox.TYPE_WARNING, timeout=7)
def checkSkin(session, **kwargs): if config.plugins.MerlinSkinThemes.rebuildSkinOnBoot.value: # a config exists for the currently active skin if fileExists(CONFDIR + config.skin.primary_skin.value[:-9] + ".cfg"): print "[MST] - config found for active skin" skinFile = resolveFilename( SCOPE_SKIN) + config.skin.primary_skin.value if fileExists(skinFile): xmlFile = Tree.ElementTree(file=skinFile) root = xmlFile.getroot() if root.find("merlinskinthemes") is not None: print "[MST] - skin was edited with MST and tag is present - assume rebuild is not required" else: print "[MST] - skin was edited with MST but tag is not present - assume rebuild required" configDict = {} # read config data f = open( CONFDIR + config.skin.primary_skin.value[:-9] + ".cfg", 'r') for line in f: configData = line.split(":::") if len(configData) == 2: configDict[configData[0]] = configData[1].strip( "\n") f.close() if fileExists( resolveFilename(SCOPE_SKIN) + config.skin.primary_skin.value[:-9] + "/themes.xml"): # update skin with data from config MerlinSkinThemes.setThemes( resolveFilename(SCOPE_SKIN) + config.skin.primary_skin.value[:-9] + "/themes.xml", resolveFilename(SCOPE_SKIN) + config.skin.primary_skin.value, configDict, "update") Notifications.AddNotificationWithCallback( messageBoxCallback, MessageBox, _("Skin was rebuilt and a restart of enigma2 is required. Do you want to restart now?" ), MessageBox.TYPE_YESNO, 10, windowTitle="MerlinSkinThemes", domain="MerlinSkinThemes") else: print "[MST] - themes.xml not found" Notifications.AddNotification( MessageBox, _("Skin could not be rebuilt due to missing themes.xml" ), MessageBox.TYPE_ERROR, 10, windowTitle="MerlinSkinThemes", domain="MerlinSkinThemes")
def makeBackup(self, interactive=False): try: debugOut("making a backup!") eEPGCache.getInstance().Lock() eEPGCache.getInstance().save() eEPGCache.getInstance().Unlock() self.executeShScript(EPGBACKUP_SHELL_CONSTANTS["MAKEBACKUP"]) self.startStopBackupTimer() if interactive or config.plugins.epgbackup.show_messages_background.value: backupedFile = self.executeShScript( EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE"], EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE_BACKUP"]) if backupedFile != "": Notifications.AddPopup( _("Backup \"%s\" successfully created!") % (backupedFile), MessageBox.TYPE_INFO, 10, domain=EPGBACKUP_NOTIFICATIONDOMAIN) else: errorTxt = self.__getErrortext() Notifications.AddNotificationWithCallback( self.showLogFileCB, MessageBox, text= _("Couldn't create a backup.\nReason: %s.\nPress OK to see the logfile!" ) % (errorTxt), type=MessageBox.TYPE_ERROR, timeout=30, domain=EPGBACKUP_NOTIFICATIONDOMAIN) except: debugOut("makeBackup-Error:\n" + str(format_exc()), forced=True)
def notifyBootCount(self): try: if os.path.exists(BOOTCOUNTERFILE): bootCount = "" fo = open(BOOTCOUNTERFILE) line = fo.readline() while (line): bootCount = line line = fo.readline() fo.close # We have succesfully booted, so delete the counter-File os.remove(BOOTCOUNTERFILE) bootCount = int(bootCount) if bootCount > int( config.plugins.epgbackup.max_boot_count.value): backupedFile = self.executeShScript( EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE"], EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE_BACKUP"]) Notifications.AddNotificationWithCallback( self.askDeleteBadBackupCB, MessageBox, text= _("The EPG-Backup was not performed, because there were %d unsuccessfully boot-attempts!\nThe last restored backup-file was \"%s\".\nDo you want to delete the file?" ) % (bootCount, backupedFile), type=MessageBox.TYPE_YESNO, timeout=10, domain=EPGBACKUP_NOTIFICATIONDOMAIN) except: debugOut("checkBootCount-Error:\n" + str(format_exc()), forced=True)
def showGUIRestartInfo(self): if self.needGUIRestart: for gui_restart in self.needGUIRestart: if gui_restart[0].getText() != gui_restart[1]: InfoText = _( "GUI needs a restart to apply new configuration.\nDo you want to restart the GUI now ?" ) # do some voodoo, because we have no NotificationWithCallback with ID notifications = Notifications.notifications add_notification = True if len(notifications): for note in notifications: if len(note) > 4 and note[4] == "restart_gui": add_notification = False break if add_notification: Notifications.AddNotificationWithCallback( self.confirmGUIRestart, MessageBox, InfoText, timeout=0, default=True) idx = len(Notifications.notifications) - 1 new = Notifications.notifications[idx] new = (new[0], new[1], new[2], new[3], "restart_gui") Notifications.notifications[idx] = new break
def playerClosed(self): if self.job.menupreview: self.closedCB(True) else: from Tools import Notifications Notifications.AddNotificationWithCallback( self.closedCB, MessageBox, _("Do you want to burn this collection to DVD medium?"))
def activate(self): next_state = self.state + 1 self.log(5, "activating state %d" % next_state) if next_state == self.StatePrepared: if self.tryPrepare(): self.log(6, "prepare ok, waiting for begin") # create file to "reserve" the filename # because another recording at the same time on another service can try to record the same event # i.e. cable / sat.. then the second recording needs an own extension... when we create the file # here than calculateFilename is happy if not self.justplay: open(self.Filename + ".ts", "w").close() # Give the Trashcan a chance to clean up try: Trashcan.instance.cleanIfIdle() except Exception, e: print "[TIMER] Failed to call Trashcan.instance.cleanIfIdle()" print "[TIMER] Error:", e # fine. it worked, resources are allocated. self.next_activation = self.begin self.backoff = 0 return True self.log(7, "prepare failed") if self.first_try_prepare: self.first_try_prepare = False cur_ref = NavigationInstance.instance.getCurrentlyPlayingServiceReference( ) if cur_ref and not cur_ref.getPath(): if not config.recording.asktozap.value: self.log(8, "asking user to zap away") Notifications.AddNotificationWithCallback( self.failureCB, MessageBox, _("A timer failed to record!\nDisable TV and try again?\n" ), timeout=20) else: # zap without asking self.log(9, "zap without asking") Notifications.AddNotification( MessageBox, _("In order to record a timer, the TV was switched to the recording service!\n" ), type=MessageBox.TYPE_INFO, timeout=20) self.failureCB(True) elif cur_ref: self.log( 8, "currently running service is not a live service.. so stop it makes no sense" ) else: self.log( 8, "currently no service running... so we dont need to stop it" ) return False
def notifyFailed(self, job, task, problems): from Tools import Notifications from Screens.MessageBox import MessageBox if problems[0].RECOVERABLE: Notifications.AddNotificationWithCallback(self.errorCB, MessageBox, _("Error: %s\nRetry?") % (problems[0].getErrorMessage(task))) return True else: Notifications.AddNotification(MessageBox, job.name + "\n" + _("Error") + ': %s' % (problems[0].getErrorMessage(task)), type = MessageBox.TYPE_ERROR ) return False
def playerClosed(self): if self.job.menupreview: self.closedCB(True) else: Notifications.AddNotificationWithCallback( self.closedCB, MessageBox, _("Do you want to burn this collection to DVD medium?"), domain="JobManager")
def run(self, callback): self.callback = callback if self.job.menupreview: self.previewProject() else: import Screens.Standby if Screens.Standby.inStandby: self.previewCB(False) else: Notifications.AddNotificationWithCallback(self.previewCB, MessageBox, _("Do you want to preview this DVD before burning?"), timeout = 60, default = False, domain = "JobManager")
def run(self, callback): self.callback = callback if self.job.menupreview: self.previewProject() else: from Tools import Notifications Notifications.AddNotificationWithCallback( self.previewCB, MessageBox, _("Do you want to preview this DVD before burning?"), timeout=60, default=False)
def setVideoFrameRate(self, rate): if self.framerate_change_is_locked: return try: f = open("/proc/stb/video/videomode", "r") videomode = f.read() f.close() f = open("/proc/stb/video/videomode_choices", "r") videomode_choices = f.read() f.close() videomode_choices = videomode_choices.split() if rate in ('24', '30'): multi_videomode = videomode if not videomode.endswith(rate): resolutions = ('1080', '2160', '720') for resolution in resolutions: if videomode.startswith(resolution): new_mode = resolution + 'p' + rate if new_mode in videomode_choices: multi_videomode = new_mode break else: for alternative_resolution in resolutions: if alternative_resolution != resolution: new_mode = alternative_resolution + 'p' + rate if new_mode in videomode_choices: multi_videomode = new_mode break else: f = open("/proc/stb/video/videomode_%shz" % rate, "r") multi_videomode = f.read() f.close() if videomode != multi_videomode: self.new_mode = multi_videomode self.cur_mode = videomode self.framerate_change_is_locked = True self.lockTimer.startLongTimer( int(config.plugins.autoresolution.lock_timeout.value)) if config.plugins.autoresolution.ask_apply_mode.value and self.init: Notifications.AddNotificationWithCallback( self.changeFramerateCallback, MessageBox, _("Changing framerate for current service?\nCurrent framerate: %s\nNew framerate: %s\n" ) % (videomode, multi_videomode), MessageBox.TYPE_YESNO, timeout=int( config.plugins.autoresolution.ask_timeout.value)) else: self.changeFramerateCallback(True) if not self.init: self.init = True except IOError: print "[AutoFrameRate] error at reading/writing /proc/stb/video.. files"
def showMessageBox(self): if self.msgVisible is None: self.onExecBegin.remove(self.showMessageBox) self.msgVisible = False if not self.msgVisible: self.msgVisible = True self.avswitch.setInput('SCART') if not self.session.in_exec: self.notificationVisible = True Notifications.AddNotificationWithCallback(self.MsgBoxClosed, MessageBox, _('If you see this, something is wrong with\nyour scart connection. Press OK to return.'), MessageBox.TYPE_ERROR, msgBoxID='scart_msgbox') else: self.msgBox = self.session.openWithCallback(self.MsgBoxClosed, MessageBox, _('If you see this, something is wrong with\nyour scart connection. Press OK to return.'), MessageBox.TYPE_ERROR) return
def performAfterEvent(self): self["config"].hide() if self.settings.afterEvent.value == "nothing": return elif self.settings.afterEvent.value == "close" and self.job.status == self.job.FINISHED: self.close(False) if self.settings.afterEvent.value == "deepstandby": if not Screens.Standby.inTryQuitMainloop: Notifications.AddNotificationWithCallback( self.sendTryQuitMainloopNotification, MessageBox, _("A sleep timer wants to shut down\nyour %s %s. Proceed?") % (getMachineBrand(), getMachineName()), timeout=20) elif self.settings.afterEvent.value == "standby": if not Screens.Standby.inStandby: Notifications.AddNotificationWithCallback( self.sendStandbyNotification, MessageBox, _("A sleep timer wants to set your\n%s %s to standby. Proceed?" ) % (getMachineBrand(), getMachineName()), timeout=20)
def performAfterEvent(self): self["config"].hide() if self.settings.afterEvent.value == "nothing": return elif self.settings.afterEvent.value == "close" and self.job.status == self.job.FINISHED: self.close(False) from Screens.MessageBox import MessageBox if self.settings.afterEvent.value == "deepstandby": if not Screens.Standby.inTryQuitMainloop: Notifications.AddNotificationWithCallback( self.sendTryQuitMainloopNotification, MessageBox, _("A completed task wants to shut down your %s %s.\nShut down now?" ) % (getMachineBrand(), getMachineName()), timeout=20) elif self.settings.afterEvent.value == "standby": if not Screens.Standby.inStandby: Notifications.AddNotificationWithCallback( self.sendStandbyNotification, MessageBox, _("A completed task wants to set your %s %s to standby mode.\nGo to standby mode now?" ) % (getMachineBrand(), getMachineName()), timeout=20)
def askForDSB(self): if not self.manuell: if config.plugins.serienRec.afterAutocheck.value != "0": if config.plugins.serienRec.DSBTimeout.value > 0 and not Screens.Standby.inStandby: print "[SerienRecorder] Try to display shutdown notification..." try: notificationText = "Soll der SerienRecorder die Box in den Ruhemodus (Standby) schalten?" if config.plugins.serienRec.afterAutocheck.value == "2": notificationText = "Soll der SerienRecorder die Box ausschalten (Deep-Standby)?" Notifications.AddNotificationWithCallback(self.gotoDeepStandby, MessageBox, text=notificationText, type=MessageBox.TYPE_YESNO, timeout=config.plugins.serienRec.DSBTimeout.value, default=True) except Exception as e: print "[SerienRecorder] Could not display shutdown notification - shutdown box without notification... (%s)" % str(e) self.gotoDeepStandby(True) else: self.gotoDeepStandby(True)
def check(self, session): if config.misc.fsbl_update_never.value: return self._session = session if FSBLUpdater.isUpdateRequired(self._boxtype): Log.w("FSBL Update required!") choices = [ (_("Yes"), "yes"), (_("No"), "no"), (_("Don't ask again!"), "never") ] txt = _("DO NOT POWER OFF YOUR DEVICE WHILE UPDATING!\nUpdate now?") Notifications.AddNotificationWithCallback(self._startFSBLUpdater, ChoiceBox, list=choices, title = txt, windowTitle=_("Bootloader update required!")) else: Log.i("No FSBL update required!")