Skip to content

Commit 6bbf6f9

Browse files
authored
Merge pull request winpython#928 from stonebig/master
Pyside6 (Qt6) compatibility
2 parents 72f8141 + ba88328 commit 6bbf6f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1491
-89
lines changed

winpython/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
OTHER DEALINGS IN THE SOFTWARE.
2929
"""
3030

31-
__version__ = '3.2.20210117'
31+
__version__ = '3.3.20210131'
3232
__license__ = __doc__
3333
__project_url__ = 'http://winpython.github.io/'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
# -----------------------------------------------------------------------------
3+
# Copyright © 2009- The Spyder Development Team
4+
#
5+
# Licensed under the terms of the MIT License
6+
# (see LICENSE.txt for details)
7+
# -----------------------------------------------------------------------------
8+
"""Provides Qt3DAnimation classes and functions."""
9+
10+
# Local imports
11+
from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION
12+
from .py3compat import PY2
13+
14+
if PYQT5:
15+
from PyQt5.Qt3DAnimation import *
16+
elif PYSIDE2:
17+
if not PY2 or (PY2 and PYSIDE_VERSION < '5.12.4'):
18+
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
19+
import PySide2.Qt3DAnimation as __temp
20+
import inspect
21+
for __name in inspect.getmembers(__temp.Qt3DAnimation):
22+
globals()[__name[0]] = __name[1]
23+
else:
24+
raise PythonQtError('A bug in Shiboken prevents this')
25+
else:
26+
raise PythonQtError('No Qt bindings could be found')

winpython/_vendor/qtpy/Qt3DCore.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
# -----------------------------------------------------------------------------
3+
# Copyright © 2009- The Spyder Development Team
4+
#
5+
# Licensed under the terms of the MIT License
6+
# (see LICENSE.txt for details)
7+
# -----------------------------------------------------------------------------
8+
"""Provides Qt3DCore classes and functions."""
9+
10+
# Local imports
11+
from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION
12+
from .py3compat import PY2
13+
14+
if PYQT5:
15+
from PyQt5.Qt3DCore import *
16+
elif PYSIDE2:
17+
if not PY2 or (PY2 and PYSIDE_VERSION < '5.12.4'):
18+
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
19+
import PySide2.Qt3DCore as __temp
20+
import inspect
21+
for __name in inspect.getmembers(__temp.Qt3DCore):
22+
globals()[__name[0]] = __name[1]
23+
else:
24+
raise PythonQtError('A bug in Shiboken prevents this')
25+
else:
26+
raise PythonQtError('No Qt bindings could be found')

winpython/_vendor/qtpy/Qt3DExtras.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
# -----------------------------------------------------------------------------
3+
# Copyright © 2009- The Spyder Development Team
4+
#
5+
# Licensed under the terms of the MIT License
6+
# (see LICENSE.txt for details)
7+
# -----------------------------------------------------------------------------
8+
"""Provides Qt3DExtras classes and functions."""
9+
10+
# Local imports
11+
from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION
12+
from .py3compat import PY2
13+
14+
if PYQT5:
15+
from PyQt5.Qt3DExtras import *
16+
elif PYSIDE2:
17+
if not PY2 or (PY2 and PYSIDE_VERSION < '5.12.4'):
18+
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
19+
import PySide2.Qt3DExtras as __temp
20+
import inspect
21+
for __name in inspect.getmembers(__temp.Qt3DExtras):
22+
globals()[__name[0]] = __name[1]
23+
else:
24+
raise PythonQtError('A bug in Shiboken prevents this')
25+
else:
26+
raise PythonQtError('No Qt bindings could be found')

winpython/_vendor/qtpy/Qt3DInput.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
# -----------------------------------------------------------------------------
3+
# Copyright © 2009- The Spyder Development Team
4+
#
5+
# Licensed under the terms of the MIT License
6+
# (see LICENSE.txt for details)
7+
# -----------------------------------------------------------------------------
8+
"""Provides Qt3DInput classes and functions."""
9+
10+
# Local imports
11+
from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION
12+
from .py3compat import PY2
13+
14+
if PYQT5:
15+
from PyQt5.Qt3DInput import *
16+
elif PYSIDE2:
17+
if not PY2 or (PY2 and PYSIDE_VERSION < '5.12.4'):
18+
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
19+
import PySide2.Qt3DInput as __temp
20+
import inspect
21+
for __name in inspect.getmembers(__temp.Qt3DInput):
22+
globals()[__name[0]] = __name[1]
23+
else:
24+
raise PythonQtError('A bug in Shiboken prevents this')
25+
else:
26+
raise PythonQtError('No Qt bindings could be found')

winpython/_vendor/qtpy/Qt3DLogic.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
# -----------------------------------------------------------------------------
3+
# Copyright © 2009- The Spyder Development Team
4+
#
5+
# Licensed under the terms of the MIT License
6+
# (see LICENSE.txt for details)
7+
# -----------------------------------------------------------------------------
8+
"""Provides Qt3DLogic classes and functions."""
9+
10+
# Local imports
11+
from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION
12+
from .py3compat import PY2
13+
14+
if PYQT5:
15+
from PyQt5.Qt3DLogic import *
16+
elif PYSIDE2:
17+
if not PY2 or (PY2 and PYSIDE_VERSION < '5.12.4'):
18+
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
19+
import PySide2.Qt3DLogic as __temp
20+
import inspect
21+
for __name in inspect.getmembers(__temp.Qt3DLogic):
22+
globals()[__name[0]] = __name[1]
23+
else:
24+
raise PythonQtError('A bug in Shiboken prevents this')
25+
else:
26+
raise PythonQtError('No Qt bindings could be found')

winpython/_vendor/qtpy/Qt3DRender.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
# -----------------------------------------------------------------------------
3+
# Copyright © 2009- The Spyder Development Team
4+
#
5+
# Licensed under the terms of the MIT License
6+
# (see LICENSE.txt for details)
7+
# -----------------------------------------------------------------------------
8+
"""Provides Qt3DRender classes and functions."""
9+
10+
# Local imports
11+
from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION
12+
from .py3compat import PY2
13+
14+
if PYQT5:
15+
from PyQt5.Qt3DRender import *
16+
elif PYSIDE2:
17+
if not PY2 or (PY2 and PYSIDE_VERSION < '5.12.4'):
18+
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
19+
import PySide2.Qt3DRender as __temp
20+
import inspect
21+
for __name in inspect.getmembers(__temp.Qt3DRender):
22+
globals()[__name[0]] = __name[1]
23+
else:
24+
raise PythonQtError('A bug in Shiboken prevents this')
25+
else:
26+
raise PythonQtError('No Qt bindings could be found')

winpython/_vendor/qtpy/QtCharts.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- coding: utf-8 -*-
2+
# -----------------------------------------------------------------------------
3+
# Copyright © 2019- The Spyder Development Team
4+
#
5+
# Licensed under the terms of the MIT License
6+
# (see LICENSE.txt for details)
7+
# -----------------------------------------------------------------------------
8+
"""Provides QtChart classes and functions."""
9+
10+
# Local imports
11+
from . import PYQT5, PYSIDE2, PythonQtError
12+
13+
if PYQT5:
14+
try:
15+
from PyQt5 import QtChart as QtCharts
16+
except ImportError:
17+
raise PythonQtError('The QtChart module was not found. '
18+
'It needs to be installed separately for PyQt5.')
19+
elif PYSIDE2:
20+
from PySide2.QtCharts import *
21+
else:
22+
raise PythonQtError('No Qt bindings could be found')

winpython/_vendor/qtpy/QtCore.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,49 @@
1010
Provides QtCore classes and functions.
1111
"""
1212

13-
from . import PYQT5, PYSIDE2, PYQT4, PYSIDE, PythonQtError
13+
from . import PYQT5, PYSIDE2, PYSIDE6, PYQT4, PYSIDE, PythonQtError
1414

1515

1616
if PYQT5:
1717
from PyQt5.QtCore import *
1818
from PyQt5.QtCore import pyqtSignal as Signal
19+
from PyQt5.QtCore import pyqtBoundSignal as SignalInstance
1920
from PyQt5.QtCore import pyqtSlot as Slot
2021
from PyQt5.QtCore import pyqtProperty as Property
2122
from PyQt5.QtCore import QT_VERSION_STR as __version__
2223

24+
# For issue #153
25+
from PyQt5.QtCore import QDateTime
26+
QDateTime.toPython = QDateTime.toPyDateTime
27+
2328
# Those are imported from `import *`
24-
del pyqtSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR
29+
del pyqtSignal, pyqtBoundSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR
30+
31+
elif PYSIDE6:
32+
from PySide6.QtCore import *
33+
import PySide6.QtCore
34+
__version__ = PySide6.QtCore.__version__
35+
Qt.BackgroundColorRole=Qt.BackgroundRole # suggested addition stonebig
36+
Qt.TextColorRole=Qt.ForegroundRole # suggested addition stonebig
37+
Qt.MidButton = Qt.MiddleButton # suggested addition stonebig
2538
elif PYSIDE2:
2639
from PySide2.QtCore import *
40+
2741
try: # may be limited to PySide-5.11a1 only
2842
from PySide2.QtGui import QStringListModel
2943
except:
3044
pass
45+
46+
import PySide2.QtCore
47+
__version__ = PySide2.QtCore.__version__
3148
elif PYQT4:
3249
from PyQt4.QtCore import *
3350
# Those are things we inherited from Spyder that fix crazy crashes under
3451
# some specific situations. (See #34)
3552
from PyQt4.QtCore import QCoreApplication
3653
from PyQt4.QtCore import Qt
3754
from PyQt4.QtCore import pyqtSignal as Signal
55+
from PyQt4.Qtcore import pyqtBoundSignal as SignalInstance
3856
from PyQt4.QtCore import pyqtSlot as Slot
3957
from PyQt4.QtCore import pyqtProperty as Property
4058
from PyQt4.QtGui import (QItemSelection, QItemSelectionModel,
@@ -65,7 +83,7 @@ class QStandardPaths():
6583
writableLocation = _QDesktopServices.storageLocation
6684

6785
# Those are imported from `import *`
68-
del pyqtSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR, qInstallMsgHandler
86+
del pyqtSignal, pyqtBoundSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR, qInstallMsgHandler
6987
elif PYSIDE:
7088
from PySide.QtCore import *
7189
from PySide.QtGui import (QItemSelection, QItemSelectionModel,
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- coding: utf-8 -*-
2+
# -----------------------------------------------------------------------------
3+
# Copyright © 2009- The Spyder Development Team
4+
#
5+
# Licensed under the terms of the MIT License
6+
# (see LICENSE.txt for details)
7+
# -----------------------------------------------------------------------------
8+
"""Provides QtDataVisualization classes and functions."""
9+
10+
# Local imports
11+
from . import PYQT5, PYSIDE2, PythonQtError
12+
13+
if PYQT5:
14+
from PyQt5.QtDataVisualization import *
15+
elif PYSIDE2:
16+
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
17+
import PySide2.QtDataVisualization as __temp
18+
import inspect
19+
for __name in inspect.getmembers(__temp.QtDataVisualization):
20+
globals()[__name[0]] = __name[1]
21+
else:
22+
raise PythonQtError('No Qt bindings could be found')

0 commit comments

Comments
 (0)