Skip to content

Commit

Permalink
Add PySide6 dependency for Windows and MacOS
Browse files Browse the repository at this point in the history
We're not yet adding them to Linux, since PySide6 is not yet available
in Linux distros' packages, whereas with Linux and macOS our packaging
process includes the shipped binaries.

Fixes #211
  • Loading branch information
deeplow authored and apyrgio committed Jan 25, 2023
1 parent dd8389b commit c7071ae
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 7 deletions.
11 changes: 10 additions & 1 deletion dangerzone/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@
import platform
import signal
import sys
import typing
import uuid
from typing import Dict, List, Optional

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

# FIXME: See https://github.com/freedomofpress/dangerzone/issues/320 for more details.
if typing.TYPE_CHECKING:
from PySide2 import QtCore, QtGui, QtWidgets
else:
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
11 changes: 10 additions & 1 deletion dangerzone/gui/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@
import platform
import shlex
import subprocess
import typing
from pathlib import Path
from typing import Dict

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

# FIXME: See https://github.com/freedomofpress/dangerzone/issues/320 for more details.
if typing.TYPE_CHECKING:
from PySide2 import QtCore, QtGui, QtWidgets
else:
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
17 changes: 14 additions & 3 deletions dangerzone/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@
import shutil
import subprocess
import tempfile
import typing
from multiprocessing.pool import ThreadPool
from typing import List, Optional

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

# FIXME: See https://github.com/freedomofpress/dangerzone/issues/320 for more details.
if typing.TYPE_CHECKING:
from PySide2 import QtCore, QtGui, QtWidgets
else:
try:
from PySide6 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide2 import QtCore, QtGui, QtWidgets

from .. import errors
from ..document import SAFE_EXTENSION, Document
Expand Down Expand Up @@ -385,8 +394,10 @@ def __init__(self, dangerzone: DangerzoneGui) -> None:
self.safe_extension_name_layout.addWidget(self.safe_extension_filename)
self.safe_extension_name_layout.addWidget(self.safe_extension)

dot_pdf_regex = QtCore.QRegExp(r".*\.[Pp][Dd][Ff]")
self.safe_extension.setValidator(QtGui.QRegExpValidator(dot_pdf_regex))
dot_pdf_regex = QtCore.QRegularExpression(r".*\.[Pp][Dd][Ff]")
self.safe_extension.setValidator(
QtGui.QRegularExpressionValidator(dot_pdf_regex)
)
self.safe_extension_layout = QtWidgets.QHBoxLayout()
self.safe_extension_layout.addWidget(self.save_checkbox)
self.safe_extension_layout.addWidget(self.safe_extension_label)
Expand Down
78 changes: 77 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ license = "MIT"
python = ">=3.7,<3.11"
click = "*"
appdirs = "*"
PySide2 = "5.15.2.1"
PySide2 = {version = "5.15.2.1", platform = "linux"}
PySide6 = {version = "^6.4.1", markers = "sys_platform == 'win32' or sys_platform == 'darwin'"}
colorama = "*"
pyxdg = {version = "*", platform = "linux"}

Expand Down

0 comments on commit c7071ae

Please sign in to comment.