Edit Book: Fix selected text not being fully highlighted when using the solarized color schemes. Fixes #1647448 [Selected text not visible in ebook-editor with solarized-dark theme](https://bugs.launchpad.net/calibre/+bug/1647448)

This commit is contained in:
Kovid Goyal 2016-12-06 08:43:32 +05:30
parent 1371f6c858
commit 7735b0c9f7

View File

@ -49,7 +49,7 @@ SOLARIZED = \
PmenuSel fg={base01} bg={base2} PmenuSel fg={base01} bg={base2}
Cursor fg={base03} bg={base0} Cursor fg={base03} bg={base0}
Normal fg={base0} bg={base03} Normal fg={base0} bg={base02}
LineNr fg={base01} bg={base02} LineNr fg={base01} bg={base02}
LineNrC fg={magenta} LineNrC fg={magenta}
Visual fg={base01} bg={base03} Visual fg={base01} bg={base03}
@ -201,6 +201,7 @@ def read_color(col):
except Exception: except Exception:
pass pass
Highlight = namedtuple('Highlight', 'fg bg bold italic underline underline_color') Highlight = namedtuple('Highlight', 'fg bg bold italic underline underline_color')
@ -235,6 +236,7 @@ def read_theme(raw):
ans[name] = Highlight(fg, bg, bold, italic, underline, underline_color) ans[name] = Highlight(fg, bg, bold, italic, underline, underline_color)
return ans return ans
THEMES = {k:read_theme(raw) for k, raw in THEMES.iteritems()} THEMES = {k:read_theme(raw) for k, raw in THEMES.iteritems()}
@ -243,6 +245,8 @@ def u(x):
if 'Dot' in x: if 'Dot' in x:
return x + 'Line' return x + 'Line'
return x + 'Underline' return x + 'Underline'
underline_styles = {x:getattr(QTextCharFormat, u(x)) for x in underline_styles} underline_styles = {x:getattr(QTextCharFormat, u(x)) for x in underline_styles}
@ -474,6 +478,8 @@ class Property(QWidget):
self.changed.emit() self.changed.emit()
# Help text {{{ # Help text {{{
HELP_TEXT = _('''\ HELP_TEXT = _('''\
<h2>Creating a custom theme</h2> <h2>Creating a custom theme</h2>
@ -685,6 +691,7 @@ class ThemeEditor(Dialog):
return QSize(min(1500, g.width() - 25), 650) return QSize(min(1500, g.width() - 25), 650)
# }}} # }}}
if __name__ == '__main__': if __name__ == '__main__':
app = QApplication([]) app = QApplication([])
d = ThemeEditor() d = ThemeEditor()