Add a option to draw a grid in the main book list (Preferences->Look & feel)

This commit is contained in:
Kovid Goyal 2018-07-22 07:30:08 +05:30
parent 86d58a2539
commit b6e28d16a3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 28 additions and 14 deletions

View File

@ -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()

View File

@ -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:

View File

@ -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'])

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>843</width>
<height>546</height>
<height>552</height>
</rect>
</property>
<property name="windowTitle">
@ -28,6 +28,16 @@
<string>&amp;Main interface</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_9">
<item row="5" column="1">
<widget class="QCheckBox" name="opt_disable_animations">
<property name="toolTip">
<string>Disable all animations. Useful if you have a slow/old computer.</string>
</property>
<property name="text">
<string>Disable &amp;animations</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_widget_style">
<property name="text">
@ -150,7 +160,7 @@
</property>
</widget>
</item>
<item row="13" column="0">
<item row="14" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -228,16 +238,6 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="opt_disable_animations">
<property name="toolTip">
<string>Disable all animations. Useful if you have a slow/old computer.</string>
</property>
<property name="text">
<string>Disable &amp;animations</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="opt_show_splash_screen">
<property name="text">
@ -284,13 +284,20 @@
</property>
</widget>
</item>
<item row="12" column="0">
<item row="13" column="0">
<widget class="QCheckBox" name="opt_dnd_merge">
<property name="text">
<string>Allow using &amp;drag and drop to merge books</string>
</property>
</widget>
</item>
<item row="12" column="0" colspan="2">
<widget class="QCheckBox" name="opt_booklist_grid">
<property name="text">
<string>Draw a &amp;grid in the book list</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="cover_grid_tab">