From a54f181ae0c83e81e108ed93569a3de5cfa5c357 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 4 Jul 2021 16:00:23 +1000 Subject: [PATCH] remove old Mac shortcut code completely The shortcuts seem to work correctly without it on Qt 5.14, so this code seems to have only been required for older Qt releases. --- qt/aqt/editor.py | 2 +- qt/aqt/webview.py | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index c2e6f8799..7766dd9e8 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -1052,7 +1052,7 @@ $editorToolbar.then(({{ toolbar }}) => toolbar.appendGroup({{ class EditorWebView(AnkiWebView): def __init__(self, parent: QWidget, editor: Editor) -> None: - AnkiWebView.__init__(self, title="editor", mac_default_shortcuts=False) + AnkiWebView.__init__(self, title="editor") self.editor = editor self.setAcceptDrops(True) self._markInternal = False diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index aec378c2c..a5be5e21c 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -213,8 +213,6 @@ class AnkiWebView(QWebEngineView): self, parent: Optional[QWidget] = None, title: str = "default", - *, - mac_default_shortcuts: bool = True, ) -> None: QWebEngineView.__init__(self, parent=parent) self.set_title(title) @@ -242,23 +240,6 @@ class AnkiWebView(QWebEngineView): context=Qt.WidgetWithChildrenShortcut, activated=self.onEsc, ) - if isMac and mac_default_shortcuts: - for key, fn in [ - (QKeySequence.Copy, self.onCopy), - (QKeySequence.Paste, self.onPaste), - (QKeySequence.Cut, self.onCut), - (QKeySequence.SelectAll, self.onSelectAll), - ]: - QShortcut( # type: ignore - key, self, context=Qt.WidgetWithChildrenShortcut, activated=fn - ) - - QShortcut( # type: ignore - QKeySequence("ctrl+shift+v"), - self, - context=Qt.WidgetWithChildrenShortcut, - activated=self.onPaste, - ) def set_title(self, title: str) -> None: self.title = title # type: ignore[assignment]