From b6e28d16a3ed2f6114a172ca22e4720886508a71 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 22 Jul 2018 07:30:08 +0530 Subject: [PATCH] Add a option to draw a grid in the main book list (Preferences->Look & feel) --- src/calibre/gui2/__init__.py | 1 + src/calibre/gui2/library/views.py | 6 ++++- src/calibre/gui2/preferences/look_feel.py | 2 ++ src/calibre/gui2/preferences/look_feel.ui | 33 ++++++++++++++--------- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index afa176f795..7d58ff7684 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -169,6 +169,7 @@ def create_defs(): defs['book_list_split'] = False defs['wrap_toolbar_text'] = False defs['dnd_merge'] = True + defs['booklist_grid'] = False create_defs() diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index 948b273109..b856bb90ea 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -254,8 +254,8 @@ class BooksView(QTableView): # {{{ setup_dnd_interface(self) for wv in self, self.pin_view: wv.setAlternatingRowColors(True) - wv.setShowGrid(False) wv.setWordWrap(False) + self.refresh_grid() self.rating_delegate = RatingDelegate(self) self.half_rating_delegate = RatingDelegate(self, is_half_star=True) @@ -786,6 +786,10 @@ class BooksView(QTableView): # {{{ self.row_sizing_done = False self.do_row_sizing() + def refresh_grid(self): + for wv in self, self.pin_view: + wv.setShowGrid(bool(gprefs['booklist_grid'])) + def do_row_sizing(self): # Resize all rows to have the correct height if not self.row_sizing_done and self.model().rowCount(QModelIndex()) > 0: diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index 9de6eff486..cf2d5cd6c2 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -428,6 +428,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): r('emblem_position', gprefs, choices=[ (_('Left'), 'left'), (_('Top'), 'top'), (_('Right'), 'right'), (_('Bottom'), 'bottom')]) r('book_list_extra_row_spacing', gprefs) + r('booklist_grid', gprefs) r('book_details_narrow_comments_layout', gprefs, choices=[(_('Float'), 'float'), (_('Columns'), 'columns')]) self.opt_book_details_narrow_comments_layout.setToolTip(textwrap.fill(_( 'Choose how the text is laid out when using the "Narrow" user interface layout.' @@ -766,6 +767,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): gui.tags_view.set_look_and_feel() gui.tags_view.reread_collapse_parameters() gui.library_view.refresh_book_details() + gui.library_view.refresh_grid() gui.library_view.set_row_header_visibility() gui.cover_flow.setShowReflections(gprefs['cover_browser_reflections']) gui.cover_flow.setPreserveAspectRatio(gprefs['cb_preserve_aspect_ratio']) diff --git a/src/calibre/gui2/preferences/look_feel.ui b/src/calibre/gui2/preferences/look_feel.ui index 2a7c889ce0..d7935ac7e6 100644 --- a/src/calibre/gui2/preferences/look_feel.ui +++ b/src/calibre/gui2/preferences/look_feel.ui @@ -7,7 +7,7 @@ 0 0 843 - 546 + 552 @@ -28,6 +28,16 @@ &Main interface + + + + Disable all animations. Useful if you have a slow/old computer. + + + Disable &animations + + + @@ -150,7 +160,7 @@ - + Qt::Vertical @@ -228,16 +238,6 @@ - - - - Disable all animations. Useful if you have a slow/old computer. - - - Disable &animations - - - @@ -284,13 +284,20 @@ - + Allow using &drag and drop to merge books + + + + Draw a &grid in the book list + + +