From fcc685661d36d83c4fe6aaca4a021e045e68f115 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 22 Nov 2016 20:59:21 +0530 Subject: [PATCH] Pressing the up arrow in an date edit with undefined value should jump to the current date rather than Feb 101 --- src/calibre/gui2/metadata/basic_widgets.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index 8532ca9893..6a922ba7d6 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -57,6 +57,7 @@ def save_dialog(parent, title, msg, det_msg=''): def clean_text(x): return re.sub(r'\s', ' ', x.strip()) + ''' The interface common to all widgets used to set basic metadata class BasicMetadataWidget(object): @@ -1731,6 +1732,8 @@ class DateEdit(make_undoable(QDateTimeEdit), ToMetadataMixin): elif ev.key() == Qt.Key_Equal: ev.accept() self.setDateTime(QDateTime.currentDateTime()) + elif ev.key() == Qt.Key_Up and is_date_undefined(self.current_val): + self.setDateTime(QDateTime.currentDateTime()) else: return super(DateEdit, self).keyPressEvent(ev)