From 61bf9e10ce2c7365d2f3ff7ae37b9ef17bf3f7d9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 8 Apr 2021 14:23:52 +0530 Subject: [PATCH] Edit book: Fix restoring confirmation dialogs not restoring question_dialog() based confirmations --- src/calibre/gui2/__init__.py | 5 +++-- src/calibre/gui2/tweak_book/preferences.py | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 50079511fc..3fdce7dc2f 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -412,11 +412,12 @@ def question_dialog(parent, title, msg, det_msg='', show_copy_button=False, yes_text=None, no_text=None, yes_icon=None, no_icon=None, ): from calibre.gui2.dialogs.message_box import MessageBox + prefs = gui_prefs() if not isinstance(skip_dialog_name, unicode_type): skip_dialog_name = None try: - auto_skip = set(gprefs.get('questions_to_auto_skip', ())) + auto_skip = set(prefs.get('questions_to_auto_skip', ())) except Exception: auto_skip = set() if (skip_dialog_name is not None and skip_dialog_name in auto_skip): @@ -438,7 +439,7 @@ def question_dialog(parent, title, msg, det_msg='', show_copy_button=False, if skip_dialog_name is not None and not d.toggle_checkbox.isChecked(): auto_skip.add(skip_dialog_name) - gprefs.set('questions_to_auto_skip', list(auto_skip)) + prefs.set('questions_to_auto_skip', list(auto_skip)) return ret diff --git a/src/calibre/gui2/tweak_book/preferences.py b/src/calibre/gui2/tweak_book/preferences.py index 750593c1aa..080e169a64 100644 --- a/src/calibre/gui2/tweak_book/preferences.py +++ b/src/calibre/gui2/tweak_book/preferences.py @@ -841,6 +841,10 @@ class Preferences(QDialog): elif key.startswith('skip_ask_to_show_current_diff_for_'): del tprefs[key] changed += 1 + elif key == 'questions_to_auto_skip': + changed += len(tprefs[key] or ()) + del tprefs[key] + msg = _('There are no disabled confirmation prompts') if changed: msg = ngettext(