Esempio 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)
Esempio n. 2
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)
Esempio n. 3
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)
Esempio n. 4
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()
Esempio n. 5
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()
Esempio n. 6
0
def get_theme():
    theme = THEMES.get(tprefs["editor_theme"], None)
    if theme is None:
        theme = THEMES[default_theme()]
    return theme
Esempio n. 7
0
def get_theme():
    theme = THEMES.get(tprefs['editor_theme'], None)
    if theme is None:
        theme = THEMES[default_theme()]
    return theme