def set_lock_state(locking): catch_labrad_error( self, server.lock_setting(setting_id) if locking else server.unlock_setting(setting_id) )
def update_lock_state(is_locked): label_prefix = 'status' if is_locked: success, has_lock = yield catch_labrad_error( self, server.has_setting_lock(setting_id) ) if not success: server.is_setting_locked(setting_id).addCallback(update_lock_state) returnValue(None) label_suffix = 'has lock' if has_lock else 'locked' else: label_suffix = 'unlocked' label.setText(label_prefix + ': ' + label_suffix)
def update_lock_status(is_locked): prefix = 'status' if is_locked: success, has_lock = yield catch_labrad_error( self, server.has_lock() ) if not success: is_locked = yield server.is_locked() update_lock_status(is_locked) returnValue(None) suffix = 'has lock' if has_lock else 'locked' else: suffix = 'unlocked' lock_label.setText(prefix + ': ' + suffix)
def set_lock(is_locking): catch_labrad_error( self, server.lock() if is_locking else server.unlock() )