From 53ae03becc565746c3ba213d5b9f10bb95f610a8 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Thu, 15 Apr 2021 03:49:53 +0200 Subject: [PATCH] Add Preview shortcut for browser --- qt/aqt/browser/browser.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qt/aqt/browser/browser.py b/qt/aqt/browser/browser.py index 6e485c83e..2a0606789 100644 --- a/qt/aqt/browser/browser.py +++ b/qt/aqt/browser/browser.py @@ -396,8 +396,14 @@ $editorToolbar.addButton({{ """ ) + def add_preview_shortcut(cuts, editor: Editor) -> None: + cuts.append(("Ctrl+Shift+P", self.onTogglePreview, True)) + + gui_hooks.editor_did_init.append(add_preview_button) + gui_hooks.editor_did_init_shortcuts.append(add_preview_shortcut) self.editor = aqt.editor.Editor(self.mw, self.form.fieldsArea, self) + gui_hooks.editor_did_init_shortcuts.remove(add_preview_shortcut) gui_hooks.editor_did_init.remove(add_preview_button) @ensure_editor_saved