コード例 #1
0
ファイル: text.py プロジェクト: randy1/calibre
 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)
コード例 #2
0
ファイル: text.py プロジェクト: BatteringRam/calibre
 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)
コード例 #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)
コード例 #4
0
ファイル: text.py プロジェクト: palerdot/calibre
 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()
コード例 #5
0
ファイル: live_css.py プロジェクト: lupiter/calibre
 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()
コード例 #6
0
def get_theme():
    theme = THEMES.get(tprefs["editor_theme"], None)
    if theme is None:
        theme = THEMES[default_theme()]
    return theme
コード例 #7
0
ファイル: highlight.py プロジェクト: siebert/calibre
def get_theme():
    theme = THEMES.get(tprefs['editor_theme'], None)
    if theme is None:
        theme = THEMES[default_theme()]
    return theme