aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6')
-rw-r--r--sources/pyside6/doc/considerations.rst18
-rw-r--r--sources/pyside6/doc/developer/enumfeatures_doc.rst8
-rw-r--r--sources/pyside6/tests/QtCore/bug_462.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_826.py2
-rw-r--r--sources/pyside6/tests/QtCore/qcbor_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qenum_test.py10
-rw-r--r--sources/pyside6/tests/QtCore/qflags_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qsysinfo_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/bug_617.py2
-rw-r--r--sources/pyside6/tests/QtGui/qkeysequence_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qpen_test.py2
-rw-r--r--sources/pyside6/tests/QtSql/qvarianttype_test.py2
-rw-r--r--sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py12
-rw-r--r--sources/pyside6/tests/pysidetest/qvariant_test.py2
14 files changed, 37 insertions, 33 deletions
diff --git a/sources/pyside6/doc/considerations.rst b/sources/pyside6/doc/considerations.rst
index 58c95a112..78bd85bd6 100644
--- a/sources/pyside6/doc/considerations.rst
+++ b/sources/pyside6/doc/considerations.rst
@@ -241,6 +241,7 @@ part of modern Python. The implementation is perfectly modelled after the needs
users. It is therefore just consequent to stop having two different enum implementations
in the same application and instead to use the new Python implementation everywhere.
+
Existing Work
~~~~~~~~~~~~~
@@ -249,17 +250,18 @@ with Python variants, which harmonize the builtin enums with the already existin
``QEnum`` "macro" shown in the :ref:`QEnum` section.
-Activating the New Enums
+Enums behavior in PySide
~~~~~~~~~~~~~~~~~~~~~~~~
-The new approach to enum will be the default in ``PySide 6.4``, but a preview is already built
-into ``PySide 6.3`` with the environment variable:
-``PYSIDE63_OPTION_PYTHON_ENUM=1 python3 <myscript>`` enables the new enums.
-In ``PySide 6.4``, this flag is by default on, but it can be switched to the old Shiboken
-enums by setting the variable to 0.
+In ``PySide 6.3`` there was a double implementation of old and new enums, where the
+default was old enums.
+The new approach to enum is the default in ``PySide 6.4`` and becomes mandatory
+in ``PySide 6.6``. There exists the environment variable ``PYSIDE6_OPTION_PYTHON_ENUM``
+with the default value of "1". There can also variations be selected by specifying
+different flags, but the value of "0" (switching off) is no longer supported.
-This environment variable will stay until a general acceptance of the new enums has been
-reached and a fallback to the old implementation is no longer needed.
+The still available options for switching some enum features off can be found in the
+:ref:`enum-features` section.
The Differences between old and new Enums
diff --git a/sources/pyside6/doc/developer/enumfeatures_doc.rst b/sources/pyside6/doc/developer/enumfeatures_doc.rst
index b3edbe7b6..91b7b6346 100644
--- a/sources/pyside6/doc/developer/enumfeatures_doc.rst
+++ b/sources/pyside6/doc/developer/enumfeatures_doc.rst
@@ -1,3 +1,5 @@
+.. _enum-features:
+
The Set of Enum Features
========================
@@ -17,7 +19,7 @@ This is the table of all flags used to control the creation of Python enums.
====================== ===== ======================================================
Flag Name Value
====================== ===== ======================================================
-ENOPT_OLD_ENUM 0x00 (False) Disable new enums
+ENOPT_OLD_ENUM 0x00 (False) No longer possible since PySide 6.6
ENOPT_NEW_ENUM 0x01 (True) The default for PySide 6.4, full implementation
ENOPT_INHERIT_INT 0x02 Turn all Enum into IntEnum and Flag into IntFlag
ENOPT_GLOBAL_SHORTCUT 0x04 Re-add shortcuts for global enums
@@ -29,8 +31,8 @@ ENOPT_NO_MISSING 0x80 Don't allow missing values in Enum
====================== ===== ======================================================
Such a set of flags can be defined either by the environment variable
-``PYSIDE63_OPTION_PYTHON_ENUM`` or set by the Python variable
-``sys.pyside63_option_python_enum`` before PySide6 is imported.
+``PYSIDE6_OPTION_PYTHON_ENUM`` or set by the Python variable
+``sys.pyside6_option_python_enum`` before PySide6 is imported.
The environment variable also supports arbitrary integer expressions
by using ``ast.literal_eval``.
diff --git a/sources/pyside6/tests/QtCore/bug_462.py b/sources/pyside6/tests/QtCore/bug_462.py
index 2f13bb531..275faa215 100644
--- a/sources/pyside6/tests/QtCore/bug_462.py
+++ b/sources/pyside6/tests/QtCore/bug_462.py
@@ -16,7 +16,7 @@ from PySide6.QtCore import QObject, QCoreApplication, QEvent, QThread
class MyEvent(QEvent):
def __init__(self, i):
print("TYPE:", type(QEvent.User))
- super().__init__(QEvent.Type(QEvent.User + (0 if sys.pyside63_option_python_enum else 100)))
+ super().__init__(QEvent.Type(QEvent.User + (0 if sys.pyside6_option_python_enum else 100)))
self.i = i
diff --git a/sources/pyside6/tests/QtCore/bug_826.py b/sources/pyside6/tests/QtCore/bug_826.py
index 65b237d24..fd6e03149 100644
--- a/sources/pyside6/tests/QtCore/bug_826.py
+++ b/sources/pyside6/tests/QtCore/bug_826.py
@@ -33,7 +33,7 @@ class TestEnums(unittest.TestCase):
self.assertTrue(QEvent.User <= TestEvent.TestEventType <= QEvent.MaxUser)
self.assertTrue(QEvent.User <= TEST_EVENT_TYPE <= QEvent.MaxUser)
- @unittest.skipIf(sys.pyside63_option_python_enum, "makes no sense for tested Python enums")
+ @unittest.skipIf(sys.pyside6_option_python_enum, "makes no sense for tested Python enums")
def testUserTypesRepr(self):
self.assertEqual(eval(repr(TestEvent.TestEventType)), TestEvent.TestEventType)
self.assertEqual(eval(repr(TEST_EVENT_TYPE)), TEST_EVENT_TYPE)
diff --git a/sources/pyside6/tests/QtCore/qcbor_test.py b/sources/pyside6/tests/QtCore/qcbor_test.py
index edcac6c4b..6b088af17 100644
--- a/sources/pyside6/tests/QtCore/qcbor_test.py
+++ b/sources/pyside6/tests/QtCore/qcbor_test.py
@@ -56,7 +56,7 @@ class TestCbor(unittest.TestCase):
value = QCborValue('hello')
self.assertTrue(value.isString())
self.assertEqual(value.toString(), 'hello')
- if sys.pyside63_option_python_enum:
+ if sys.pyside6_option_python_enum:
# PYSIDE-1735: Undefined enums are not possible
return
tag = value.tag(QCborTag(32))
diff --git a/sources/pyside6/tests/QtCore/qenum_test.py b/sources/pyside6/tests/QtCore/qenum_test.py
index adcdcbacd..1a0cc857d 100644
--- a/sources/pyside6/tests/QtCore/qenum_test.py
+++ b/sources/pyside6/tests/QtCore/qenum_test.py
@@ -19,7 +19,7 @@ from PySide6.QtCore import Qt, QIODevice, QObject, QEnum, QFlag
class TestEnum(unittest.TestCase):
- @unittest.skipIf(sys.pyside63_option_python_enum, "not adequate for new enums to ask the value")
+ @unittest.skipIf(sys.pyside6_option_python_enum, "not adequate for new enums to ask the value")
def testToInt(self):
self.assertEqual(QIODevice.NotOpen, 0)
self.assertEqual(QIODevice.ReadOnly, 1)
@@ -30,7 +30,7 @@ class TestEnum(unittest.TestCase):
self.assertEqual(QIODevice.Text, 16)
self.assertEqual(QIODevice.Unbuffered, 32)
- @unittest.skipIf(sys.pyside63_option_python_enum, "not adequate for new enums to ask the value")
+ @unittest.skipIf(sys.pyside6_option_python_enum, "not adequate for new enums to ask the value")
def testToIntInFunction(self):
self.assertEqual(str(int(QIODevice.WriteOnly)), "2")
@@ -42,7 +42,7 @@ class TestEnum(unittest.TestCase):
self.assertEqual(k - 2, -(2 - k))
self.assertEqual(k * 2, 2 * k)
- if not sys.pyside63_option_python_enum:
+ if not sys.pyside6_option_python_enum:
# Floats work fine with new enums
with self.assertRaises(TypeError):
a = k + 2.0
@@ -53,7 +53,7 @@ class TestEnum(unittest.TestCase):
with self.assertRaises(TypeError):
a = k * 2.0
- @unittest.skipIf(sys.pyside63_option_python_enum, "inheritance forbidden for Python enums")
+ @unittest.skipIf(sys.pyside6_option_python_enum, "inheritance forbidden for Python enums")
def testInherit(self):
class A(Qt.Key):
pass
@@ -80,7 +80,7 @@ class TestEnum(unittest.TestCase):
class TestQFlags(unittest.TestCase):
- newenum = sys.pyside63_option_python_enum
+ newenum = sys.pyside6_option_python_enum
def testToItn(self):
om = QIODevice.NotOpen
diff --git a/sources/pyside6/tests/QtCore/qflags_test.py b/sources/pyside6/tests/QtCore/qflags_test.py
index 3b97e649f..c71028daf 100644
--- a/sources/pyside6/tests/QtCore/qflags_test.py
+++ b/sources/pyside6/tests/QtCore/qflags_test.py
@@ -113,7 +113,7 @@ class QFlagsOnQVariant(unittest.TestCase):
class QFlagsWrongType(unittest.TestCase):
- @unittest.skipIf(sys.pyside63_option_python_enum, "Qt.ItemFlag is no longer an IntEnum")
+ @unittest.skipIf(sys.pyside6_option_python_enum, "Qt.ItemFlag is no longer an IntEnum")
def testWrongType(self):
'''Wrong type passed to QFlags binary operators'''
for op in operator.or_, operator.and_, operator.xor:
@@ -136,7 +136,7 @@ class QEnumFlagDefault(unittest.TestCase):
oldEnum = Qt.AlignmentFlag()
self.assertEqual(type(oldFlag), Qt.Alignment)
self.assertEqual(type(oldEnum), Qt.AlignmentFlag)
- if sys.pyside63_option_python_enum:
+ if sys.pyside6_option_python_enum:
self.assertEqual(type(oldFlag), type(oldEnum))
else:
with self.assertRaises(AssertionError):
diff --git a/sources/pyside6/tests/QtCore/qsysinfo_test.py b/sources/pyside6/tests/QtCore/qsysinfo_test.py
index a25f7d115..30406ebf2 100644
--- a/sources/pyside6/tests/QtCore/qsysinfo_test.py
+++ b/sources/pyside6/tests/QtCore/qsysinfo_test.py
@@ -14,7 +14,7 @@ from PySide6.QtCore import QSysInfo
class TestQSysInfo(unittest.TestCase):
- newenum = sys.pyside63_option_python_enum
+ newenum = sys.pyside6_option_python_enum
def testEnumEndian(self):
self.assertEqual(QSysInfo.BigEndian.value if self.newenum else QSysInfo.BigEndian, 0)
diff --git a/sources/pyside6/tests/QtGui/bug_617.py b/sources/pyside6/tests/QtGui/bug_617.py
index 59b1a9a4a..b82a41882 100644
--- a/sources/pyside6/tests/QtGui/bug_617.py
+++ b/sources/pyside6/tests/QtGui/bug_617.py
@@ -28,7 +28,7 @@ class Bug617(unittest.TestCase):
def testOutOfBounds(self):
e = MyEvent()
self.assertEqual(repr(e.type()), "<Type.999: 999>"
- if sys.pyside63_option_python_enum else "PySide6.QtCore.QEvent.Type(999)")
+ if sys.pyside6_option_python_enum else "PySide6.QtCore.QEvent.Type(999)")
if __name__ == "__main__":
diff --git a/sources/pyside6/tests/QtGui/qkeysequence_test.py b/sources/pyside6/tests/QtGui/qkeysequence_test.py
index 66a4916e7..ef717e346 100644
--- a/sources/pyside6/tests/QtGui/qkeysequence_test.py
+++ b/sources/pyside6/tests/QtGui/qkeysequence_test.py
@@ -20,7 +20,7 @@ class QKeySequenceTest(UsesQApplication):
def testGetItemOperator(self):
# bug #774
- if sys.pyside63_option_python_enum:
+ if sys.pyside6_option_python_enum:
# PYSIDE-1735: Remapped from Qt.Modifier to Qt.KeyboardModifier
# Note that Qt.(Keyboard)?Modifier will be no longer IntFlag.
ks = QKeySequence(Qt.ShiftModifier, Qt.ControlModifier, Qt.Key_P, Qt.Key_R)
diff --git a/sources/pyside6/tests/QtGui/qpen_test.py b/sources/pyside6/tests/QtGui/qpen_test.py
index 84df8c499..c9d57f6c7 100644
--- a/sources/pyside6/tests/QtGui/qpen_test.py
+++ b/sources/pyside6/tests/QtGui/qpen_test.py
@@ -26,7 +26,7 @@ class Painting(QRasterWindow):
with QPainter(self) as painter:
painter.setPen(Qt.NoPen)
self.penFromEnum = painter.pen()
- intVal = Qt.NoPen.value if sys.pyside63_option_python_enum else int(Qt.NoPen)
+ intVal = Qt.NoPen.value if sys.pyside6_option_python_enum else int(Qt.NoPen)
painter.setPen(intVal)
self.penFromInteger = painter.pen()
QTimer.singleShot(20, self.close)
diff --git a/sources/pyside6/tests/QtSql/qvarianttype_test.py b/sources/pyside6/tests/QtSql/qvarianttype_test.py
index c2790cabf..afc5fadb9 100644
--- a/sources/pyside6/tests/QtSql/qvarianttype_test.py
+++ b/sources/pyside6/tests/QtSql/qvarianttype_test.py
@@ -17,7 +17,7 @@ from PySide6.QtSql import QSqlField
class QVariantTypeTest(unittest.TestCase):
def testQVariantType(self):
- new_enum = sys.pyside63_option_python_enum
+ new_enum = sys.pyside6_option_python_enum
cmp_id = QMetaType.QString.value if new_enum else QMetaType.QString
f = QSqlField("name", QMetaType(QMetaType.QString))
diff --git a/sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py b/sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py
index 0dcec5a4c..5ccbfb92e 100644
--- a/sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py
+++ b/sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py
@@ -51,7 +51,7 @@ def runtest(program):
def testprog2(option):
return runtest(dedent(f"""
- sys.pyside63_option_python_enum = {option}
+ sys.pyside6_option_python_enum = {option}
from PySide6 import QtCore
from enum import IntEnum
assert(issubclass(QtCore.Qt.DateFormat, IntEnum))
@@ -59,7 +59,7 @@ def testprog2(option):
def testprog4(option):
return runtest(dedent(f"""
- sys.pyside63_option_python_enum = {option}
+ sys.pyside6_option_python_enum = {option}
from PySide6 import QtCore
QtCore.QtDebugMsg
"""))
@@ -67,28 +67,28 @@ def testprog4(option):
def testprog8_16(option):
# this test needs flag 16, or the effect would be hidden by forgiving mode
return runtest(dedent(f"""
- sys.pyside63_option_python_enum = {option}
+ sys.pyside6_option_python_enum = {option}
from PySide6 import QtCore
QtCore.Qt.AlignTop
"""))
def testprog32(option):
return runtest(dedent(f"""
- sys.pyside63_option_python_enum = {option}
+ sys.pyside6_option_python_enum = {option}
from PySide6 import QtCore
QtCore.Qt.Alignment
"""))
def testprog64(option):
return runtest(dedent(f"""
- sys.pyside63_option_python_enum = {option}
+ sys.pyside6_option_python_enum = {option}
from PySide6 import QtCore
QtCore.Qt.AlignmentFlag()
"""))
def testprog128(option):
return runtest(dedent(f"""
- sys.pyside63_option_python_enum = {option}
+ sys.pyside6_option_python_enum = {option}
from PySide6 import QtCore
QtCore.Qt.Key(1234567)
"""))
diff --git a/sources/pyside6/tests/pysidetest/qvariant_test.py b/sources/pyside6/tests/pysidetest/qvariant_test.py
index df623146d..8676c5eeb 100644
--- a/sources/pyside6/tests/pysidetest/qvariant_test.py
+++ b/sources/pyside6/tests/pysidetest/qvariant_test.py
@@ -38,7 +38,7 @@ class QVariantTest(UsesQApplication):
self.assertEqual(TestObject.checkType(ks), 4107)
# PYSIDE-1735: Test the new way to address QKeyCombination after moving IntEnum to Enum
- @unittest.skipUnless(sys.pyside63_option_python_enum, "only implemented for new enums")
+ @unittest.skipUnless(sys.pyside6_option_python_enum, "only implemented for new enums")
def testQKeySequenceMoreVariations(self):
QAction().setShortcut(Qt.CTRL | Qt.Key_B)
QAction().setShortcut(Qt.CTRL | Qt.ALT | Qt.Key_B)