Setup button handler.
559255
def setupMovie(self):
    """"""
    if self.state == self.INIT:
      self.sendRtspRequest(self.SETUP)
1175075
function setupGui() {
  // Create training buttons and info texts
  for (let i = 0; i < NUM_CLASSES; i++) {
    const div = document.createElement('div');
    document.body.appendChild(div);
    div.style.marginBottom = '10px';

    // Create training button
    const button = document.createElement('button');
    button.innerText = 'Train ' + i;
    div.appendChild(button);

    // Listen for mouse events when clicking the button
    button.addEventListener('click', () => {
      training = i;
      requestAnimationFrame(() => training = -1);
    });

    // Create info text
    const infoText = document.createElement('span');
    infoText.innerText = ' No examples added';
    div.appendChild(infoText);
    infoTexts.push(infoText);
  }
}
670578
def set_event_handler(self, event, handler):
        """"""
        # QUESTION: Should we raise an exception if `event` is not in some
        # known event-type list?

        self._prepare_persistence_engine()

        callbacks = self._options.get('callbacks', {})
        callbacks[event] = handler
        self._options['callbacks'] = callbacks
504842
def setup_toolbar(self):
        """"""
        self.savefig_btn = create_toolbutton(
            self, icon=ima.icon('filesave'),
            tip=_("Save Image As..."),
            triggered=self.emit_save_figure)
        self.delfig_btn = create_toolbutton(
            self, icon=ima.icon('editclear'),
            tip=_("Delete image"),
            triggered=self.emit_remove_figure)

        toolbar = QVBoxLayout()
        toolbar.setContentsMargins(0, 0, 0, 0)
        toolbar.setSpacing(1)
        toolbar.addWidget(self.savefig_btn)
        toolbar.addWidget(self.delfig_btn)
        toolbar.addStretch(2)

        return toolbar
1261471
def bind(cls, app, *paths, methods=None, name=None, view=None):
        """"""
        # Register self in admin
        if view is None:
            app.ps.admin.register(cls)
            if not paths:
                paths = ('%s/%s' % (app.ps.admin.cfg.prefix, name or cls.name),)
            cls.url = paths[0]
        return super(AdminHandler, cls).bind(app, *paths, methods=methods, name=name, view=view)
759508
def setup(self, check_all=None, exclude_private=None,
              exclude_uppercase=None, exclude_capitalized=None,
              exclude_unsupported=None, excluded_names=None,
              minmax=None, dataframe_format=None):
        
        assert self.shellwidget is not None
        
        self.check_all = check_all
        self.exclude_private = exclude_private
        self.exclude_uppercase = exclude_uppercase
        self.exclude_capitalized = exclude_capitalized
        self.exclude_unsupported = exclude_unsupported
        self.excluded_names = excluded_names
        self.minmax = minmax
        self.dataframe_format = dataframe_format
        
        if self.editor is not None:
            self.editor.setup_menu(minmax)
            self.editor.set_dataframe_format(dataframe_format)
            self.exclude_private_action.setChecked(exclude_private)
            self.exclude_uppercase_action.setChecked(exclude_uppercase)
            self.exclude_capitalized_action.setChecked(exclude_capitalized)
            self.exclude_unsupported_action.setChecked(exclude_unsupported)
            self.refresh_table()
            return

        self.editor = RemoteCollectionsEditorTableView(
                        self,
                        data=None,
                        minmax=minmax,
                        shellwidget=self.shellwidget,
                        dataframe_format=dataframe_format)

        self.editor.sig_option_changed.connect(self.sig_option_changed.emit)
        self.editor.sig_files_dropped.connect(self.import_data)
        self.editor.sig_free_memory.connect(self.sig_free_memory.emit)

        self.setup_option_actions(exclude_private, exclude_uppercase,
                                  exclude_capitalized, exclude_unsupported)

        # Setup toolbar layout.

        self.tools_layout = QHBoxLayout()
        toolbar = self.setup_toolbar()
        for widget in toolbar:
            self.tools_layout.addWidget(widget)
        self.tools_layout.addStretch()
        self.setup_options_button()

        # Setup layout.

        layout = create_plugin_layout(self.tools_layout, self.editor)
        self.setLayout(layout)

        self.sig_option_changed.connect(self.option_changed)
582972
def setup(self):
        """"""
        # If the app was invoked to specified to prepend the path, do so now
        if self.args.prepend_path:
            self._prepend_python_path(self.args.prepend_path)
737151
def setup_signal_handlers(self):
        
        LOGGER.debug('Registering signal handlers')
        signal.signal(signal.SIGABRT, self.on_sigabrt)
874023
public function setup(){
		if($this->hasOption('autoinit') && $this->options()->autoinit){
			if($this->hasOption('default')){
				$this->setValue($this->options()->default);
			}else{
				$this->setValue('now');
			}
		}
	}
336328
public static void setup() {
        // Set the various and sundry OS X-specific system properties
        System.setProperty("apple.laf.useScreenMenuBar", "true");
        System.setProperty("dock:name", "ZAP"); // Broken and unfixed; thanks, Apple
        System.setProperty("com.apple.mrj.application.apple.menu.about.name", "ZAP"); // more thx

        // Override various handlers, so that About, Preferences, and Quit behave in an OS X typical fashion.
        LOGGER.info("Initializing OS X specific settings, despite Apple's best efforts");

        // TODO Remove the menu item File -> Exit, redundant with quit handler.

        try {
            InvocationHandler invocationHandler = (o, m, args) -> {
                // Same method names for both APIs.
                switch (m.getName()) {
                case "handleAbout":
                    showAboutDialog();
                    break;
                case "handlePreferences":
                    showOptionsDialog();
                    break;
                case "handleQuitRequestWith":
                    exitZap();
                    break;
                }
                return null;
            };

            if (SystemUtils.IS_JAVA_1_8) {
                // TODO Remove once targeting Java 9+ (and stop using reflection).
                setupJava8(invocationHandler);
            } else {
                setupJava9Plus(invocationHandler);
            }
        } catch (Throwable e) {
            LOGGER.error("Failed to set up all macOS GUI changes:", e);
        }
    }
695276
function setup() {
  if(Hammer.READY) {
    return;
  }

  // find what eventtypes we add listeners to
  Hammer.event.determineEventTypes();

  // Register all gestures inside Hammer.gestures
  Hammer.utils.each(Hammer.gestures, function(gesture){
    Hammer.detection.register(gesture);
  });

  // Add touch events on the document
  Hammer.event.onTouch(Hammer.DOCUMENT, Hammer.EVENT_MOVE, Hammer.detection.detect);
  Hammer.event.onTouch(Hammer.DOCUMENT, Hammer.EVENT_END, Hammer.detection.detect);

  // Hammer is ready...!
  Hammer.READY = true;
}
637822
protected void setupWindowHandlers() {

        registerHandler(Window.addResizeHandler(event -> setupCutOutPosition(focusElement, targetElement, cutOutPadding, circle)));
        registerHandler(Window.addWindowScrollHandler(event -> setupCutOutPosition(focusElement, targetElement, cutOutPadding, circle)));
    }
1246095
public function setup() {
		$input_keys = array_keys((array) elgg_get_config('input'));
		$request_keys = array_keys((array) $_REQUEST);
		$keys = array_unique(array_merge($input_keys, $request_keys));
		foreach ($keys as $key) {
			if ($key) {
				$this->params->$key = get_input($key);
			}
		}
	}
699608
public function setup() {

		$this->struct['modal'] = $this->get_base();
		$this->config();
		$this->struct['modal']['config']['view'] = $this->struct['modal']['config']['template'];
		unset( $this->struct['modal']['config']['template'] );
		add_action( 'uix_control_item_submit_' . $this->slug, $this->struct['modal']['config']['callback'], 100 );
		parent::setup();
		$this->set_submit();
	}
1225588
def setup_signals(self, ):
        
        prjlvl = self.prjbrws.get_level(0)
        prjlvl.new_root.connect(self.update_browsers)
        for rb in self._releasetype_button_mapping.values():
            rb.toggled.connect(self.releasetype_btn_toggled)

        shotdesclvl = self.shotbrws.get_level(3)
        shotselcb = partial(self.selection_changed,
                            source=self.shotbrws,
                            update=self.shotverbrws,
                            commentbrowser=self.shotcommentbrws,
                            mapper=self.shot_info_mapper)
        shotdesclvl.new_root.connect(shotselcb)
        shotverlvl = self.shotverbrws.get_level(0)
        shotverlvl.new_root.connect(self.shot_ver_sel_changed)
        shotmappercb = partial(self.set_mapper_index, mapper=self.shot_info_mapper)
        shotverlvl.new_root.connect(shotmappercb)
        shotverlvl.new_root.connect(partial(self.shotcommentbrws.set_root, 0))

        assetdesclvl = self.assetbrws.get_level(3)
        assetselcb = partial(self.selection_changed,
                             source=self.assetbrws,
                             update=self.assetverbrws,
                             commentbrowser=self.assetcommentbrws,
                             mapper=self.asset_info_mapper)
        assetdesclvl.new_root.connect(assetselcb)
        assetverlvl = self.assetverbrws.get_level(0)
        assetverlvl.new_root.connect(self.asset_ver_sel_changed)
        assetmappercb = partial(self.set_mapper_index, mapper=self.asset_info_mapper)
        assetverlvl.new_root.connect(assetmappercb)
        assetverlvl.new_root.connect(partial(self.assetcommentbrws.set_root, 0))

        self.current_pb.clicked.connect(self.set_to_current)
        self.asset_open_path_tb.clicked.connect(self.open_asset_path)
        self.shot_open_path_tb.clicked.connect(self.open_shot_path)
        self.refresh_tb.clicked.connect(self.refresh)
319951
function() {
			var self = this;

			if (typeof(settings.preinit) == "function") {
				settings.preinit(self);
			} else {
				plupload.each(settings.preinit, function(func, name) {
					self.bind(name, func);
				});
			}

			bindEventListeners.call(this);

			// Check for required options
			if (!settings.browse_button || !settings.url) {
				this.trigger('Error', {
					code : plupload.INIT_ERROR,
					message : plupload.translate('Init error.')
				});
				return;
			}

			initControls.call(this, settings, function(inited) {
				if (typeof(settings.init) == "function") {
					settings.init(self);
				} else {
					plupload.each(settings.init, function(func, name) {
						self.bind(name, func);
					});
				}

				if (inited) {
					self.runtime = o.Runtime.getInfo(getRUID()).type;
					self.trigger('Init', { runtime: self.runtime });
					self.trigger('PostInit');
				} else {
					self.trigger('Error', {
						code : plupload.INIT_ERROR,
						message : plupload.translate('Init error.')
					});
				}
			});
		}
113404
def install_handler!(opts={}, &block)
      stat = find_stat(opts, &block)
      raise NoAvailableHandler unless stat
      stat.install
    end