diff --git a/dangerzone/gui/__init__.py b/dangerzone/gui/__init__.py index 758094f73..677bea8e2 100644 --- a/dangerzone/gui/__init__.py +++ b/dangerzone/gui/__init__.py @@ -7,7 +7,7 @@ import click import colorama -from PySide2 import QtCore, QtWidgets +from PySide2 import QtCore, QtWidgets, QtGui from ..global_common import GlobalCommon from .common import GuiCommon @@ -29,9 +29,10 @@ def __init__(self) -> None: self.original_event = self.app.event - def monkeypatch_event(event: QtCore.QEvent) -> bool: + def monkeypatch_event(arg__1: QtCore.QEvent) -> bool: + event = arg__1 # oddly Qt calls internally event by "arg__1" # In macOS, handle the file open event - if event.type() == QtCore.QEvent.FileOpen: + if isinstance(event, QtGui.QFileOpenEvent): # Skip file open events in dev mode if not hasattr(sys, "dangerzone_dev"): self.document_selected.emit(event.file()) @@ -42,7 +43,7 @@ def monkeypatch_event(event: QtCore.QEvent) -> bool: return self.original_event(event) - self.app.event = monkeypatch_event + self.app.event = monkeypatch_event # type: ignore [assignment] @click.command()