Notify the controller of a new mode setting.
198535
def on_mode_button(self, my_button, state):
        """"""
        if state:
            # The new mode is the label of the button
            self.controller.set_mode(my_button.get_label())
248436
def _notify_change(self, model, attr, old, new, hint=None, setter=None, callback_invoker=None):
        ''' 

        '''
        # if name changes, update by-name index
        if attr == 'name':
            if old is not None:
                self._all_models_by_name.remove_value(old, model)
            if new is not None:
                self._all_models_by_name.add_value(new, model)

        if hint is None:
            serializable_new = model.lookup(attr).serializable_value(model)
        else:
            serializable_new = None

        event = ModelChangedEvent(self, model, attr, old, new, serializable_new, hint, setter, callback_invoker)
        self._trigger_on_change(event)
1156419
protected final void notifyChanged() {
        for (int i = mObservers.size() - 1; i >= 0; i--) {
            mObservers.get(i).onChanged();
        }
    }
221778
def set_mode(self, mode, custom_mode = 0, custom_sub_mode = 0):
        ''''''
        mav_autopilot = self.field('HEARTBEAT', 'autopilot', None)
        if mav_autopilot == mavlink.MAV_AUTOPILOT_PX4:
            self.set_mode_px4(mode, custom_mode, custom_sub_mode)
        else:
            self.set_mode_apm(mode)
409830
public function onBeforeWrite() {
        parent::onBeforeWrite();
        
        if(empty($this->owner->DefaultPreviewMode)) {
            $this->owner->DefaultPreviewMode=Config::inst()->get('UserPreviewPreference', 'DefaultMode');
        }
        
        
        //If changed ensure their is a session message
        if($this->owner->isChanged('DefaultPreviewMode')) {
            Controller::curr()->getRequest()->getSession()->set('ShowPreviewSettingChangeReload', true);
            $this->isSaving=true;
        }
    }
1138565
def _notify_change(self):
        
        d = self.declaration
        self._notify_count -= 1
        if self._notify_count == 0:
            #: Tell the UI we made changes
            self.adapter.notifyDataSetChanged(now=True)
            self.get_context().timed_call(
                500, self._queue_pending_calls)
1052841
def sleep(self):
        """"""
        logger.debug("Sleep the controller")
        self.write(Registers.MODE_1, self.mode_1 | (1 << Mode1.SLEEP))
1243473
function (newMode, noSave) {
            if (mode != newMode) {
                mode = newMode;
                if (!noSave) {
                    saveState();
                }
            }

            if (!uaSniffed.isIE || mode != "moving") {
                timer = setTimeout(refreshState, 1);
            }
            else {
                inputStateObj = null;
            }
        }
1295995
def notify_init(self):
        '''  '''
        _session_count = len(self._sessions)
        self._update_session_count(1, _session_count)
        if _session_count == 1:
            self._run_queued_callbacks()
385329
def focusInEvent(self, event):
        """"""
        self.focus_changed.emit()
        return super(ControlWidget, self).focusInEvent(event)
104730
def setmode(mode):
    
    if hasattr(mode, '__getitem__'):
        set_custom_pin_mappings(mode)
        mode = CUSTOM

    assert mode in [BCM, BOARD, SUNXI, CUSTOM]
    global _mode
    _mode = mode
235201
def selection_notification(self, model, property, info):
        """"""
        if model is not self.current_state_machine_m or len(self.current_state_machine_m.ongoing_complex_actions) > 0:
            return
        state_machine_m = model
        assert isinstance(state_machine_m.selection, Selection)
        if len(state_machine_m.selection.states) == 1 and len(state_machine_m.selection) == 1:
            self.activate_state_tab(state_machine_m.selection.get_selected_state())
866262
protected void activeStatusChanged(boolean newActiveState) throws PushStateException {
      active = newActiveState;
      log.debugf("changed mode %s", this);
      if (active && singletonConfiguration.pushStateWhenCoordinator())
         doPushState();
   }
416334
def set_mode(mode)
      raise UnsupportedModeError unless @onboard_pin.supported_modes.include?(mode)
      @board.set_pin_mode(@number, mode) unless current_mode == mode
    end
885725
def setCurrentMode( self, mode ):
        
        self.scene().setCurrentMode(mode)
        self.scene().setSceneRect(0, 0, self.width() - 5, self.height() - 5)
        if ( not self.signalsBlocked() ):
            self.currentModeChanged.emit(mode)
146804
def set_mode(self, mode):
        """"""
        _LOGGER.debug('State change called from alarm device')
        if not mode:
            _LOGGER.info('No mode supplied')
        elif mode not in CONST.ALL_MODES:
            _LOGGER.warning('Invalid mode')
        response_object = self._lupusec.set_mode(CONST.MODE_TRANSLATION[mode])
        if response_object['result'] != 1:
            _LOGGER.warning('Mode setting unsuccessful')

        self._json_state['mode'] = mode
        _LOGGER.info('Mode set to: %s', mode)
        return True
165959
def notify(self, level, value, target=None, ntype=None, rule=None):
        """"""
        # Did we see the event before?
        if target in self.state and level == self.state[target]:
            return False

        # Do we see the event first time?
        if target not in self.state and level == 'normal' \
                and not self.reactor.options['send_initial']:
            return False

        self.state[target] = level
        return self.reactor.notify(level, self, value, target=target, ntype=ntype, rule=rule)