This commit is contained in:
Kovid Goyal 2024-01-18 21:12:46 +05:30
commit 17c9801c62
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 11 additions and 5 deletions

View File

@ -379,9 +379,10 @@ cover_trim_fuzz_value = 10
#: Control behavior of the book list #: Control behavior of the book list
# You can control the behavior of double clicks and pressing Enter on the books # 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, # list. Choices: open_viewer, do_nothing, show_book_details,
# edit_metadata. Selecting anything other than open_viewer or show_book_details # show_locked_book_details, edit_cell, edit_metadata. Selecting anything other
# has the side effect of disabling editing a field using a single click. # than open_viewer, show_book_details, or show_locked_book_details has the side
# effect of disabling editing a field using a single click.
# Default: open_viewer. # Default: open_viewer.
# Example: doubleclick_on_library_view = 'do_nothing' # Example: doubleclick_on_library_view = 'do_nothing'
# You can also control whether the book list scrolls per item or # You can also control whether the book list scrolls per item or

View File

@ -69,6 +69,10 @@ def handle_enter_press(self, ev, special_action=None, has_edit_cell=True):
gui.iactions['Edit Metadata'].edit_metadata(False) gui.iactions['Edit Metadata'].edit_metadata(False)
elif tweak == 'do_nothing': elif tweak == 'do_nothing':
pass pass
elif tweak == 'show_locked_book_details':
self.gui.iactions['Show Book Details'].show_book_info(locked=True)
elif tweak == 'show_book_details':
self.gui.iactions['Show Book Details'].show_book_info()
else: else:
if special_action is not None: if special_action is not None:
special_action(self.currentIndex()) special_action(self.currentIndex())

View File

@ -361,9 +361,10 @@ class BooksView(QTableView): # {{{
elif tval == 'open_viewer': elif tval == 'open_viewer':
wv.setEditTriggers(QAbstractItemView.EditTrigger.SelectedClicked|wv.editTriggers()) wv.setEditTriggers(QAbstractItemView.EditTrigger.SelectedClicked|wv.editTriggers())
wv.doubleClicked.connect(parent.iactions['View'].view_triggered) wv.doubleClicked.connect(parent.iactions['View'].view_triggered)
elif tval == 'show_book_details': elif tval in ('show_book_details', 'show_locked_book_details'):
wv.setEditTriggers(QAbstractItemView.EditTrigger.SelectedClicked|wv.editTriggers()) wv.setEditTriggers(QAbstractItemView.EditTrigger.SelectedClicked|wv.editTriggers())
wv.doubleClicked.connect(parent.iactions['Show Book Details'].show_book_info) wv.doubleClicked.connect(partial(parent.iactions['Show Book Details'].show_book_info,
locked=tval == 'show_locked_book_details'))
elif tval == 'edit_metadata': elif tval == 'edit_metadata':
# Must not enable single-click to edit, or the field will remain # Must not enable single-click to edit, or the field will remain
# open in edit mode underneath the edit metadata dialog # open in edit mode underneath the edit metadata dialog