Styles the GUI: global fonts and colours.

    Parameters
    ----------
    w : tkinter.tk
        widget element to style
498163
def addStyle(w):
    
    # access global container in root widget
    root = get_root(w)
    g = root.globals
    fsize = g.cpars['font_size']
    family = g.cpars['font_family']

    # Default font
    g.DEFAULT_FONT = font.nametofont("TkDefaultFont")
    g.DEFAULT_FONT.configure(size=fsize, weight='bold', family=family)
    w.option_add('*Font', g.DEFAULT_FONT)

    # Menu font
    g.MENU_FONT = font.nametofont("TkMenuFont")
    g.MENU_FONT.configure(family=family)
    w.option_add('*Menu.Font', g.MENU_FONT)

    # Entry font
    g.ENTRY_FONT = font.nametofont("TkTextFont")
    g.ENTRY_FONT.configure(size=fsize, family=family)
    w.option_add('*Entry.Font', g.ENTRY_FONT)

    # position and size
    # root.geometry("320x240+325+200")

    # Default colours. Note there is a difference between
    # specifying 'background' with a capital B or lowercase b
    w.option_add('*background', g.COL['main'])
    w.option_add('*HighlightBackground', g.COL['main'])
    w.config(background=g.COL['main'])
1327665
def style(self, style):
        
        if style is None:
            self._remove_rStyle()
        elif self.rStyle is None:
            self._add_rStyle(val=style)
        else:
            self.rStyle.val = style
210787
public void addTopWidget(Widget w) {

        m_content.removeStyleName(I_CmsLayoutBundle.INSTANCE.dialogCss().alertMainContent());
        m_topWidgets.getElement().getStyle().clearDisplay();
        m_topWidgets.add(w);
    }
87568
def create_widget(self):
        
        d = self.declaration
        self.widget = View(self.get_context(), None, d.style)
71148
def format_output(self, rendered_widgets):
        
        ret = [u'<ul class="formfield">']
        for i, field in enumerate(self.fields):
            label = self.format_label(field, i)
            help_text = self.format_help_text(field, i)
            ret.append(u'<li>%s %s %s</li>' % (
                label, rendered_widgets[i], field.help_text and help_text))

        ret.append(u'</ul>')
        return ''.join(ret)
303805
def _convert_label(label):
    
    style = qt_font_to_style(label.get("font"), label.get("color"))
    return {
        "text": html.escape(label["text"]),
        "rotation": 0,
        "style": style,
        "x": int(label["x"]),
        "y": int(label["y"])
    }
881434
def _set_widget_background_color(widget, color):
        
        pal = widget.palette()
        pal.setColor(pal.Base, color)
        widget.setPalette(pal)
340515
def initGroupStyle(self, useIcons=True, columnCount=None):
        
        flags      = self.flags()
        if flags & QtCore.Qt.ItemIsSelectable:
            flags ^= QtCore.Qt.ItemIsSelectable
            self.setFlags(flags)
        
        if useIcons:
            ico        = QtGui.QIcon(resources.find('img/treeview/triangle_right.png'))
            expand_ico = QtGui.QIcon(resources.find('img/treeview/triangle_down.png'))
            
            self.setIcon(0, ico)
            self.setExpandedIcon(0, expand_ico)
        
        palette = QtGui.QApplication.palette()
        
        line_clr = palette.color(palette.Mid)
        base_clr = palette.color(palette.Button)
        text_clr = palette.color(palette.ButtonText)
        
        gradient = QtGui.QLinearGradient()
        
        gradient.setColorAt(0.00, line_clr)
        gradient.setColorAt(0.03, line_clr)
        gradient.setColorAt(0.04, base_clr.lighter(105))
        gradient.setColorAt(0.25, base_clr)
        gradient.setColorAt(0.96, base_clr.darker(105))
        gradient.setColorAt(0.97, line_clr)
        gradient.setColorAt(1.00, line_clr)
        
        h = self._fixedHeight
        if not h:
            h = self.sizeHint(0).height()
        if not h:
            h = 18
        
        gradient.setStart(0.0, 0.0)
        gradient.setFinalStop(0.0, h)
        
        brush = QtGui.QBrush(gradient)
        
        tree = self.treeWidget()
        columnCount = columnCount or (tree.columnCount() if tree else self.columnCount())

        for i in range(columnCount):
            self.setForeground(i, text_clr)
            self.setBackground(i, brush)
417789
def set_font(self, font, option):
        """"""
        # Update fonts in all plugins
        set_font(font, option=option)
        plugins = self.main.widgetlist + self.main.thirdparty_plugins
        for plugin in plugins:
            plugin.update_font()
50334
def create_widget(self):
        
        d = self.declaration
        self.widget = EditText(self.get_context(), None,
                               d.style or "@attr/editTextStyle")
795806
public void setFontStyle() {

        if (!CmsStringUtil.isEmptyOrWhitespaceOnly(m_styleName)) {
            removeStyleName(m_styleName);
        }
        String id = new CmsUUID().getStringValue();
        m_styleName = CSS_CLASSNAME + "_" + id;
        addStyleName(m_styleName);
        String js = "var elements = document.getElementsByClassName('"
            + m_styleName
            + "');"
            + "var iframeContainer = elements[0];"
            + "var iframe = iframeContainer.getElementsByTagName('iframe')[0];"
            + "var iframeBody = iframe.contentDocument.getElementsByTagName('body')[0];"
            + "iframeBody.style.fontFamily='\"Open Sans\", sans-serif';";

        JavaScript.getCurrent().execute(js);

    }
1113786
def set_style(primary=None, secondary=None):
    
    global _primary_style, _secondary_style
    if primary:
        _primary_style = primary
    if secondary:
        _secondary_style = secondary
740953
def create_widget(self):
        
        d = self.declaration
        self.widget = CheckBox(self.get_context(), None,
                               d.style or "@attr/checkboxStyle")
750238
def install_ui_colorscheme(self, name, style_dict):
        
        assert isinstance(name, six.text_type)
        assert isinstance(style_dict, dict)

        self.ui_styles[name] = style_dict
719459
def _get_format_from_style(self, token, style):
        
        result = QtGui.QTextCharFormat()
        items = list(style.style_for_token(token).items())
        for key, value in items:
            if value is None and key == 'color':
                # make sure to use a default visible color for the foreground
                # brush
                value = drift_color(self.background, 1000).name()
            if value:
                if key == 'color':
                    result.setForeground(self._get_brush(value))
                elif key == 'bgcolor':
                    result.setBackground(self._get_brush(value))
                elif key == 'bold':
                    result.setFontWeight(QtGui.QFont.Bold)
                elif key == 'italic':
                    result.setFontItalic(value)
                elif key == 'underline':
                    result.setUnderlineStyle(
                        QtGui.QTextCharFormat.SingleUnderline)
                elif key == 'sans':
                    result.setFontStyleHint(QtGui.QFont.SansSerif)
                elif key == 'roman':
                    result.setFontStyleHint(QtGui.QFont.Times)
                elif key == 'mono':
                    result.setFontStyleHint(QtGui.QFont.TypeWriter)
        if token in [Token.Literal.String, Token.Literal.String.Doc,
                     Token.Comment]:
            # mark strings, comments and docstrings regions for further queries
            result.setObjectType(result.UserObject)
        return result
687575
def make_gui(self):
        
        self.option_window = Toplevel()
        self.option_window.protocol("WM_DELETE_WINDOW", self.on_exit)
        self.canvas_frame = tk.Frame(self, height=500)
        self.option_frame = tk.Frame(self.option_window, height=300)
        self.canvas_frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
        self.option_frame.pack(side=tk.RIGHT, fill=None, expand=False)
        self.make_options_frame()
        self.make_canvas_frame()
        self.disable_singlecolor()
1362972
def setCurrentFont(self, font):
        
        self.blockSignals(True)
        self.editor().setCurrentFont(font)
        self.blockSignals(False)
        self.refreshUi()