-
-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Add PySide2 support #84
Merged
Merged
Changes from 5 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
579e104
Initial setup for PySide2 support, pretesting
dgovil 9a9b66a
Updated __init__ dict and added PySide2 del to QtSvg.py
dgovil bfefe75
Added __init__ to tests to make them easy to load individually
dgovil 50d2a81
Added comment to QtWebEngineWidgets for PySide2
dgovil 135b49b
Updated tests to have PySide2 tests
dgovil 6ad0112
Addressing notes by @Nodd
dgovil 10327bd
Addressing notes by @Nodd
dgovil 25d3c40
Merge branch 'master' into PySide2Support
ccordoba12 9c1a62e
Add missing newline in gitignore
ccordoba12 5b34639
Activate support for Pyside again
ccordoba12 450f65e
Update wih master
ccordoba12 123e2d3
Testing: Fix error in Appveyor and don't run ciocheck in CircleCI
ccordoba12 1865ddd
Testing: Add missing pytest dependencies on CircleCI
ccordoba12 b7f34eb
Testing: Simplify testing on CircleCI
ccordoba12 cd289f1
Testing: Skip a test that it's segfaulting in Python 3
ccordoba12 d8d8ac1
Testing: Add a package needed for PyQt 5.8
ccordoba12 4070af4
Testing: Fix missing pyqt 4 conda package in Python 3.6
ccordoba12 458bef8
Testing: Skip another test on Python 3 because it's failing
ccordoba12 7881f5c
Testing: Add a script to test PySide2
ccordoba12 2066fb9
Fix setting QT_API for PySide2
ccordoba12 d5dad47
Testing: Make tests work with PySide2
ccordoba12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,4 @@ lib64 | |
# Other files | ||
toread.md | ||
.chache | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,17 @@ | |
>>> print(QtWidgets.QWidget) | ||
|
||
|
||
PySide2 | ||
====== | ||
|
||
Set the QT_API environment variable to 'pyside2' before importing other | ||
packages:: | ||
|
||
>>> import os | ||
>>> os.environ['QT_API'] = 'pyside2' | ||
>>> from qtpy import QtGui, QtWidgets, QtCore | ||
>>> print(QtWidgets.QWidget) | ||
|
||
PyQt4 | ||
===== | ||
|
||
|
@@ -66,14 +77,16 @@ | |
] | ||
#: names of the expected PySide api | ||
PYSIDE_API = ['pyside'] | ||
#: names of the expected PySide2 api | ||
PYSIDE2_API = ['pyside2'] | ||
|
||
os.environ.setdefault(QT_API, 'pyqt5') | ||
API = os.environ[QT_API].lower() | ||
assert API in (PYQT5_API + PYQT4_API + PYSIDE_API) | ||
assert API in (PYQT5_API + PYQT4_API + PYSIDE_API+PYSIDE2_API) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spaces around the |
||
|
||
is_old_pyqt = is_pyqt46 = False | ||
PYQT5 = True | ||
PYQT4 = PYSIDE = False | ||
PYQT4 = PYSIDE = PYSIDE2 = False | ||
|
||
|
||
class PythonQtError(Exception): | ||
|
@@ -89,6 +102,17 @@ class PythonQtError(Exception): | |
except ImportError: | ||
API = os.environ['QT_API'] = 'pyqt' | ||
|
||
if API in PYSIDE2_API: | ||
try: | ||
from PySide2 import __version__ as PYSIDE_VERSION # analysis:ignore | ||
from PySide2.QtCore import __version__ as QT_VERSION # analysis:ignore | ||
|
||
PYQT_VERSION = None | ||
PYQT5 = False | ||
PYSIDE2 = True | ||
except ImportError: | ||
API = os.environ['QT_API'] = 'pyqt4' | ||
|
||
if API in PYQT4_API: | ||
try: | ||
import sip | ||
|
@@ -119,13 +143,13 @@ class PythonQtError(Exception): | |
from PySide import __version__ as PYSIDE_VERSION # analysis:ignore | ||
from PySide.QtCore import __version__ as QT_VERSION # analysis:ignore | ||
PYQT_VERSION = None | ||
PYQT5 = False | ||
PYQT5 = PYSIDE2 = False | ||
PYSIDE = True | ||
except ImportError: | ||
raise PythonQtError('No Qt bindings could be found') | ||
|
||
API_NAME = {'pyqt5': 'PyQt5', 'pyqt': 'PyQt4', 'pyqt4': 'PyQt4', | ||
'pyside': 'PySide'}[API] | ||
'pyside': 'PySide', 'pyside2':'PySide2'}[API] | ||
if PYQT4: | ||
import sip | ||
try: | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means that right now importing
QtWebEngineWidgets
will fail with pyside2 even ifQWebEngineSettings
is not used ? I'm in favor of commenting this line for now and readding it when pyside2 includesQWebSettings
.