From 2d966ee328d14dbf8187f158a0b9de7db102371f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 May 2012 16:19:11 +0530 Subject: [PATCH] ... --- src/calibre/gui2/comments_editor.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index 71e326c6c5..1dfa2c02d6 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -167,6 +167,8 @@ class EditorWidget(QWebView): # {{{ self.action_remove_format.trigger() self.exec_command('delete') us.endMacro() + self.set_font_style() + self.setFocus(Qt.OtherFocusReason) def link_clicked(self, url): open_url(url) @@ -266,20 +268,22 @@ class EditorWidget(QWebView): # {{{ def fset(self, val): self.setHtml(val) - fi = QFontInfo(QApplication.font(self)) - f = fi.pixelSize() + 1 + int(tweaks['change_book_details_font_size_by']) - fam = unicode(fi.family()).strip().replace('"', '') - if not fam: - fam = 'sans-serif' - style = 'font-size: %fpx; font-family:"%s",sans-serif;' % (f, fam) - - # toList() is needed because PyQt on Debian is old/broken - for body in self.page().mainFrame().documentElement().findAll('body').toList(): - body.setAttribute('style', style) - self.page().setContentEditable(True) - + self.set_font_style() return property(fget=fget, fset=fset) + def set_font_style(self): + fi = QFontInfo(QApplication.font(self)) + f = fi.pixelSize() + 1 + int(tweaks['change_book_details_font_size_by']) + fam = unicode(fi.family()).strip().replace('"', '') + if not fam: + fam = 'sans-serif' + style = 'font-size: %fpx; font-family:"%s",sans-serif;' % (f, fam) + + # toList() is needed because PyQt on Debian is old/broken + for body in self.page().mainFrame().documentElement().findAll('body').toList(): + body.setAttribute('style', style) + self.page().setContentEditable(True) + def keyPressEvent(self, ev): if ev.key() in (Qt.Key_Tab, Qt.Key_Escape, Qt.Key_Backtab): ev.ignore()