Save the icon and set its attributes.
176303
def set_icon(self, icon, qtgui_module):
        """"""

        if self._use_fallback:
            icon.addFile(self._fallback)
        else:
            for role, pixmap in self._roles.items():
                if role.endswith("off"):
                    mode = role[:-3]
                    state = qtgui_module.QIcon.Off
                elif role.endswith("on"):
                    mode = role[:-2]
                    state = qtgui_module.QIcon.On
                else:
                    continue

                mode = getattr(qtgui_module.QIcon, mode.title())

                if pixmap:
                    icon.addPixmap(qtgui_module.QPixmap(pixmap), mode, state)
                else:
                    icon.addPixmap(qtgui_module.QPixmap(), mode, state)

        self.icon = icon
824120
public function save()
    {
        $this->getHandler()->write($this->getId(), serialize($this->attributes));
        $this->started = false;
    }
1303645
public void setIcon(final IconType iconType) {
        if (iconType != null)
            attrMixin.setAttribute(ICON, iconType.getCssName());
        else
            attrMixin.removeAttribute(ICON);
    }
1049653
public function init(): void
    {
        // check if $iconSet implement all available icons from self::TYPE_TO_REGEX
        $diff1 = array_keys(\array_diff_assoc($this->iconSet, self::TYPE_TO_REGEX));
        $diff2 = array_keys(\array_diff_assoc(self::TYPE_TO_REGEX, $this->iconSet));
        if ($diff1 === $diff2) {
            \trigger_error('Icon set doesn\'t implement all range of icons.');
        }
    }
730739
def paint(self, iconic, painter, rect, mode, state, options):
        """"""
        for opt in options:
            self._paint_icon(iconic, painter, rect, mode, state, opt)
1165194
private void adaptIconTint() {
        Drawable icon = getIcon();

        if (icon != null) {
            DrawableCompat.setTintList(icon, tintList);
            DrawableCompat.setTintMode(icon, tintMode);
        }
    }
1360571
def setup_icons(self, ):
        
        plus_icon = get_icon('glyphicons_433_plus_bright.png', asicon=True)
        self.addnew_tb.setIcon(plus_icon)
172074
protected void initializeIcons()
	{
		float f = 1F / 3F;

		icons[LEFT | TOP] = part1.copy().clip(0, 0, f, f);
		icons[TOP] = part1.copy().clip(f, 0, f, f);
		icons[RIGHT | TOP] = part1.copy().clip(2 * f, 0, f, f);

		icons[LEFT] = part1.copy().clip(0, f, f, f);
		icons[NONE] = part1.copy().clip(f, f, f, f);
		icons[RIGHT] = part1.copy().clip(2 * f, f, f, f);

		icons[LEFT | BOTTOM] = part1.copy().clip(0, 2 * f, f, f);
		icons[BOTTOM] = part1.copy().clip(f, 2 * f, f, f);
		icons[RIGHT | BOTTOM] = part1.copy().clip(2 * f, 2 * f, f, f);

		icons[LEFT | TOP | BOTTOM] = part2.copy().clip(0, 0, f, f);
		icons[TOP | BOTTOM] = part2.copy().clip(f, 0, f, f);
		icons[LEFT | RIGHT | TOP] = part2.copy().clip(2 * f, 0, f, f);

		icons[LEFT | RIGHT] = part2.copy().clip(0, f, f, f);
		icons[FULL] = part2.copy().clip(f, f, f, f);
		//icons[LEFT | RIGHT] = icon.copy().clip(2 * f, f, f, f);

		icons[LEFT | RIGHT | BOTTOM] = part2.copy().clip(0, 2 * f, f, f);
		//icons[TOP | BOTTOM] = icon.copy().clip(f, 2 * f, f, f);
		icons[RIGHT | TOP | BOTTOM] = part2.copy().clip(2 * f, 2 * f, f, f);

		initialized = true;
	}
1320849
protected void initIcon(Icon baseIcon, int width, int height, int x, int y, boolean rotated)
	{
		copyFrom(baseIcon);
	}
618721
public void initInfoStyle() {

        m_icon.addStyleName(I_CmsButton.ICON_FONT);
        m_icon.addStyleName(I_CmsButton.ICON_CIRCLE_HELP);
        m_icon.addStyleName(I_CmsLayoutBundle.INSTANCE.buttonCss().cmsFontIconButton());
        m_icon.addStyleName(I_CmsLayoutBundle.INSTANCE.buttonCss().hoverBlack());
        m_icon.addStyleName(I_CmsLayoutBundle.INSTANCE.buttonCss().helpIcon());
    }
906645
def icon(self, *names, **kwargs):
        """"""
        cache_key = '{}{}'.format(names,kwargs)
        if cache_key not in self.icon_cache:
            options_list = kwargs.pop('options', [{}] * len(names))
            general_options = kwargs

            if len(options_list) != len(names):
                error = '"options" must be a list of size {0}'.format(len(names))
                raise Exception(error)

            if QApplication.instance() is not None:
                parsed_options = []
                for i in range(len(options_list)):
                    specific_options = options_list[i]
                    parsed_options.append(self._parse_options(specific_options,
                                                              general_options,
                                                              names[i]))

                # Process high level API
                api_options = parsed_options

                self.icon_cache[cache_key] = self._icon_by_painter(self.painter, api_options)
            else:
                warnings.warn("You need to have a running "
                              "QApplication to use QtAwesome!")
                return QIcon()
        return self.icon_cache[cache_key]
1257243
private void adaptIcon() {
        if (iconImageView != null) {
            ImageViewCompat.setImageTintList(iconImageView, iconTintList);
            ImageViewCompat.setImageTintMode(iconImageView, iconTintMode);
            iconImageView.setImageDrawable(icon);
            iconImageView.setVisibility(icon != null ? View.VISIBLE : View.GONE);
        }

        adaptTitleContainerVisibility();
    }
89514
public void setStateIcon(StateIcon icon) {

        if (m_stateIcon == null) {
            m_stateIcon = new HTML();
            m_stateIcon.addClickHandler(m_iconSuperClickHandler);
            m_contentPanel.add(m_stateIcon);

        }
        String iconTitle = null;
        I_CmsListItemWidgetCss listItemWidgetCss = I_CmsLayoutBundle.INSTANCE.listItemWidgetCss();
        String styleStateIcon = I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().stateIcon();
        switch (icon) {
            case export:
                m_stateIcon.setStyleName(styleStateIcon + " " + listItemWidgetCss.export());
                iconTitle = Messages.get().key(Messages.GUI_ICON_TITLE_EXPORT_0);
                break;
            case secure:
                m_stateIcon.setStyleName(styleStateIcon + " " + listItemWidgetCss.secure());
                iconTitle = Messages.get().key(Messages.GUI_ICON_TITLE_SECURE_0);
                break;
            case copy:
                m_stateIcon.setStyleName(styleStateIcon + " " + listItemWidgetCss.copyModel());
                break;
            case standard:
            default:
                m_stateIcon.setStyleName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().stateIcon());
                break;
        }
        m_stateIcon.setTitle(concatIconTitles(m_iconTitle, iconTitle));
        m_stateIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    }
528562
def set_icon_file(self, filename, rel="icon"):
        
        mimetype, encoding = mimetypes.guess_type(filename)
        self.add_child("favicon", '<link rel="%s" href="%s" type="%s" />'%(rel, filename, mimetype))
801277
public void init(Icon icon, String text)
    {
        this.setText(text);
        this.setIcon(icon);
        this.setMargin(JScreenConstants.NO_INSETS);
    }
212566
private void updateIcon() {
		// Define the icon.
		int icon = R.drawable.document_gray;
		if(this.selectable) {
			icon = (this.file != null && file.isDirectory())? R.drawable.folder : R.drawable.document;
		}

		// Set the icon.
		this.icon.setImageDrawable(getResources().getDrawable( icon ));

		// Change the color of the text.
		if(icon != R.drawable.document_gray) {
			this.label.setTextColor(getResources().getColor(R.color.daidalos_active_file));
		} else {
			this.label.setTextColor(getResources().getColor(R.color.daidalos_inactive_file));
		}
	}
706538
def save(self):
        """"""
        logger.debug("User requested to save settings. New settings: " + self._settings_str())
        cm.ConfigManager.SETTINGS[cm.PROMPT_TO_SAVE] = not self.autosave_checkbox.isChecked()
        cm.ConfigManager.SETTINGS[cm.SHOW_TRAY_ICON] = self.show_tray_checkbox.isChecked()
        # cm.ConfigManager.SETTINGS[cm.MENU_TAKES_FOCUS] = self.allow_kb_nav_checkbox.isChecked()
        cm.ConfigManager.SETTINGS[cm.SORT_BY_USAGE_COUNT] = self.sort_by_usage_checkbox.isChecked()
        cm.ConfigManager.SETTINGS[cm.UNDO_USING_BACKSPACE] = self.enable_undo_checkbox.isChecked()
        cm.ConfigManager.SETTINGS[cm.NOTIFICATION_ICON] = self.system_tray_icon_theme_combobox.currentData(Qt.UserRole)
        # TODO: After saving the notification icon, apply it to the currently running instance.
        self._save_autostart_settings()