diff --git a/src/calibre/gui2/tweak_book/editor/__init__.py b/src/calibre/gui2/tweak_book/editor/__init__.py index 270f45f2dc..a16cc7fae6 100644 --- a/src/calibre/gui2/tweak_book/editor/__init__.py +++ b/src/calibre/gui2/tweak_book/editor/__init__.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' -from PyQt4.Qt import QTextCharFormat +from PyQt4.Qt import QTextCharFormat, QFont from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES from calibre.ebooks.oeb.polish.container import guess_type @@ -41,3 +41,9 @@ class SyntaxTextCharFormat(QTextCharFormat): QTextCharFormat.__init__(self, *args) self.setProperty(SYNTAX_PROPERTY, True) + def __repr__(self): + return 'SyntaxFormat(id=%s, color=%s, italic=%s, bold=%s)' % ( + id(self), self.foreground().color().name(), self.fontItalic(), self.fontWeight() >= QFont.DemiBold) + __str__ = __repr__ + +