From c8b8825b1819b7f0ec16cd2e8d67b8f8cabdf562 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 1 Sep 2012 09:48:20 +0530 Subject: [PATCH] Add an option under Preferences->Look & Feel->Book Details to hide the cover in the book details panel --- src/calibre/gui2/__init__.py | 1 + src/calibre/gui2/book_details.py | 6 ++- src/calibre/gui2/preferences/look_feel.py | 1 + src/calibre/gui2/preferences/look_feel.ui | 55 +++++++++++++---------- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 00f5bef03d..8f275ec065 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -101,6 +101,7 @@ gprefs.defaults['auto_add_auto_convert'] = True gprefs.defaults['ui_style'] = 'calibre' if iswindows or isosx else 'system' gprefs.defaults['tag_browser_old_look'] = False gprefs.defaults['book_list_tooltips'] = True +gprefs.defaults['bd_show_cover'] = True # }}} NONE = QVariant() #: Null value to return from the data function of item models diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index 3e20f8c67c..bf5fbe77bd 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -297,7 +297,8 @@ class CoverView(QWidget): # {{{ self.pixmap = self.default_pixmap self.do_layout() self.update() - if not same_item and not config['disable_animations']: + if (not same_item and not config['disable_animations'] and + self.isVisible()): self.animation.start() def paintEvent(self, event): @@ -512,6 +513,7 @@ class DetailsLayout(QLayout): # {{{ self.do_layout(r) def cover_height(self, r): + if not self._children[0].widget().isVisible(): return 0 mh = min(int(r.height()/2.), int(4/3. * r.width())+1) try: ph = self._children[0].widget().pixmap.height() @@ -522,6 +524,7 @@ class DetailsLayout(QLayout): # {{{ return mh def cover_width(self, r): + if not self._children[0].widget().isVisible(): return 0 mw = 1 + int(3/4. * r.height()) try: pw = self._children[0].widget().pixmap.width() @@ -660,6 +663,7 @@ class BookDetails(QWidget): # {{{ self.update_layout() def update_layout(self): + self.cover_view.setVisible(gprefs['bd_show_cover']) self._layout.do_layout(self.rect()) self.cover_view.update_tooltip(self.current_path) diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index 8ca6b96379..65e6ab6d9f 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -106,6 +106,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): 'calibre')]) r('book_list_tooltips', gprefs) r('tag_browser_old_look', gprefs, restart_required=True) + r('bd_show_cover', gprefs) r('cover_flow_queue_length', config, restart_required=True) diff --git a/src/calibre/gui2/preferences/look_feel.ui b/src/calibre/gui2/preferences/look_feel.ui index bb60f3db2a..2a4397b22d 100644 --- a/src/calibre/gui2/preferences/look_feel.ui +++ b/src/calibre/gui2/preferences/look_feel.ui @@ -212,19 +212,32 @@ Book Details - + + + + Note that <b>comments</b> will always be displayed at the end, regardless of the position you assign here. + + + true + + + + + + + Use &Roman numerals for series + + + true + + + + Select displayed metadata - - - - true - - - @@ -247,6 +260,13 @@ + + + + true + + + @@ -288,23 +308,10 @@ Manage Authors. You can use the values {author} and - - + + - Use &Roman numerals for series - - - true - - - - - - - Note that <b>comments</b> will always be displayed at the end, regardless of the position you assign here. - - - true + Show &cover in the book details panel