From 7aa010a0a0526b2cc3b947cfc277dc0da22a8081 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Tue, 26 Sep 2017 13:59:24 +0200 Subject: Signature: support the new types and constants of 5.9 This patch covers macOS and Ubuntu (which actually had one addition). No idea how oftem we must iterate ;-) Task-number: PYSIDE-510 Change-Id: I950c57c2d225b289eafc46e7f1758338b4d62838 Reviewed-by: Friedemann Kleint --- .../pyside2/PySide2/support/signature/mapping.py | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sources/pyside2/PySide2/support/signature/mapping.py b/sources/pyside2/PySide2/support/signature/mapping.py index f6ec9868d..32ac9422f 100644 --- a/sources/pyside2/PySide2/support/signature/mapping.py +++ b/sources/pyside2/PySide2/support/signature/mapping.py @@ -67,6 +67,7 @@ if PY3: # Much more, do we need that? Do we better kill it? ModelIndexList = typing.List[int] QImageCleanupFunction = typing.Callable[[bytes], None] + FloatMatrix = typing.List[typing.List[float]] else: ellipsis = "..." Char = str @@ -74,6 +75,7 @@ else: Variant = object ModelIndexList = list QImageCleanupFunction = object + FloatMatrix = list Pair = collections.namedtuple('Pair', ['first', 'second']) # ulong_max is only 32 bit on windows. ulong_max = 2*sys.maxsize+1 if len(struct.pack("L", 1)) != 4 else 0xffffffff @@ -121,10 +123,11 @@ type_map = {} def init_QtCore(): import PySide2.QtCore from PySide2.QtCore import Qt, QUrl, QDir, QGenericArgument + from PySide2.QtCore import QRect, QSize, QPoint from PySide2.QtCore import QMarginsF # 5.9 try: # seems to be not generated by 5.9 ATM. - from PySide2.QtCore import Connection, QRect, QSize, QPoint + from PySide2.QtCore import Connection except ImportError: pass type_map.update({ @@ -210,10 +213,20 @@ def init_QtCore(): "PyUnicode": str if PY3 else unicode, "signed long": int, "PySide2.QtCore.int": int, + "PySide2.QtCore.char": StringList, # A 'char **' is a list of strings. + "char[]": StringList, # 5.9 "unsigned long int": int, # 5.6, RHEL 6.6 "unsigned short int": int, # 5.6, RHEL 6.6 "QGenericArgument((0))": None, # 5.6, RHEL 6.6. Is that ok? "4294967295UL": 4294967295, # 5.6, RHEL 6.6 + "PySide2.QtCore.int32_t": int, # 5.9 + "PySide2.QtCore.int64_t": int, # 5.9 + "UnsignedShortType": int, # 5.9 + "nullptr": None, # 5.9 + "uint64_t": int, # 5.9 + "PySide2.QtCore.uint32_t": int, # 5.9 + "float[][]": FloatMatrix, # 5.9 + "PySide2.QtCore.unsigned int": int, # 5.9 Ubuntu }) try: type_map.update({ @@ -239,7 +252,6 @@ def init_QtGui(): "GL_NEAREST": GL_NEAREST, "WId": WId, "PySide2.QtGui.QPlatformSurface": Virtual("PySide2.QtGui.QPlatformSurface"), # hmm... - "PySide2.QtCore.char": StringList, # A 'char **' is a list of strings. "QList< QTouchEvent.TouchPoint >()": list, "QPixmap()": lambda:QPixmap(), # we cannot create this without qApp }) @@ -248,6 +260,13 @@ def init_QtGui(): def init_QtWidgets(): import PySide2.QtWidgets from PySide2.QtWidgets import QWidget, QMessageBox, QStyleOption, QStyleHintReturn, QStyleOptionComplex + from PySide2.QtWidgets import QGraphicsItem, QStyleOptionGraphicsItem # 5.9 + if PY3: + GraphicsItemList = typing.List[QGraphicsItem] + StyleOptionGraphicsItemList = typing.List[QStyleOptionGraphicsItem] + else: + GraphicsItemList = list + StyleOptionGraphicsItemList = list type_map.update({ "QMessageBox.StandardButtons(Yes | No)": QMessageBox.StandardButtons( QMessageBox.Yes | QMessageBox.No), @@ -261,6 +280,8 @@ def init_QtWidgets(): "SO_Default": QStyleOption.SO_Default, "SH_Default": QStyleHintReturn.SH_Default, "SO_Complex": QStyleOptionComplex.SO_Complex, + "QGraphicsItem[]": GraphicsItemList, + "QStyleOptionGraphicsItem[]": StyleOptionGraphicsItemList, }) return locals() -- cgit v1.2.3