From 1e137b7ee70bd6bcfa6b5b41a979813d15e52ccc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jun 2010 12:29:33 -0600 Subject: [PATCH] Speed up rendering of comments --- src/calibre/gui2/book_details.py | 11 ++++++----- src/calibre/library/comments.py | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index eb8dc0d064..4deadbc857 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -173,6 +173,7 @@ class Label(QLabel): self.setTextFormat(Qt.RichText) self.setText('') self.setWordWrap(True) + self.setAlignment(Qt.AlignTop) self.linkActivated.connect(self.link_activated) self._link_clicked = False self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) @@ -205,15 +206,15 @@ class BookInfo(QScrollArea): rows = render_rows(data) rows = u'\n'.join([u'%s:%s'%(k,t) for k, t in rows]) + comments = '' + if data.get(_('Comments'), '') not in ('', u'None'): + comments = data[_('Comments')] + comments = comments_to_html(comments) if self.vertical: - if _('Comments') in data and data[_('Comments')]: - comments = comments_to_html(data[_('Comments')]) + if comments: rows += u'%s'%comments self.label.setText(u'%s
'%rows) else: - comments = '' - if _('Comments') in data: - comments = comments_to_html(data[_('Comments')]) left_pane = u'%s
'%rows right_pane = u'
%s
'%comments self.label.setText(u'
') + return u'

%s

'%comments + # Hackish - ignoring sentences ending or beginning in numbers to avoid # confusion with decimal points.