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

+1-1
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/'
+26
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

+26
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

+26
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

+26
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

+26
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

+26
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

+22
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

+21-3
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,
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')

winpython/_vendor/qtpy/QtGui.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
1414
"""
1515
import warnings
1616

17-
from . import PYQT5, PYQT4, PYSIDE, PYSIDE2, PythonQtError
17+
from . import PYQT5, PYQT4, PYSIDE, PYSIDE2, PYSIDE6, PythonQtError
1818

1919

2020
if PYQT5:
2121
from PyQt5.QtGui import *
2222
elif PYSIDE2:
2323
from PySide2.QtGui import *
24+
elif PYSIDE6:
25+
from PySide6.QtGui import *
26+
QFontMetrics.width=QFontMetrics.horizontalAdvance #ssugested adddition stonebig
2427
elif PYQT4:
2528
try:
2629
# Older versions of PyQt4 do not provide these
@@ -33,7 +36,11 @@
3336
qFuzzyCompare)
3437
except ImportError:
3538
pass
36-
from PyQt4.Qt import QKeySequence, QTextCursor
39+
try:
40+
from PyQt4.Qt import QKeySequence, QTextCursor
41+
except ImportError:
42+
# In PyQt4-sip 4.19.13 QKeySequence and QTextCursor are in PyQt4.QtGui
43+
from PyQt4.QtGui import QKeySequence, QTextCursor
3744
from PyQt4.QtGui import (QAbstractTextDocumentLayout, QActionEvent, QBitmap,
3845
QBrush, QClipboard, QCloseEvent, QColor,
3946
QConicalGradient, QContextMenuEvent, QCursor,

winpython/_vendor/qtpy/QtHelp.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99

1010
import warnings
1111

12-
from . import PYQT5
13-
from . import PYQT4
14-
from . import PYSIDE
15-
from . import PYSIDE2
12+
from . import PYQT5, PYQT4, PYSIDE6, PYSIDE2, PYSIDE
1613

1714
if PYQT5:
1815
from PyQt5.QtHelp import *
16+
elif PYSIDE6:
17+
from PySide6.QtHelp import *
1918
elif PYSIDE2:
2019
from PySide2.QtHelp import *
2120
elif PYQT4:

winpython/_vendor/qtpy/QtLocation.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 QtLocation classes and functions."""
9+
10+
# Local imports
11+
from . import PYQT5, PYSIDE2, PythonQtError
12+
13+
if PYQT5:
14+
from PyQt5.QtLocation import *
15+
elif PYSIDE2:
16+
from PySide2.QtLocation import *
17+
else:
18+
raise PythonQtError('No Qt bindings could be found')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 QtMultimediaWidgets classes and functions."""
9+
10+
# Local imports
11+
from . import PYSIDE2, PYQT5, PythonQtError
12+
13+
if PYQT5:
14+
from PyQt5.QtMultimediaWidgets import *
15+
elif PYSIDE2:
16+
from PySide2.QtMultimediaWidgets import *
17+
else:
18+
raise PythonQtError('No Qt bindings could be found')

winpython/_vendor/qtpy/QtNetwork.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
Provides QtNetwork 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.QtNetwork import *
18+
elif PYSIDE6:
19+
from PySide6.QtNetwork import *
1820
elif PYSIDE2:
1921
from PySide2.QtNetwork import *
2022
elif PYQT4:

winpython/_vendor/qtpy/QtOpenGL.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@
88
"""Provides QtOpenGL classes and functions."""
99

1010
# Local imports
11-
from . import PYQT4, PYQT5, PYSIDE, PythonQtError
11+
from . import PYQT4, PYQT5, PYSIDE, PYSIDE2, PythonQtError
1212

1313
if PYQT5:
1414
from PyQt5.QtOpenGL import *
15+
elif PYSIDE6:
16+
from PySide6.QtOpenGL import *
17+
elif PYSIDE2:
18+
from PySide2.QtOpenGL import *
1519
elif PYQT4:
1620
from PyQt4.QtOpenGL import *
1721
elif PYSIDE:
1822
from PySide.QtOpenGL import *
1923
else:
2024
raise PythonQtError('No Qt bindings could be found')
2125

22-
del PYQT4, PYQT5, PYSIDE
26+
del PYQT4, PYQT5, PYSIDE, PYSIDE2

0 commit comments

Comments
 (0)