Skip to content

Commit

Permalink
Import Pyside6, fallback to Pyside2 when unavailable
Browse files Browse the repository at this point in the history
Fixes #177
  • Loading branch information
deeplow committed Dec 23, 2022
1 parent fbb4b18 commit 0ef3938
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
6 changes: 5 additions & 1 deletion dangerzone/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@

import click
import colorama
from PySide2 import QtCore, QtGui, QtWidgets

try:
from PySide6 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide2 import QtCore, QtGui, QtWidgets

from .. import args, errors
from ..document import Document
Expand Down
6 changes: 5 additions & 1 deletion dangerzone/gui/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
from typing import Dict

from colorama import Fore
from PySide2 import QtCore, QtGui, QtWidgets

try:
from PySide6 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide2 import QtCore, QtGui, QtWidgets

if platform.system() == "Linux":
from xdg.DesktopEntry import DesktopEntry
Expand Down
10 changes: 9 additions & 1 deletion dangerzone/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@
from typing import List, Optional

from colorama import Fore, Style
from PySide2 import QtCore, QtGui, QtWidgets

try:
from PySide6 import QtCore, QtGui, QtWidgets

# Alias renamed Qt6 methods for backwards compatibility
QtCore.QRegExp = QtCore.QRegularExpression
QtGui.QRegExpValidator = QtGui.QRegularExpressionValidator
except ImportError:
from PySide2 import QtCore, QtGui, QtWidgets

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

0 comments on commit 0ef3938

Please sign in to comment.