diff options
Diffstat (limited to 'sources/pyside2/PySide2/support/generate_pyi.py')
-rw-r--r-- | sources/pyside2/PySide2/support/generate_pyi.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sources/pyside2/PySide2/support/generate_pyi.py b/sources/pyside2/PySide2/support/generate_pyi.py index c732227f4..8aa69c983 100644 --- a/sources/pyside2/PySide2/support/generate_pyi.py +++ b/sources/pyside2/PySide2/support/generate_pyi.py @@ -141,7 +141,7 @@ class Formatter(Writer): self.outfile.seek(here) self.outfile.truncate() # Note: we cannot use class_str when we have no body. - self.print("{spaces}class {class_name}: ...".format(**locals())) + self.print("{spaces}class {class_str}: ...".format(**locals())) if "<" in class_name: # This is happening in QtQuick for some reason: ## class QSharedPointer<QQuickItemGrabResult >: @@ -168,6 +168,13 @@ class Formatter(Writer): self.print('{spaces}@staticmethod'.format(**locals())) self.print('{spaces}def {func_name}{signature}: ...'.format(**locals())) + @contextmanager + def enum(self, class_name, enum_name, value): + spaces = self.spaces + hexval = hex(value) + self.print("{spaces}{enum_name:20}: {class_name} = ... # {hexval}".format(**locals())) + yield + def get_license_text(): with io.open(sourcepath) as f: @@ -247,10 +254,10 @@ def generate_all_pyi(outpath, options): os.environ["PYTHONPATH"] = pypath # now we can import - global PySide2, inspect, HintingEnumerator + global PySide2, inspect, HintingEnumerator, EnumType import PySide2 from PySide2.support.signature import inspect - from PySide2.support.signature.lib.enum_sig import HintingEnumerator + from PySide2.support.signature.lib.enum_sig import HintingEnumerator, EnumType # propagate USE_PEP563 to the mapping module. # Perhaps this can be automated? |