Toolbox/PyQt4ImportHook.py

branch
6_0_x
changeset 3989
2d9778d49159
parent 3937
607dd5b0079b
child 4021
195a471c327b
equal deleted inserted replaced
3988:947bd642b0de 3989:2d9778d49159
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 2
3 # Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de> 3 # Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de>
4 # 4 #
5
6 """
7 Module implementing an import hook converting PyQt5 imports to PyQt4 imports.
8 """
5 9
6 import sys 10 import sys
7 try: 11 try:
8 if "--pyqt4" in sys.argv: 12 if "--pyqt4" in sys.argv:
9 sys.argv.remove("--pyqt4") 13 sys.argv.remove("--pyqt4")
12 import PyQt5 # __IGNORE_WARNING__ 16 import PyQt5 # __IGNORE_WARNING__
13 except ImportError: 17 except ImportError:
14 import importlib 18 import importlib
15 19
16 class PyQt4Importer(object): 20 class PyQt4Importer(object):
21 """
22 Class implementing an importer converting PyQt5 imports to PyQt4
23 imports.
24 """
17 def __init__(self): 25 def __init__(self):
18 """ 26 """
19 Constructor 27 Constructor
20 """ 28 """
21 self.__path = None 29 self.__path = None

eric ide

mercurial