Configure the global options tab using the settings API.
359126
function init() {
		$_option = 'pressbooks_theme_options_' . $this->getSlug();
		$_page = $_option;
		$_section = $this->getSlug() . '_options_section';

		if ( false === get_option( $_option ) ) {
			add_option( $_option, $this->defaults );
		}

		$custom_styles = Container::get( 'Styles' );
		$v2_compatible = $custom_styles->isCurrentThemeCompatible( 2 );

		add_settings_section(
			$_section,
			$this->getTitle(),
			[ $this, 'display' ],
			$_page
		);

		add_settings_field(
			'chapter_numbers',
			__( 'Part and Chapter Numbers', 'pressbooks' ),
			[ $this, 'renderChapterNumbersField' ],
			$_page,
			$_section,
			[
				__( 'Display part and chapter numbers', 'pressbooks' ),
			]
		);

		add_settings_field(
			'part_label',
			__( 'Part Label', 'pressbooks' ),
			[ $this, 'renderPartLabelField' ],
			$_page,
			$_section,
			[
				__( 'The "part" label is used in the table of contents and in part titles in your webbook and exports.', 'pressbooks' ),
				'label_for' => 'part_label',
			]
		);

		add_settings_field(
			'chapter_label',
			__( 'Chapter Label', 'pressbooks' ),
			[ $this, 'renderChapterLabelField' ],
			$_page,
			$_section,
			[
				__( 'The "chapter" label is used in the table of contents and in chapter titles in your webbook and exports.', 'pressbooks' ),
				'label_for' => 'chapter_label',
			]
		);

		add_settings_field(
			'parse_subsections',
			__( 'Two-Level TOC', 'pressbooks' ),
			[ $this, 'renderTwoLevelTOCField' ],
			$_page,
			$_section,
			[
				__( 'Enable two-level table of contents (displays headings under chapter titles)', 'pressbooks' ),
			]
		);

		add_settings_field(
			'attachment_attributions',
			__( 'Media Attributions', 'pressbooks' ),
			[ $this, 'renderAttachmentAttributionsField' ],
			$_page,
			$_section,
			[
				__( 'Display attributions at the end of a chapter', 'pressbooks' ),
			]
		);

		if ( Container::get( 'Styles' )->isCurrentThemeCompatible( 1 ) === true || Container::get( 'Styles' )->isCurrentThemeCompatible( 2 ) === true ) { // we can only enable foreign language typography for themes that use SCSS

			add_settings_field(
				'pressbooks_global_typography',
				__( 'Language & Script Support', 'pressbooks' ),
				[ $this, 'renderLanguagesField' ],
				$_page,
				$_section,
				[
					__( 'Include fonts to support the following languages and scripts:', 'pressbooks' ),
				]
			);

			register_setting(
				$_page,
				'pressbooks_global_typography',
				[ $this, 'sanitizeLanguages' ]
			);

		}

		add_settings_field(
			'copyright_license',
			__( 'Chapter Licenses', 'pressbooks' ),
			[ $this, 'renderCopyrightLicenseField' ],
			$_page,
			$_section,
			[
				0 => __( 'Do not display section level copyright license', 'pressbooks' ),
				1 => __( 'Display section level license on table of contents in export formats', 'pressbooks' ),
				2 => __( 'Display section level license at end of chapter in export formats', 'pressbooks' ),
			]
		);

		if ( $v2_compatible ) {
			foreach ( [
				'examples' => __( 'Examples', 'pressbooks' ),
				'exercises' => __( 'Exercises', 'pressbooks' ),
				'takeaways' => __( 'Key Takeaways', 'pressbooks' ),
				'objectives' => __( 'Learning Objectives', 'pressbooks' ),
			] as $key => $label ) {
				add_settings_field(
					"edu_textbox_{$key}_section",
					sprintf( '<span style="font-size:1.3em;">%s</span>', $label ),
					[ $this, 'renderTextboxHeader' ],
					$_page,
					$_section,
					[
						sprintf( __( 'Customize colors for %s textboxes using the fields below.', 'pressbooks' ), $label ),
					]
				);

				add_settings_field(
					"edu_textbox_{$key}_header_color",
					sprintf( '<span class="screen-reader-text">%1$s </span>%2$s', $label, __( 'Header Color', 'pressbooks' ) ),
					[ $this, 'renderTextboxColorField' ],
					$_page,
					$_section,
					[
						'key' => "edu_textbox_{$key}_header_color",
						'description' => sprintf( __( 'The header text color for a %s textbox.', 'pressbooks' ), $label ),
					]
				);
				add_settings_field(
					"edu_textbox_{$key}_header_background",
					sprintf( '<span class="screen-reader-text">%1$s </span>%2$s', $label, __( 'Header Background', 'pressbooks' ) ),
					[ $this, 'renderTextboxColorField' ],
					$_page,
					$_section,
					[
						'key' => "edu_textbox_{$key}_header_background",
						'description' => sprintf( __( 'The header background color for a %s textbox.', 'pressbooks' ), $label ),
					]
				);
				add_settings_field(
					"edu_textbox_{$key}_background",
					sprintf( '<span class="screen-reader-text">%1$s </span>%2$s', $label, __( 'Background', 'pressbooks' ) ),
					[ $this, 'renderTextboxColorField' ],
					$_page,
					$_section,
					[
						'key' => "edu_textbox_{$key}_background",
						'description' => sprintf( __( 'The background color for a %s textbox.', 'pressbooks' ), $label ),
					]
				);
			}
		}

		/**
		 * Add custom settings fields.
		 *
		 * @since 3.9.7
		 *
		 * @param string $arg1
		 * @param string $arg2
		 */
		do_action( 'pb_theme_options_global_add_settings_fields', $_page, $_section );

		register_setting(
			$_page,
			$_option,
			[ $this, 'sanitize' ]
		);
	}
178052
private GlobalOptions createGlobalOptions(CommandLine parsedOpts) {
    String host = parsedOpts.hasOption(HOST_OPT) ?
            parsedOpts.getOptionValue(HOST_OPT) : DEFAULT_REST_SERVER_HOST;
    int port = DEFAULT_REST_SERVER_PORT;
    try {
      if (parsedOpts.hasOption(PORT_OPT)) {
        port = Integer.parseInt(parsedOpts.getOptionValue(PORT_OPT));
      }
    } catch (NumberFormatException e) {
      printHelpAndExit("The port must be a valid integer.");
    }

    return new GlobalOptions(host, port);
  }
59373
def add_config_options(self):
        
        # default section
        default = self.config.get_default_section()
        default.add_element(
            Element('debug',
                    e_type=int,
                    e_type_exclude=True,
                    default=0,
                    desc="""debug level : default : 0."""))
116067
protected function configure()
    {
        $this->setName(self::COMMAND_NAME);
        $this->setDescription('Export settings from "core_config_data" into a file');
        $this->addOption('format', 'm', InputOption::VALUE_OPTIONAL, 'Format: yaml, json', 'yaml');
        $this->addOption('hierarchical', 'a', InputOption::VALUE_OPTIONAL, 'Create a hierarchical or a flat structure (not all export format supports that). Enable with: y', 'n');
        $this->addOption('filename', 'f', InputOption::VALUE_OPTIONAL, 'File name into which should the export be written. Defaults into var directory.');
        $this->addOption('include', 'i', InputOption::VALUE_OPTIONAL, 'Path prefix, multiple values can be comma separated; exports only those paths');
        $this->addOption('includeScope', null, InputOption::VALUE_OPTIONAL, 'Scope name, multiple values can be comma separated; exports only those scopes');
        $this->addOption('exclude', 'x', InputOption::VALUE_OPTIONAL, 'Path prefix, multiple values can be comma separated; exports everything except ...');
        $this->addOption('filePerNameSpace', 's', InputOption::VALUE_OPTIONAL, 'Export each namespace into its own file. Enable with: y', 'n');

        parent::configure();
    }
657376
def setup_default_options
      opts = {}
      MsRestAzure::Common::Configurable.keys.map do |key|
        opts[key] = MsRestAzure::Common::Default.options[key]
      end

      opts
    end
782108
def setoption(parser, metadata=None):
    """"""
    parser.add_argument('-v', action='version',
                        version=__version__)
    subparsers = parser.add_subparsers(help='sub commands help')
    create_cmd = subparsers.add_parser('create')
    create_cmd.add_argument('name',
                            help='Specify Python package name.')
    create_cmd.add_argument('-d', dest='description', action='store',
                            help='Short description about your package.')
    create_cmd.add_argument('-a', dest='author', action='store',
                            required=True,
                            help='Python package author name.')
    create_cmd.add_argument('-e', dest='email', action='store',
                            required=True,
                            help='Python package author email address.')
    create_cmd.add_argument('-l', dest='license',
                            choices=metadata.licenses().keys(),
                            default='GPLv3+',
                            help='Specify license. (default: %(default)s)')
    create_cmd.add_argument('-s', dest='status',
                            choices=metadata.status().keys(),
                            default='Alpha',
                            help=('Specify development status. '
                                  '(default: %(default)s)'))
    create_cmd.add_argument('--no-check', action='store_true',
                            help='No checking package name in PyPI.')
    create_cmd.add_argument('--with-samples', action='store_true',
                            help='Generate package with sample code.')
    group = create_cmd.add_mutually_exclusive_group(required=True)
    group.add_argument('-U', dest='username', action='store',
                       help='Specify GitHub username.')
    group.add_argument('-u', dest='url', action='store', type=valid_url,
                       help='Python package homepage url.')
    create_cmd.add_argument('-o', dest='outdir', action='store',
                            default=os.path.abspath(os.path.curdir),
                            help='Specify output directory. (default: $PWD)')
    list_cmd = subparsers.add_parser('list')
    list_cmd.add_argument('-l', dest='licenses', action='store_true',
                          help='show license choices.')
172797
private function options_sub_tabs() {
		$current_tab = isset( $_GET['subtab'] ) ? esc_attr( $_GET['subtab'] ) : 'github_updater';
		echo '<nav class="nav-tab-wrapper" aria-label="Tertiary menu">';
		foreach ( $this->settings_sub_tabs() as $key => $name ) {
			$active = ( $current_tab === $key ) ? 'nav-tab-active' : '';
			echo '<a class="nav-tab ' . $active . '" href="?page=github-updater&tab=github_updater_settings&subtab=' . $key . '">' . $name . '</a>';
		}
		echo '</nav>';
	}
355238
def set_options(self, **options):
        
        self.interactive = False
        self.verbosity = options['verbosity']
        self.symlink = ""
        self.clear = False
        ignore_patterns = []
        self.ignore_patterns = list(set(ignore_patterns))
        self.page_themes_updated = 0
        self.skins_updated = 0
1309670
def setup(self, fname):
        """"""
        self.filename = fname
        self.runconfigoptions = RunConfigOptions(self)
        self.runconfigoptions.set(RunConfiguration(fname).get())
        self.add_widgets(self.runconfigoptions)
        self.add_button_box(QDialogButtonBox.Cancel)
        self.setWindowTitle(_("Run settings for %s") % osp.basename(fname))
260760
protected function configure()
    {
        $bits = explode('\\', get_class($this));

        $this->setName($this->getCommandNamePrefix() . Inflector::tableize(array_pop($bits)))
            ->addOption('debug', '', InputOption::VALUE_NONE, 'Output debug details')
            ->addOption('json', '', InputOption::VALUE_NONE, 'Output JSON')
            ->addOption('environment', 'e', InputOption::VALUE_REQUIRED, 'Environment in which we are are running (development, staging or production)', 'development');
    }
508229
def configure(root_url, **kwargs):
    "
    default = kwargs.pop('default', True)
    kwargs['client_agent'] = 'example-client/' + __version__
    if 'headers' not in kwargs:
        kwargs['headers'] = {}
    kwargs['headers']['Accept-Type'] = 'application/json'
    if default:
        default_config.reset(root_url, **kwargs)
    else:
        Client.config = wac.Config(root_url, **kwargs)
872495
def load_configs(self):
        
        self._load_default_shell_settings()

        # restore tabs startup
        value = self.settings.general.get_boolean('restore-tabs-startup')
        self.get_widget('restore-tabs-startup').set_active(value)

        # restore tabs notify
        value = self.settings.general.get_boolean('restore-tabs-notify')
        self.get_widget('restore-tabs-notify').set_active(value)

        # save tabs when changed
        value = self.settings.general.get_boolean('save-tabs-when-changed')
        self.get_widget('save-tabs-when-changed').set_active(value)

        # login shell
        value = self.settings.general.get_boolean('use-login-shell')
        self.get_widget('use_login_shell').set_active(value)

        # tray icon
        value = self.settings.general.get_boolean('use-trayicon')
        self.get_widget('use_trayicon').set_active(value)

        # popup
        value = self.settings.general.get_boolean('use-popup')
        self.get_widget('use_popup').set_active(value)

        # workspace-specific tab sets
        value = self.settings.general.get_boolean('workspace-specific-tab-sets')
        self.get_widget('workspace-specific-tab-sets').set_active(value)

        # prompt on quit
        value = self.settings.general.get_boolean('prompt-on-quit')
        self.get_widget('prompt_on_quit').set_active(value)

        # prompt on close_tab
        value = self.settings.general.get_int('prompt-on-close-tab')
        self.get_widget('prompt_on_close_tab').set_active(value)
        self.get_widget('prompt_on_quit').set_sensitive(value != 2)

        # gtk theme theme
        value = self.settings.general.get_string('gtk-theme-name')
        combo = self.get_widget('gtk_theme_name')
        for i in combo.get_model():
            if i[0] == value:
                combo.set_active_iter(i.iter)
                break

        # prefer gtk theme theme
        value = self.settings.general.get_boolean('gtk-prefer-dark-theme')
        self.get_widget('gtk_prefer_dark_theme').set_active(value)

        # ontop
        value = self.settings.general.get_boolean('window-ontop')
        self.get_widget('window_ontop').set_active(value)

        # tab ontop
        value = self.settings.general.get_boolean('tab-ontop')
        self.get_widget('tab_ontop').set_active(value)

        # refocus
        value = self.settings.general.get_boolean('window-refocus')
        self.get_widget('window_refocus').set_active(value)

        # losefocus
        value = self.settings.general.get_boolean('window-losefocus')
        self.get_widget('window_losefocus').set_active(value)

        # use VTE titles
        value = self.settings.general.get_boolean('use-vte-titles')
        self.get_widget('use_vte_titles').set_active(value)

        # set window title
        value = self.settings.general.get_boolean('set-window-title')
        self.get_widget('set_window_title').set_active(value)

        # abbreviate tab names
        self.get_widget('abbreviate_tab_names').set_sensitive(value)
        value = self.settings.general.get_boolean('abbreviate-tab-names')
        self.get_widget('abbreviate_tab_names').set_active(value)

        # max tab name length
        value = self.settings.general.get_int('max-tab-name-length')
        self.get_widget('max_tab_name_length').set_value(value)

        self.update_vte_subwidgets_states()

        value = self.settings.general.get_int('window-height')
        self.get_widget('window_height').set_value(value)

        value = self.settings.general.get_int('window-width')
        self.get_widget('window_width').set_value(value)

        # window displacements
        value = self.settings.general.get_int('window-vertical-displacement')
        self.get_widget('window_vertical_displacement').set_value(value)

        value = self.settings.general.get_int('window-horizontal-displacement')
        self.get_widget('window_horizontal_displacement').set_value(value)

        value = self.settings.general.get_int('window-halignment')
        which_button = {
            ALIGN_RIGHT: 'radiobutton_align_right',
            ALIGN_LEFT: 'radiobutton_align_left',
            ALIGN_CENTER: 'radiobutton_align_center'
        }
        self.get_widget(which_button[value]).set_active(True)
        self.get_widget("window_horizontal_displacement").set_sensitive(value != ALIGN_CENTER)

        value = self.settings.general.get_boolean('open-tab-cwd')
        self.get_widget('open_tab_cwd').set_active(value)

        # tab bar
        value = self.settings.general.get_boolean('window-tabbar')
        self.get_widget('window_tabbar').set_active(value)

        # start fullscreen
        value = self.settings.general.get_boolean('start-fullscreen')
        self.get_widget('start_fullscreen').set_active(value)

        # start at GNOME login
        value = self.settings.general.get_boolean('start-at-login')
        self.get_widget('start_at_login').set_active(value)

        # use audible bell
        value = self.settings.general.get_boolean('use-audible-bell')
        self.get_widget('use_audible_bell').set_active(value)

        self._load_screen_settings()

        value = self.settings.general.get_boolean('quick-open-enable')
        self.get_widget('quick_open_enable').set_active(value)
        self.get_widget('quick_open_command_line').set_sensitive(value)
        self.get_widget('quick_open_in_current_terminal').set_sensitive(value)
        text = Gtk.TextBuffer()
        text = self.get_widget('quick_open_supported_patterns').get_buffer()
        for title, matcher, _useless in QUICK_OPEN_MATCHERS:
            text.insert_at_cursor("%s: %s\n" % (title, matcher))
        self.get_widget('quick_open_supported_patterns').set_buffer(text)

        value = self.settings.general.get_string('quick-open-command-line')
        if value is None:
            value = "subl %(file_path)s:%(line_number)s"
        self.get_widget('quick_open_command_line').set_text(value)

        value = self.settings.general.get_boolean('quick-open-in-current-terminal')
        self.get_widget('quick_open_in_current_terminal').set_active(value)

        value = self.settings.general.get_string('startup-script')
        if value:
            self.get_widget('startup_script').set_text(value)

        # use display where the mouse is currently
        value = self.settings.general.get_boolean('mouse-display')
        self.get_widget('mouse_display').set_active(value)

        # scrollbar
        value = self.settings.general.get_boolean('use-scrollbar')
        self.get_widget('use_scrollbar').set_active(value)

        # history size
        value = self.settings.general.get_int('history-size')
        self.get_widget('history_size').set_value(value)

        # infinite history
        value = self.settings.general.get_boolean('infinite-history')
        self.get_widget('infinite_history').set_active(value)

        # scroll output
        value = self.settings.general.get_boolean('scroll-output')
        self.get_widget('scroll_output').set_active(value)

        # scroll keystroke
        value = self.settings.general.get_boolean('scroll-keystroke')
        self.get_widget('scroll_keystroke').set_active(value)

        # default font
        value = self.settings.general.get_boolean('use-default-font')
        self.get_widget('use_default_font').set_active(value)
        self.get_widget('font_style').set_sensitive(not value)

        # font
        value = self.settings.styleFont.get_string('style')
        if value:
            self.get_widget('font_style').set_font_name(value)

        # allow bold font
        value = self.settings.styleFont.get_boolean('allow-bold')
        self.get_widget('allow_bold').set_active(value)

        # use bold is bright
        value = self.settings.styleFont.get_boolean('bold-is-bright')
        self.get_widget('bold_is_bright').set_active(value)

        # palette
        self.fill_palette_names()
        value = self.settings.styleFont.get_string('palette-name')
        self.set_palette_name(value)
        value = self.settings.styleFont.get_string('palette')
        self.set_palette_colors(value)
        self.update_demo_palette(value)

        # cursor shape
        value = self.settings.style.get_int('cursor-shape')
        self.set_cursor_shape(value)

        # cursor blink
        value = self.settings.style.get_int('cursor-blink-mode')
        self.set_cursor_blink_mode(value)

        value = self.settings.styleBackground.get_int('transparency')
        self.get_widget('background_transparency').set_value(MAX_TRANSPARENCY - value)

        value = self.settings.general.get_int('window-valignment')
        self.get_widget('top_align').set_active(value)

        # it's a separated method, to be reused.
        self.reload_erase_combos()

        # custom command context-menu configuration file
        custom_command_file = self.settings.general.get_string('custom-command-file')
        if custom_command_file:
            custom_command_file_name = os.path.expanduser(custom_command_file)
        else:
            custom_command_file_name = None
        custom_cmd_filter = Gtk.FileFilter()
        custom_cmd_filter.set_name(_("JSON files"))
        custom_cmd_filter.add_pattern("*.json")
        self.get_widget('custom_command_file_chooser').add_filter(custom_cmd_filter)
        all_files_filter = Gtk.FileFilter()
        all_files_filter.set_name(_("All files"))
        all_files_filter.add_pattern("*")
        self.get_widget('custom_command_file_chooser').add_filter(all_files_filter)
        if custom_command_file_name:
            self.get_widget('custom_command_file_chooser').set_filename(custom_command_file_name)

        # hooks
        self._load_hooks_settings()
1147719
def make_configure_tab(self):
        
        # Setup the choice between single and multicolor
        modeframe = tk.Frame(self.tab_configure)
        self.mode = tk.IntVar()
        singlecolor = tk.Radiobutton(modeframe, text="Single color", variable=self.mode,
                                     value=1, command=lambda: self.disable_multicolor())
        multicolor = tk.Radiobutton(modeframe, text="Three color", variable=self.mode,
                                    value=3, command=lambda: self.disable_singlecolor())
        self.mode.set(3)
        singlecolor.pack(side=tk.LEFT)
        multicolor.pack(side=tk.LEFT)

        updatebutton = tk.Button(master=modeframe, text="Update",
                                 command=self.update_button_action)
        updatebutton.pack(side=tk.RIGHT)
        modeframe.grid(row=0, column=0)
        self.setup_multicolor()
        self.setup_singlecolor()
909825
function (settings) {
        var self = this;

        settings.autohide = true;
        settings.constrainToViewport = true;

        if (typeof settings.items === 'function') {
          settings.itemsFactory = settings.items;
          settings.items = [];
        }

        if (settings.itemDefaults) {
          var items = settings.items, i = items.length;

          while (i--) {
            items[i] = Tools.extend({}, settings.itemDefaults, items[i]);
          }
        }

        self._super(settings);
        self.classes.add('menu');
      }
496093
def set_settings!(new_settings, options = {}, request_options = {})
      res = set_settings(new_settings, options, request_options)
      wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)
      res
    end
401084
function configure(options) {
    if (options && isArray(options.globalMessages)) {
        globalMessages = options.globalMessages;
    }
    if (options && isObject(options.errorTypes)) {
        errorTypes = options.errorTypes;
    }
}
1175384
def configure(self, options):
        
        self.client.api.configure_plugin(self.name, options)
        self.reload()