Skip to content

Commit

Permalink
FIXUP: try loading pyside2 first and then pyside6
Browse files Browse the repository at this point in the history
The type checked mypy was producing countless error messages on linux
(where pyside2 is the default). Loading PySide2 before PySide6 seems to
resolve some of the issues.

The mypy --ignore-unused-imports had to be removed since it would fail
on systems with PySide6 and on systems with PySide2 they would complain
that the import of QtCore, for example, as being redefined.
  • Loading branch information
deeplow committed Jan 16, 2023
1 parent 0090fb9 commit 7c6eab4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ MYPY_ARGS := --ignore-missing-imports \
--disallow-incomplete-defs \
--disallow-untyped-defs \
--show-error-codes \
--warn-unreachable \
--warn-unused-ignores
--warn-unreachable

mypy-host:
mypy $(MYPY_ARGS) dangerzone
Expand Down
4 changes: 2 additions & 2 deletions dangerzone/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import colorama

try:
from PySide6 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide2 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide6 import QtCore, QtGui, QtWidgets # type: ignore [no-redef]

from .. import args, errors
from ..document import Document
Expand Down
4 changes: 2 additions & 2 deletions dangerzone/gui/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from colorama import Fore

try:
from PySide6 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide2 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide6 import QtCore, QtGui, QtWidgets # type: ignore [no-redef]

if platform.system() == "Linux":
from xdg.DesktopEntry import DesktopEntry
Expand Down
4 changes: 2 additions & 2 deletions dangerzone/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from colorama import Fore, Style

try:
from PySide6 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide2 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide6 import QtCore, QtGui, QtWidgets # type: ignore [no-redef]

from .. import container, errors
from ..container import convert
Expand Down

0 comments on commit 7c6eab4

Please sign in to comment.