MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / import_pyqt4

Function import_pyqt4

pydev_ipython/qt_loaders.py:204–237  ·  view source on GitHub ↗

Import PyQt4 Parameters ---------- version : 1, 2, or None Which QString/QVariant API to use. Set to None to use the system default ImportErrors raised within this function are non-recoverable

(version=2)

Source from the content-addressed store, hash-verified

202
203
204def import_pyqt4(version=2):
205 """
206 Import PyQt4
207
208 Parameters
209 ----------
210 version : 1, 2, or None
211 Which QString/QVariant API to use. Set to None to use the system
212 default
213
214 ImportErrors raised within this function are non-recoverable
215 """
216 # The new-style string API (version=2) automatically
217 # converts QStrings to Unicode Python strings. Also, automatically unpacks
218 # QVariants to their underlying objects.
219 import sip
220
221 if version is not None:
222 sip.setapi("QString", version)
223 sip.setapi("QVariant", version)
224
225 from PyQt4 import QtGui, QtCore, QtSvg
226
227 if not check_version(QtCore.PYQT_VERSION_STR, "4.7"):
228 raise ImportError("IPython requires PyQt4 >= 4.7, found %s" % QtCore.PYQT_VERSION_STR)
229
230 # Alias PyQt-specific functions for PySide compatibility.
231 QtCore.Signal = QtCore.pyqtSignal
232 QtCore.Slot = QtCore.pyqtSlot
233
234 # query for the API version (in case version == None)
235 version = sip.getapi("QString")
236 api = QT_API_PYQTv1 if version == 1 else QT_API_PYQT
237 return QtCore, QtGui, QtSvg, api
238
239
240def import_pyqt5():

Callers

nothing calls this directly

Calls 1

check_versionFunction · 0.90

Tested by

no test coverage detected