-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathQt5.py
86 lines (69 loc) · 1.75 KB
/
Qt5.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import os
import sys
import types
__version__ = "0.2.0.b2"
QT_VERBOSE = bool(os.getenv("QT_VERBOSE"))
QT_PREFERRED_BINDING = os.environ.get("QT_PREFERRED_BINDING")
QtCompat = types.ModuleType("QtCompat")
def _log(text):
if QT_VERBOSE:
sys.stdout.write(text + "\n")
try:
from PySide2 import (
QtWidgets,
QtCore,
QtGui,
QtQml,
QtQuick,
QtMultimedia,
QtMultimediaWidgets,
QtOpenGL,
)
from shiboken2 import wrapInstance, getCppPointer
QtCompat.wrapInstance = wrapInstance
QtCompat.getCppPointer = getCppPointer
try:
from PySide2 import QtUiTools
QtCompat.loadUi = QtUiTools.QUiLoader
except ImportError:
_log("QtUiTools not provided.")
except ImportError:
try:
from PyQt5 import (
QtWidgets,
QtCore,
QtGui,
QtQml,
QtQuick,
QtMultimedia,
QtMultimediaWidgets,
QtOpenGL,
)
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
QtCore.Property = QtCore.pyqtProperty
from sip import wrapinstance, unwrapinstance
QtCompat.wrapInstance = wrapinstance
QtCompat.getCppPointer = unwrapinstance
try:
from PyQt5 import uic
QtCompat.loadUi = uic.loadUi
except ImportError:
_log("uic not provided.")
except ImportError:
# Used during tests and installers
if QT_PREFERRED_BINDING == "None":
_log("No binding found")
else:
raise
__all__ = [
"QtWidgets",
"QtCore",
"QtGui",
"QtQml",
"QtQuick",
"QtMultimedia",
"QtMultimediaWidgets",
"QtCompat",
"QtOpenGL",
]