Exemplo n.º 1
0
 def apply_settings(self, prefs=None):  # {{{
     prefs = prefs or tprefs
     self.setLineWrapMode(QPlainTextEdit.WidgetWidth if prefs['editor_line_wrap'] else QPlainTextEdit.NoWrap)
     theme = THEMES.get(prefs['editor_theme'], None)
     if theme is None:
         theme = THEMES[default_theme()]
     self.apply_theme(theme)
Exemplo n.º 2
0
    def __init__(self, parent=None):
        BasicSettings.__init__(self, parent)
        self.l = l = QFormLayout(self)
        self.setLayout(l)

        fc = FontFamilyChooser(self)
        self('editor_font_family', widget=fc, getter=attrgetter('font_family'), setter=lambda x, val: setattr(x, 'font_family', val))
        fc.family_changed.connect(self.emit_changed)
        l.addRow(_('Editor font &family:'), fc)

        fs = self('editor_font_size')
        fs.setMinimum(8), fs.setSuffix(' pt'), fs.setMaximum(50)
        l.addRow(_('Editor font &size:'), fs)

        auto_theme = _('Automatic (%s)') % default_theme()
        choices = {k:k for k in THEMES}
        choices['auto'] = auto_theme
        theme = self.choices_widget('editor_theme', choices, 'auto', 'auto')
        l.addRow(_('&Color scheme:'), theme)

        tw = self('editor_tab_stop_width')
        tw.setMinimum(2), tw.setSuffix(_(' characters')), tw.setMaximum(20)
        l.addRow(_('Width of &tabs:'), tw)

        lw = self('editor_line_wrap')
        lw.setText(_('&Wrap long lines in the editor'))
        l.addRow(lw)
Exemplo n.º 3
0
    def __init__(self, parent=None):
        BasicSettings.__init__(self, parent)
        self.l = l = QFormLayout(self)
        self.setLayout(l)

        fc = FontFamilyChooser(self)
        self('editor_font_family', widget=fc, getter=attrgetter('font_family'), setter=lambda x, val: setattr(x, 'font_family', val))
        fc.family_changed.connect(self.emit_changed)
        l.addRow(_('Editor font &family:'), fc)

        fs = self('editor_font_size')
        fs.setMinimum(8), fs.setSuffix(' pt'), fs.setMaximum(50)
        l.addRow(_('Editor font &size:'), fs)

        auto_theme = _('Automatic (%s)') % default_theme()
        choices = {k:k for k in THEMES}
        choices['auto'] = auto_theme
        theme = self.choices_widget('editor_theme', choices, 'auto', 'auto')
        l.addRow(_('&Color scheme:'), theme)

        tw = self('editor_tab_stop_width')
        tw.setMinimum(2), tw.setSuffix(_(' characters')), tw.setMaximum(20)
        l.addRow(_('Width of &tabs:'), tw)

        lw = self('editor_line_wrap')
        lw.setText(_('&Wrap long lines in the editor'))
        l.addRow(lw)
Exemplo n.º 4
0
 def apply_settings(self, prefs=None):  # {{{
     prefs = prefs or tprefs
     self.setLineWrapMode(QPlainTextEdit.WidgetWidth if prefs['editor_line_wrap'] else QPlainTextEdit.NoWrap)
     theme = THEMES.get(prefs['editor_theme'], None)
     if theme is None:
         theme = THEMES[default_theme()]
     self.apply_theme(theme)
     w = self.fontMetrics()
     self.space_width = w.width(' ')
     self.setTabStopWidth(prefs['editor_tab_stop_width'] * self.space_width)
Exemplo n.º 5
0
 def apply_settings(self, prefs=None):  # {{{
     prefs = prefs or tprefs
     self.setLineWrapMode(QPlainTextEdit.WidgetWidth if prefs['editor_line_wrap'] else QPlainTextEdit.NoWrap)
     theme = THEMES.get(prefs['editor_theme'], None)
     if theme is None:
         theme = THEMES[default_theme()]
     self.apply_theme(theme)
     w = self.fontMetrics()
     self.space_width = w.width(' ')
     self.setTabStopWidth(prefs['editor_tab_stop_width'] * self.space_width)
Exemplo n.º 6
0
 def apply_settings(self, prefs=None, dictionaries_changed=False):  # {{{
     prefs = prefs or tprefs
     self.setLineWrapMode(QPlainTextEdit.WidgetWidth if prefs["editor_line_wrap"] else QPlainTextEdit.NoWrap)
     theme = THEMES.get(prefs["editor_theme"], None)
     if theme is None:
         theme = THEMES[default_theme()]
     self.apply_theme(theme)
     w = self.fontMetrics()
     self.space_width = w.width(" ")
     self.setTabStopWidth(prefs["editor_tab_stop_width"] * self.space_width)
     if dictionaries_changed:
         self.highlighter.rehighlight()
Exemplo n.º 7
0
    def __init__(self, parent=None):
        BasicSettings.__init__(self, parent)
        self.dictionaries_changed = False
        self.l = l = QFormLayout(self)
        self.setLayout(l)

        fc = FontFamilyChooser(self)
        self('editor_font_family', widget=fc, getter=attrgetter('font_family'), setter=lambda x, val: setattr(x, 'font_family', val))
        fc.family_changed.connect(self.emit_changed)
        l.addRow(_('Editor font &family:'), fc)

        fs = self('editor_font_size')
        fs.setMinimum(8), fs.setSuffix(' pt'), fs.setMaximum(50)
        l.addRow(_('Editor font &size:'), fs)

        auto_theme = _('Automatic (%s)') % default_theme()
        choices = {k:k for k in THEMES}
        choices['auto'] = auto_theme
        theme = self.choices_widget('editor_theme', choices, 'auto', 'auto')
        l.addRow(_('&Color scheme:'), theme)

        tw = self('editor_tab_stop_width')
        tw.setMinimum(2), tw.setSuffix(_(' characters')), tw.setMaximum(20)
        l.addRow(_('Width of &tabs:'), tw)

        lw = self('editor_line_wrap')
        lw.setText(_('&Wrap long lines in the editor'))
        l.addRow(lw)

        lw = self('replace_entities_as_typed')
        lw.setText(_('&Replace HTML entities as they are typed'))
        lw.setToolTip('<p>' + _(
            'With this option, every time you type in a complete html entity, such as &amp;hellip;'
            ' it is automatically replaced by its corresponding character. The replacement'
            ' happens only when the trailing semi-colon is typed.'))
        l.addRow(lw)

        lw = self('editor_show_char_under_cursor')
        lw.setText(_('Show the name of the current character before the cursor along with the line and column number'))
        l.addRow(lw)

        lw = self('pretty_print_on_open')
        lw.setText(_('Beautify individual files automatically when they are opened'))
        lw.setToolTip('<p>' + _(
            'This will cause the beautify current file action to be performed automatically every'
            ' time you open a HTML/CSS/etc. file for editing.'))
        l.addRow(lw)

        self.dictionaries = d = QPushButton(_('Manage &spelling dictionaries'), self)
        d.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        d.clicked.connect(self.manage_dictionaries)
        l.addRow(d)
Exemplo n.º 8
0
 def apply_theme(self):
     f = self.font()
     f.setFamily(tprefs['editor_font_family'] or default_font_family())
     f.setPointSize(tprefs['editor_font_size'])
     self.setFont(f)
     theme = THEMES.get(tprefs['editor_theme'], None)
     if theme is None:
         theme = THEMES[default_theme()]
     pal = self.palette()
     pal.setColor(pal.Window, theme_color(theme, 'Normal', 'bg'))
     pal.setColor(pal.WindowText, theme_color(theme, 'Normal', 'fg'))
     pal.setColor(pal.AlternateBase, theme_color(theme, 'HighlightRegion', 'bg'))
     pal.setColor(pal.LinkVisited, theme_color(theme, 'Keyword', 'fg'))
     self.setPalette(pal)
     if hasattr(self, 'box'):
         self.box.relayout()
     self.update()
Exemplo n.º 9
0
    def __init__(self, parent=None):
        BasicSettings.__init__(self, parent)
        self.l = l = QFormLayout(self)
        self.setLayout(l)

        fc = FontFamilyChooser(self)
        self('editor_font_family', widget=fc, getter=attrgetter('font_family'), setter=lambda x, val: setattr(x, 'font_family', val))
        fc.family_changed.connect(self.emit_changed)
        l.addRow(_('Editor font &family:'), fc)

        fs = self('editor_font_size')
        fs.setMinimum(8), fs.setSuffix(' pt'), fs.setMaximum(50)
        l.addRow(_('Editor font &size:'), fs)

        auto_theme = _('Automatic (%s)') % default_theme()
        choices = {k:k for k in THEMES}
        choices['auto'] = auto_theme
        theme = self.choices_widget('editor_theme', choices, 'auto', 'auto')
        l.addRow(_('&Color scheme:'), theme)

        tw = self('editor_tab_stop_width')
        tw.setMinimum(2), tw.setSuffix(_(' characters')), tw.setMaximum(20)
        l.addRow(_('Width of &tabs:'), tw)

        lw = self('editor_line_wrap')
        lw.setText(_('&Wrap long lines in the editor'))
        l.addRow(lw)

        lw = self('replace_entities_as_typed')
        lw.setText(_('&Replace HTML entities as they are typed'))
        lw.setToolTip('<p>' + _(
            'With this option, every time you type in a complete html entity, such as &amp;hellip;'
            ' it is automatically replaced by its corresponding character. The replacement'
            ' happens only when the trailing semi-colon is typed.'))
        l.addRow(lw)

        lw = self('editor_show_char_under_cursor')
        lw.setText(_('Show the name of the current character under the cursor along with the line and column number'))
        l.addRow(lw)
Exemplo n.º 10
0
 def theme_choices(self):
     choices = {k:k for k in all_theme_names()}
     choices['auto'] = _('Automatic (%s)') % default_theme()
     return choices
Exemplo n.º 11
0
 def theme_choices(self):
     choices = {k: k for k in all_theme_names()}
     choices['auto'] = _('Automatic (%s)') % default_theme()
     return choices
Exemplo n.º 12
0
def get_theme():
    theme = THEMES.get(tprefs["editor_theme"], None)
    if theme is None:
        theme = THEMES[default_theme()]
    return theme
Exemplo n.º 13
0
def get_theme():
    theme = THEMES.get(tprefs['editor_theme'], None)
    if theme is None:
        theme = THEMES[default_theme()]
    return theme
Exemplo n.º 14
0
 def theme_choices(self):
     choices = {k: k for k in all_theme_names()}
     choices["auto"] = _("Automatic (%s)") % default_theme()
     return choices
Exemplo n.º 15
0
    def __init__(self, parent=None):
        BasicSettings.__init__(self, parent)
        self.dictionaries_changed = False
        self.l = l = QFormLayout(self)
        self.setLayout(l)

        fc = FontFamilyChooser(self)
        self(
            "editor_font_family",
            widget=fc,
            getter=attrgetter("font_family"),
            setter=lambda x, val: setattr(x, "font_family", val),
        )
        fc.family_changed.connect(self.emit_changed)
        l.addRow(_("Editor font &family:"), fc)

        fs = self("editor_font_size")
        fs.setMinimum(8), fs.setSuffix(" pt"), fs.setMaximum(50)
        l.addRow(_("Editor font &size:"), fs)

        auto_theme = _("Automatic (%s)") % default_theme()
        choices = {k: k for k in THEMES}
        choices["auto"] = auto_theme
        theme = self.choices_widget("editor_theme", choices, "auto", "auto")
        l.addRow(_("&Color scheme:"), theme)

        tw = self("editor_tab_stop_width")
        tw.setMinimum(2), tw.setSuffix(_(" characters")), tw.setMaximum(20)
        l.addRow(_("Width of &tabs:"), tw)

        lw = self("editor_line_wrap")
        lw.setText(_("&Wrap long lines in the editor"))
        l.addRow(lw)

        lw = self("replace_entities_as_typed")
        lw.setText(_("&Replace HTML entities as they are typed"))
        lw.setToolTip(
            "<p>"
            + _(
                "With this option, every time you type in a complete html entity, such as &amp;hellip;"
                " it is automatically replaced by its corresponding character. The replacement"
                " happens only when the trailing semi-colon is typed."
            )
        )
        l.addRow(lw)

        lw = self("editor_show_char_under_cursor")
        lw.setText(_("Show the name of the current character before the cursor along with the line and column number"))
        l.addRow(lw)

        lw = self("pretty_print_on_open")
        lw.setText(_("Beautify individual files automatically when they are opened"))
        lw.setToolTip(
            "<p>"
            + _(
                "This will cause the beautify current file action to be performed automatically every"
                " time you open a HTML/CSS/etc. file for editing."
            )
        )
        l.addRow(lw)

        lw = self("inline_spell_check")
        lw.setText(_("Show misspelled words underlined in the code view"))
        lw.setToolTip(
            "<p>"
            + _(
                "This will cause spelling errors to be highlighted in the code view" " for easy correction as you type."
            )
        )
        l.addRow(lw)

        self.dictionaries = d = QPushButton(_("Manage &spelling dictionaries"), self)
        d.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        d.clicked.connect(self.manage_dictionaries)
        l.addRow(d)