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)
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)
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()
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()
def get_theme(): theme = THEMES.get(tprefs["editor_theme"], None) if theme is None: theme = THEMES[default_theme()] return theme
def get_theme(): theme = THEMES.get(tprefs['editor_theme'], None) if theme is None: theme = THEMES[default_theme()] return theme