def write_settings(): global SETTINGS_WRITER_WATCHER SETTINGS_WRITER_WATCHER.clear() try: while True: axis, setting_name, value, write_flag = SETTINGS_WRITER_QUEUE.get() if axis is None: break event.send( axis, "write_setting", axis.config, setting_name, value, write_flag) finally: SETTINGS_WRITER_WATCHER.set()
def set(self, axis, setting_name, value, write=True): ''' *set setting (if updated) *send event *write ''' old_value = self.get(axis, setting_name) if value == old_value: return setting_value = self._set_setting(axis, setting_name, value) try: event.send(axis, setting_name, setting_value) finally: SETTINGS_WRITER_QUEUE.put((axis, setting_name, setting_value, write))