Set the callback function to consume on drag and drop mode changed
        events.

        Callback receives a IDragAndDropModeChangedEvent object.

        Returns the callback_id
173392
def register_on_drag_and_drop_mode_changed(self, callback):
        
        event_type = library.VBoxEventType.on_drag_and_drop_mode_changed
        return self.event_source.register_callback(callback, event_type)
92112
def register_on_snapshot_changed(self, callback):
        
        event_type = library.VBoxEventType.on_snapshot_changed
        return self.event_source.register_callback(callback, event_type)
432607
def register_on_medium_changed(self, callback):
        
        event_type = library.VBoxEventType.on_medium_changed
        return self.event_source.register_callback(callback, event_type)
600654
function (bind, callback) {
                var jsonChangeCallback = null;
                // register as listener for the bindings defined for this control:
                if (bind) {
                    jsonChangeCallback = {
                        fn : callback || this._notifyDataChange,
                        scope : this,
                        args : {
                            tplCtxt : this.tplCtxt,
                            animate : bind.animate
                        }
                    };

                    // addListener throws errors
                    try {
                        // normalize recursive
                        bind.recursive = bind.recursive !== false;
                        this.__json.addListener(bind.inside, bind.to, jsonChangeCallback, true, bind.recursive);
                        // save for disposal
                        this._bindings.push({
                            inside : bind.inside,
                            callback : jsonChangeCallback,
                            to : bind.to,
                            recursive : bind.recursive
                        });
                    } catch (e) {
                        this.$logError(this.SECTION_BINDING_ERROR, [bind.inside, bind.to, this.id,
                                this.tplCtxt.tplClasspath]);
                        jsonChangeCallback = null;
                    }
                    return jsonChangeCallback;
                }
            }
38227
function onChange(_cm, changeObj) {
      var macroModeState = vimGlobalState.macroModeState;
      var lastChange = macroModeState.lastInsertModeChanges;
      while (changeObj) {
        lastChange.expectCursorActivityForChange = true;
        if (changeObj.origin == '+input' || changeObj.origin == 'paste'
            || changeObj.origin === undefined /* only in testing */) {
          var text = changeObj.text.join('\n');
          lastChange.changes.push(text);
        }
        // Change objects may be chained with next.
        changeObj = changeObj.next;
      }
    }
208296
def orify(e, changed_callback):
    
    if not hasattr(e, "callbacks"):  # Event has not been orified yet
        e._set = e.set
        e._clear = e.clear
        e.set = lambda: or_set(e)
        e.clear = lambda: or_clear(e)
        e.callbacks = list()
    # Keep track of one callback per multi event
    e.callbacks.append(changed_callback)
434497
def __callback(self, event, *args, **kwargs):
        # type: (str, *Any, **Any) -> Any
        
        comp_callback = self.context.get_callback(event)
        if not comp_callback:
            # No registered callback
            return True

        # Call it
        result = comp_callback(self.instance, *args, **kwargs)
        if result is None:
            # Special case, if the call back returns nothing
            return True

        return result
742913
def state_change_handler(self, evt):
        """"""
        datapath = evt.datapath
        assert datapath is not None
        if datapath.id == self._querier.dpid:
            if evt.state == MAIN_DISPATCHER:
                self._querier.start_loop(datapath)
            elif evt.state == DEAD_DISPATCHER:
                self._querier.stop_loop()
115878
def orify(event, changed_callback):
    '''
    

    '''
    event.changed = changed_callback
    if not hasattr(event, '_set'):
        # `set`/`clear` methods have not been overridden on event yet.
        # Override methods to call `changed_callback` after performing default
        # action.
        event._set = event.set
        event._clear = event.clear
        event.set = lambda: or_set(event)
        event.clear = lambda: or_clear(event)
1221806
def trigger(self):
        
        if self.last_button:
            button_index = min(self.last_button, len(self.callbacks)) - 1
            click_style = 0 if self.clicks == 1 else 1
            callback = self.callbacks[button_index][click_style]
            if callback:
                # we can do test for str as only python > 3 is supported
                if isinstance(callback, str):
                    # no parameters
                    callback_name = callback
                    callback_args = []
                else:
                    # has parameters
                    callback_name = callback[0]
                    callback_args = callback[1:]
                callback_function = getattr(self.parent.module, callback_name)
                callback_function(*callback_args)
                # We want to ensure that the module has the latest output.  The
                # best way is to call the run method of the module
                self.parent.module.run()
            else:
                self.parent.py3.prevent_refresh()
        self.last_button = None
        self.clicks = 0
903551
def on_change_dir_button(self, event):
        
        currentDirectory = self.WD #os.getcwd()
        change_dir_dialog = wx.DirDialog(self.panel,
                                         "Choose your working directory to create or edit a MagIC contribution:",
                                         defaultPath=currentDirectory,
                                         style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON | wx.DD_CHANGE_DIR)
        result = change_dir_dialog.ShowModal()
        if result == wx.ID_CANCEL:
            return
        if result == wx.ID_OK:
            self.WD = change_dir_dialog.GetPath()
            self.dir_path.SetValue(self.WD)
        change_dir_dialog.Destroy()
        wait = wx.BusyInfo('Initializing data object in new directory, please wait...')
        wx.SafeYield()
        print('-I- Initializing magic data object')
        # make new builder object, but reuse old data_model
        self.er_magic = builder.ErMagicBuilder(self.WD, self.er_magic.data_model)
        print('-I- Read in any available data from working directory')
        self.er_magic.get_all_magic_info()
        print('-I- Initializing headers')
        self.er_magic.init_default_headers()
        self.er_magic.init_actual_headers()
        del wait
742993
def register_on_machine_state_changed(self, callback):
        
        event_type = library.VBoxEventType.on_machine_state_changed
        return self.event_source.register_callback(callback, event_type)
147715
def set_event(self, ref, tk_event, callback):
        
        # has an EventCallback been created for this tk event
        if tk_event not in self._event_callbacks:
            self._event_callbacks[tk_event] = EventCallback(self._widget, self._tks, tk_event)

        # assign this ref to this event callback
        self._refs[ref] = self._event_callbacks[tk_event]

        # set up the callback
        self._refs[ref].set_callback(ref, callback)
1004607
def set_alert_callback(self, callback):
        
        if callable(callable):
            self.http.alert_callback = functools.partial(callback, self)
        else:
            self.http.alert_callback = None
983964
def add_listener(self, on_lifecycle_change):
        
        id = str(uuid.uuid4())
        self._listeners[id] = on_lifecycle_change
        return id
353495
def callback_box_select(attr, old, new):
    ''''''

    # Get indices of selection
    ind = sorted(new['1d']['indices'])

    if new is None:
        start_input.value = '0'
        end_input.value = '0'
    else:
        start_input.value = str(source.data['ind'][ind[0]])
        end_input.value = str(source.data['ind'][ind[-1]])
        msg = '''
              New start and end index values set.
              '''
        output_window.text = output_template.format(msg)

    return None
934773
def callback!(event, options, method, property_options) # TODO: remove args.
      context = options[:context] || self # TODO: test me.

      # TODO: Use Option::Value here. this could be created straight in the DSL with the twin being passed in.
      if context.methods.include?(method) && context.method(method).arity == 1 # TODO: remove in 0.3.
        warn "[Disposable] Callback handlers now receive two options: #{method}(twin, options)."
        return Dispatch.new(@twin).(event, method, property_options) { |twin| context.send(method, twin) }
      end

      Dispatch.new(@twin).(event, method, property_options) { |twin| context.send(method, twin, options) }
    end