Preferences->Tweaks: Allow specifying that calibre should open the book details window when double clicking on a book

Fixes #1922591 [Enhancement Request: Additional option for doubleclick_on_library_view](https://bugs.launchpad.net/calibre/+bug/1922591)
This commit is contained in:
Kovid Goyal 2021-04-06 09:05:53 +05:30
parent f009b8c64b
commit 0219746e92
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 16 additions and 9 deletions

View File

@ -376,10 +376,10 @@ sort_dates_using_visible_fields = False
cover_trim_fuzz_value = 10
#: Control behavior of the book list
# You can control the behavior of double clicks and pressing enter on the books list.
# Choices: open_viewer, do_nothing,
# edit_cell, edit_metadata. Selecting anything other than open_viewer has the
# side effect of disabling editing a field using a single click.
# You can control the behavior of double clicks and pressing enter on the books
# list. Choices: open_viewer, do_nothing, show_book_details, edit_cell,
# edit_metadata. Selecting anything other than open_viewer or show_book_details
# has the side effect of disabling editing a field using a single click.
# Default: open_viewer.
# Example: doubleclick_on_library_view = 'do_nothing'
# You can also control whether the book list scrolls horizontal per column or

View File

@ -781,10 +781,13 @@ class GridView(QListView):
def double_clicked(self, index):
self.start_view_animation(index)
if tweaks['doubleclick_on_library_view'] == 'open_viewer':
tval = tweaks['doubleclick_on_library_view']
if tval == 'open_viewer':
self.gui.iactions['View'].view_triggered(index)
elif tweaks['doubleclick_on_library_view'] in {'edit_metadata', 'edit_cell'}:
elif tval in {'edit_metadata', 'edit_cell'}:
self.gui.iactions['Edit Metadata'].edit_metadata(False, False)
elif tval == 'show_book_details':
self.gui.iactions['Show Book Details'].show_book_info()
def animation_value_changed(self, value):
if self.delegate.animating is not None:

View File

@ -239,12 +239,16 @@ class BooksView(QTableView): # {{{
wv.setHorizontalScrollMode(QAbstractItemView.ScrollMode.ScrollPerPixel)
wv.setEditTriggers(QAbstractItemView.EditTrigger.EditKeyPressed)
if tweaks['doubleclick_on_library_view'] == 'edit_cell':
tval = tweaks['doubleclick_on_library_view']
if tval == 'edit_cell':
wv.setEditTriggers(QAbstractItemView.EditTrigger.DoubleClicked|wv.editTriggers())
elif tweaks['doubleclick_on_library_view'] == 'open_viewer':
elif tval == 'open_viewer':
wv.setEditTriggers(QAbstractItemView.EditTrigger.SelectedClicked|wv.editTriggers())
wv.doubleClicked.connect(parent.iactions['View'].view_triggered)
elif tweaks['doubleclick_on_library_view'] == 'edit_metadata':
elif tval == 'show_book_details':
wv.setEditTriggers(QAbstractItemView.EditTrigger.SelectedClicked|wv.editTriggers())
wv.doubleClicked.connect(parent.iactions['Show Book Details'].show_book_info)
elif tval == 'edit_metadata':
# Must not enable single-click to edit, or the field will remain
# open in edit mode underneath the edit metadata dialog
if use_edit_metadata_dialog: