def _resume(self): xr_util.notification(__addonname__, __language__(30101), 3000) for name in self._resume_methods: try: method = getattr(self, name) method() except: pass
def start(self, resume=None, monitor=None, firstRun=False): self._initVariables() # Resume state if system argument provided or if resume setting enabled and not running for the first time if ( (resume == True) or ( resume == None and self._setts.getBool("resume_state") and not firstRun ) ): self._state.beginResume() else: # Show service started notification xr_util.notification(__addonname__, __language__(30104), 3000) # If monitoring hasn't been disabled if ( monitor != False ): # Implement settings self._implementSettings() # Start main checking loop self._mainLoop() # Script finishing self._stop()
def _checkCallbacks(self): # Check if either timer callback flags have been set if ( self._doStateCallback ): # stateMonitor flag has been set, reset the flag and grab the current state self._doStateCallback = False self._state.grab() if ( self._state.hasChanged() ): # If state has changed, reset hasChanged flag and then do stuff (nothing required yet) self._state.resetChanged() if ( self._doSettingsCallback ): # settingMonitor flag has been set, reset the flag and check for settings changed self._doSettingsCallback = False self._setts.check() if ( self._setts.haveChanged() ): # If settings have changed, reset hasChanged flag and then implment changed settings self._setts.resetChanged() self._implementSettings() # Show Settings Updated notification xr_util.notification(__addonname__, __language__(30103), 3000)
def _stop(self): # Stop and wait for both timer threads to finish self._stopSettingsMonitor() self._stopStateMonitor() # Show Service Stopped notification xr_util.notification(__addonname__, __language__(30105), 3000)