예제 #1
0
    def __init__(self, parent=None):
        BasicSettings.__init__(self, parent)
        self.l = l = QFormLayout(self)
        self.setLayout(l)

        def family_getter(w):
            return unicode(w.currentFont().family())

        def family_setter(w, val):
            w.setCurrentFont(QFont(val))

        families = {"serif": _("Serif text"), "sans": _("Sans-serif text"), "mono": _("Monospaced text")}
        for fam, text in families.iteritems():
            w = QFontComboBox(self)
            self("preview_%s_family" % fam, widget=w, getter=family_getter, setter=family_setter)
            l.addRow(_("Font family for &%s:") % text, w)

        w = self.choices_widget("preview_standard_font_family", families, "serif", "serif")
        l.addRow(_("&Style for standard text:"), w)

        w = self("preview_base_font_size")
        w.setMinimum(8), w.setMaximum(100), w.setSuffix(" px")
        l.addRow(_("&Default font size:"), w)
        w = self("preview_mono_font_size")
        w.setMinimum(8), w.setMaximum(100), w.setSuffix(" px")
        l.addRow(_("&Monospace font size:"), w)
        w = self("preview_minimum_font_size")
        w.setMinimum(4), w.setMaximum(100), w.setSuffix(" px")
        l.addRow(_("Mi&nimum font size:"), w)
예제 #2
0
    def __init__(self, parent=None):
        BasicSettings.__init__(self, parent)
        self.l = l = QFormLayout(self)
        self.setLayout(l)

        def family_getter(w):
            return unicode(w.currentFont().family())

        def family_setter(w, val):
            w.setCurrentFont(QFont(val))

        families = {'serif':_('Serif text'), 'sans':_('Sans-serif text'), 'mono':_('Monospaced text')}
        for fam, text in families.iteritems():
            w = QFontComboBox(self)
            self('preview_%s_family' % fam, widget=w, getter=family_getter, setter=family_setter)
            l.addRow(_('Font family for &%s:') % text, w)

        w = self.choices_widget('preview_standard_font_family', families, 'serif', 'serif')
        l.addRow(_('&Style for standard text:'), w)

        w = self('preview_base_font_size')
        w.setMinimum(8), w.setMaximum(100), w.setSuffix(' px')
        l.addRow(_('&Default font size:'), w)
        w = self('preview_mono_font_size')
        w.setMinimum(8), w.setMaximum(100), w.setSuffix(' px')
        l.addRow(_('&Monospace font size:'), w)
        w = self('preview_minimum_font_size')
        w.setMinimum(4), w.setMaximum(100), w.setSuffix(' px')
        l.addRow(_('Mi&nimum font size:'), w)
예제 #3
0
    def __init__(self, parent=None):
        BasicSettings.__init__(self, parent)
        self.l = l = QFormLayout(self)
        self.setLayout(l)

        def family_getter(w):
            return unicode(w.currentFont().family())

        def family_setter(w, val):
            w.setCurrentFont(QFont(val))

        families = {'serif':_('Serif text'), 'sans':_('Sans-serif text'), 'mono':_('Monospaced text')}
        for fam, text in families.iteritems():
            w = QFontComboBox(self)
            self('preview_%s_family' % fam, widget=w, getter=family_getter, setter=family_setter)
            l.addRow(_('Font family for &%s:') % text, w)

        w = self.choices_widget('preview_standard_font_family', families, 'serif', 'serif')
        l.addRow(_('Style for standard &text:'), w)

        w = self('preview_base_font_size')
        w.setMinimum(8), w.setMaximum(100), w.setSuffix(' px')
        l.addRow(_('&Default font size:'), w)
        w = self('preview_mono_font_size')
        w.setMinimum(8), w.setMaximum(100), w.setSuffix(' px')
        l.addRow(_('&Monospace font size:'), w)
        w = self('preview_minimum_font_size')
        w.setMinimum(4), w.setMaximum(100), w.setSuffix(' px')
        l.addRow(_('Mi&nimum font size:'), w)
예제 #4
0
    def __init__(self, parent=None):
        BasicSettings.__init__(self, parent)
        self.l = l = QFormLayout(self)
        self.setLayout(l)

        def default_font(which):
            from PyQt5.QtWebEngineWidgets import QWebEngineSettings
            s = QWebEngineSettings.defaultSettings()
            which = getattr(s, {
                'serif': 'SerifFont',
                'sans': 'SansSerifFont',
                'mono': 'FixedFont'
            }[which])
            return s.fontFamily(which)

        def family_getter(which, w):
            ans = unicode_type(w.currentFont().family())
            if ans == default_font(which):
                ans = None
            return ans

        def family_setter(which, w, val):
            w.setCurrentFont(QFont(val or default_font(which)))

        families = {
            'serif': _('Serif text'),
            'sans': _('Sans-serif text'),
            'mono': _('Monospaced text')
        }
        for fam in sorted(families):
            text = families[fam]
            w = QFontComboBox(self)
            self('engine_preview_%s_family' % fam,
                 widget=w,
                 getter=partial(family_getter, fam),
                 setter=partial(family_setter, fam))
            l.addRow(_('Font family for &%s:') % text, w)

        w = self.choices_widget('preview_standard_font_family', families,
                                'serif', 'serif')
        l.addRow(_('Style for standard &text:'), w)

        w = self('preview_base_font_size')
        w.setMinimum(8), w.setMaximum(100), w.setSuffix(' px')
        l.addRow(_('&Default font size:'), w)
        w = self('preview_mono_font_size')
        w.setMinimum(8), w.setMaximum(100), w.setSuffix(' px')
        l.addRow(_('&Monospace font size:'), w)
        w = self('preview_minimum_font_size')
        w.setMinimum(4), w.setMaximum(100), w.setSuffix(' px')
        l.addRow(_('Mi&nimum font size:'), w)
        l.addRow(_('Background color:'),
                 self.color_override('preview_background'))
        l.addRow(_('Foreground color:'),
                 self.color_override('preview_foreground'))
        l.addRow(_('Link color:'), self.color_override('preview_link_color'))