mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make custom_column_widgets.py, book_info.py, and book_details.py use comments_to_html. Fix _parent to parent()
This commit is contained in:
parent
ed1d2c44e3
commit
532749201a
@ -46,6 +46,7 @@ def render_rows(data):
|
|||||||
txt = txt.decode(preferred_encoding, 'replace')
|
txt = txt.decode(preferred_encoding, 'replace')
|
||||||
if key.endswith(u':html'):
|
if key.endswith(u':html'):
|
||||||
key = key[:-5]
|
key = key[:-5]
|
||||||
|
txt = comments_to_html(txt)
|
||||||
elif '</font>' not in txt:
|
elif '</font>' not in txt:
|
||||||
txt = prepare_string_for_xml(txt)
|
txt = prepare_string_for_xml(txt)
|
||||||
if 'id' in data:
|
if 'id' in data:
|
||||||
|
@ -19,6 +19,7 @@ from calibre.gui2.comments_editor import Editor as CommentsEditor
|
|||||||
from calibre.gui2 import UNDEFINED_QDATE, error_dialog
|
from calibre.gui2 import UNDEFINED_QDATE, error_dialog
|
||||||
from calibre.utils.config import tweaks
|
from calibre.utils.config import tweaks
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
|
from calibre.library.comments import comments_to_html
|
||||||
|
|
||||||
class Base(object):
|
class Base(object):
|
||||||
|
|
||||||
@ -197,7 +198,7 @@ class Comments(Base):
|
|||||||
def setter(self, val):
|
def setter(self, val):
|
||||||
if val is None:
|
if val is None:
|
||||||
val = ''
|
val = ''
|
||||||
self._tb.html = val
|
self._tb.html = comments_to_html(val)
|
||||||
|
|
||||||
def getter(self):
|
def getter(self):
|
||||||
val = unicode(self._tb.html).strip()
|
val = unicode(self._tb.html).strip()
|
||||||
|
@ -136,6 +136,7 @@ class BookInfo(QDialog, Ui_BookInfo):
|
|||||||
txt = info[key]
|
txt = info[key]
|
||||||
if key.endswith(':html'):
|
if key.endswith(':html'):
|
||||||
key = key[:-5]
|
key = key[:-5]
|
||||||
|
txt = comments_to_html(txt)
|
||||||
if key != _('Path'):
|
if key != _('Path'):
|
||||||
txt = u'<br />\n'.join(textwrap.wrap(txt, 120))
|
txt = u'<br />\n'.join(textwrap.wrap(txt, 120))
|
||||||
rows += u'<tr><td><b>%s:</b></td><td>%s</td></tr>'%(key, txt)
|
rows += u'<tr><td><b>%s:</b></td><td>%s</td></tr>'%(key, txt)
|
||||||
|
@ -306,7 +306,7 @@ class CcCommentsDelegate(QStyledItemDelegate): # {{{
|
|||||||
painter.save()
|
painter.save()
|
||||||
if hasattr(QStyle, 'CE_ItemViewItem'):
|
if hasattr(QStyle, 'CE_ItemViewItem'):
|
||||||
style.drawControl(QStyle.CE_ItemViewItem, option,
|
style.drawControl(QStyle.CE_ItemViewItem, option,
|
||||||
painter, self._parent)
|
painter, self.parent())
|
||||||
elif option.state & QStyle.State_Selected:
|
elif option.state & QStyle.State_Selected:
|
||||||
painter.fillRect(option.rect, option.palette.highlight())
|
painter.fillRect(option.rect, option.palette.highlight())
|
||||||
painter.setClipRect(option.rect)
|
painter.setClipRect(option.rect)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user