From 1323644b8d1cea30232d033ddd82b7bcbbb90106 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Fri, 17 Nov 2017 17:40:33 +0100 Subject: [PATCH 1/2] Update plugin for new affiliate codes. --- src/calibre/gui2/store/stores/libri_de_plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/store/stores/libri_de_plugin.py b/src/calibre/gui2/store/stores/libri_de_plugin.py index bc64db07e7..ffb3a02c98 100644 --- a/src/calibre/gui2/store/stores/libri_de_plugin.py +++ b/src/calibre/gui2/store/stores/libri_de_plugin.py @@ -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 ' @@ -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: From 1ecaf1c5ff0441b47aa59dd42d59897ee0fe9be9 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Fri, 17 Nov 2017 18:15:15 +0100 Subject: [PATCH 2/2] Add tweak to change the (new) behavior of the enter key --- resources/default_tweaks.py | 8 ++++++++ src/calibre/gui2/library/alternate_views.py | 19 ++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index 18274e8d65..a6d022c653 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -559,3 +559,11 @@ cover_drop_exclude = () # new Saved search is shown in the Search bar. If you would like to have the # old Saved searches box with its two buttons back, set this tweak to True. show_saved_search_box = False + +#: Control behavior of Enter key on the books view +# The behaviors: +# 'viewer': open the book in the viewer, +# 'down_arrow': perform a down arrow, +# 'edit_metadata': open the edit metadata (single) dialog, +# 'do_nothing': makes the key do nothing. +enter_key_behavior = 'viewer' diff --git a/src/calibre/gui2/library/alternate_views.py b/src/calibre/gui2/library/alternate_views.py index bea953f8fc..f21f909bc8 100644 --- a/src/calibre/gui2/library/alternate_views.py +++ b/src/calibre/gui2/library/alternate_views.py @@ -19,7 +19,7 @@ from PyQt5.Qt import ( QMimeData, QUrl, QDrag, QPoint, QPainter, QRect, pyqtProperty, QEvent, QPropertyAnimation, QEasingCurve, pyqtSlot, QHelpEvent, QAbstractItemView, QStyleOptionViewItem, QToolTip, QByteArray, QBuffer, QBrush, qRed, qGreen, - qBlue, QItemSelectionModel, QIcon, QFont) + qBlue, QItemSelectionModel, QIcon, QFont, QKeyEvent) from calibre import fit_image, prints, prepare_string_for_xml, human_readable from calibre.constants import DEBUG, config_dir, islinux @@ -47,9 +47,22 @@ 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: + tweak = tweaks['enter_key_behavior'] + if tweak != 'down_arrow' and special_action is not None: + # Don't animate (or whatever) if emulating the down arrow + # Could be that this should check == 'do nothing', but the + # animation is nice when opening the viewer. special_action(self.currentIndex()) - get_gui().iactions['View'].view_triggered(self.currentIndex()) + gui = get_gui() + if tweak == 'viewer': + gui.iactions['View'].view_triggered(self.currentIndex()) + elif tweak == 'down_arrow': + nev = QKeyEvent(QEvent.KeyPress, Qt.Key_Down, ev.modifiers(), ev.text()) + self.keyPressEvent(nev) + elif tweak == 'edit_metadata': + gui.iactions['Edit Metadata'].edit_metadata(False) + elif tweak == 'do_nothing': # for completeness + pass return True