eric6/Utilities/PySideImporter.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7923
91e843545d9a
child 8043
0acf98cd089a
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

# -*- coding: utf-8 -*-

# Copyright (c) 2011 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module to check for the presence of PySide2/PySide6 by importing it.
"""

import sys

if __name__ == "__main__":
    pySideVariant = "2"
    if len(sys.argv) == 2:
        pySideVariant = sys.argv[1].replace("--variant=", "")
    
    if pySideVariant == "1":
        # no PySide support anymore
        ret = 1
    
    elif pySideVariant == "2":
        try:
            import PySide2       # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
            ret = 0
        except ImportError:
            ret = 1
    
    elif pySideVariant == "6":
        try:
            import PySide6       # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
            ret = 0
        except ImportError:
            ret = 1
    
    else:
        ret = 1
    
    sys.exit(ret)

eric ide

mercurial