mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a tweak to control behavior of Enter on the book list
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
60b0f56e7b
@ -393,7 +393,7 @@ 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 on the books 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.
|
||||
@ -402,6 +402,7 @@ cover_trim_fuzz_value = 10
|
||||
# You can also control whether the book list scrolls horizontal per column or
|
||||
# per pixel. Default is per column.
|
||||
doubleclick_on_library_view = 'open_viewer'
|
||||
enter_key_behavior = 'open_viewer'
|
||||
horizontal_scrolling_per_column = True
|
||||
|
||||
#: Language to use when sorting
|
||||
|
@ -42,7 +42,7 @@ class EncodeError(ValueError):
|
||||
pass
|
||||
|
||||
|
||||
def handle_enter_press(self, ev, special_action=None):
|
||||
def handle_enter_press(self, ev, special_action=None, has_edit_cell=True):
|
||||
if ev.key() in (Qt.Key_Enter, Qt.Key_Return):
|
||||
mods = ev.modifiers()
|
||||
if mods & Qt.CTRL or mods & Qt.ALT or mods & Qt.SHIFT or mods & Qt.META:
|
||||
@ -50,9 +50,21 @@ def handle_enter_press(self, ev, special_action=None):
|
||||
if self.state() != self.EditingState and self.hasFocus() and self.currentIndex().isValid():
|
||||
from calibre.gui2.ui import get_gui
|
||||
ev.ignore()
|
||||
if special_action is not None:
|
||||
special_action(self.currentIndex())
|
||||
get_gui().iactions['View'].view_triggered(self.currentIndex())
|
||||
tweak = tweaks['enter_key_behavior']
|
||||
gui = get_gui()
|
||||
if tweak == 'edit_cell':
|
||||
if has_edit_cell:
|
||||
self.edit(self.currentIndex(), self.EditKeyPressed, ev)
|
||||
else:
|
||||
gui.iactions['Edit Metadata'].edit_metadata(False)
|
||||
elif tweak == 'edit_metadata':
|
||||
gui.iactions['Edit Metadata'].edit_metadata(False)
|
||||
elif tweak == 'do_nothing':
|
||||
pass
|
||||
else:
|
||||
if special_action is not None:
|
||||
special_action(self.currentIndex())
|
||||
gui.iactions['View'].view_triggered(self.currentIndex())
|
||||
return True
|
||||
|
||||
|
||||
@ -1017,7 +1029,7 @@ class GridView(QListView):
|
||||
return self._ncols
|
||||
|
||||
def keyPressEvent(self, ev):
|
||||
if handle_enter_press(self, ev, self.start_view_animation):
|
||||
if handle_enter_press(self, ev, self.start_view_animation, False):
|
||||
return
|
||||
k = ev.key()
|
||||
if ev.modifiers() & Qt.ShiftModifier and k in (Qt.Key_Left, Qt.Key_Right, Qt.Key_Up, Qt.Key_Down):
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||
store_version = 4 # Needed for dynamic plugin loading
|
||||
store_version = 5 # Needed for dynamic plugin loading
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
@ -25,9 +25,9 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog
|
||||
class LibreDEStore(BasicStoreConfig, StorePlugin):
|
||||
|
||||
def open(self, parent=None, detail_item=None, external=False):
|
||||
url = 'http://ad.zanox.com/ppc/?18817073C15644254T'
|
||||
url_details = ('http://ad.zanox.com/ppc/?18848208C1197627693T&ULP=[['
|
||||
'http://www.ebook.de/shop/action/productDetails?artiId={0}]]')
|
||||
url = 'https://www.awin1.com/awclick.php?mid=9359&awinaffid=397537&clickref=gbhome'
|
||||
url_details = ('https://www.awin1.com/cread.php?awinmid=9359&awinaffid=397537&clickref=gbdetails&p='
|
||||
'http%3A//www.ebook.de/shop/action/productDetails%3FartiId%3D{0}')
|
||||
|
||||
if external or self.config.get('open_external', False):
|
||||
if detail_item:
|
||||
|
Loading…
x
Reference in New Issue
Block a user