def _on_change(self, *args, **kwargs):
# Making sure we set the settings + variables.
if len(self._next_settings_update.keys()) > 0:
logger.debug('Setting mode settings right now!')
try:
await self.update_settings(self._next_settings_update)
except Exception as e:
logging.error('Can\'t set the script mode settings! Error: {}'.format(str(e)))
self._next_settings_update = dict()
if len(self._next_variables_update.keys()) > 0:
logger.debug('Setting mode variables right now!')
try:
await self.update_variables(self._next_variables_update)
except Exception as e:
logging.error('Can\'t set the script mode variables! Error: {}'.format(str(e)))
self._next_variables_update = dict()
# Make sure we send to the signal when mode is been changed.
if self._current_script != self._next_script:
await script_mode_changed.send_robust({
'unloaded_script': self._current_script, 'loaded_script': self._next_script
})
await self.get_current_script(refresh=True)
评论列表
文章目录