Show More
@@ -31,6 +31,8 b' else:' | |||||
31 | import os |
|
31 | import os | |
32 | import sys |
|
32 | import sys | |
33 |
|
33 | |||
|
34 | from IPython.utils.warn import warn | |||
|
35 | ||||
34 | matplotlib = sys.modules.get('matplotlib') |
|
36 | matplotlib = sys.modules.get('matplotlib') | |
35 | if matplotlib and matplotlib.__version__ <= '1.0.1': |
|
37 | if matplotlib and matplotlib.__version__ <= '1.0.1': | |
36 | # 1.0.1 doesn't support pyside or v2, so stick with PyQt @v1, |
|
38 | # 1.0.1 doesn't support pyside or v2, so stick with PyQt @v1, | |
@@ -70,13 +72,16 b' else:' | |||||
70 | from IPython.external.qt import QtCore, QtGui |
|
72 | from IPython.external.qt import QtCore, QtGui | |
71 | except ValueError as e: |
|
73 | except ValueError as e: | |
72 | if 'API' in str(e): |
|
74 | if 'API' in str(e): | |
73 | # API mismatch, give more meaningful message |
|
75 | # PyQt4 already imported, and APIv2 couldn't be set | |
74 | raise ImportError(""" |
|
76 | # Give more meaningful message, and warn instead of raising | |
|
77 | warn(""" | |||
75 | Assigning the ETS variable `QT_API=pyqt` implies PyQt's v2 API for |
|
78 | Assigning the ETS variable `QT_API=pyqt` implies PyQt's v2 API for | |
76 | QString and QVariant, but PyQt has already been imported |
|
79 | QString and QVariant, but PyQt has already been imported | |
77 |
with v1 APIs. You |
|
80 | with v1 APIs. You should unset QT_API to work with PyQt4 | |
78 | in its default mode. |
|
81 | in its default mode. | |
79 | """) |
|
82 | """) | |
|
83 | # allow it to still work | |||
|
84 | from PyQt4 import QtCore, QtGui | |||
80 | else: |
|
85 | else: | |
81 | raise |
|
86 | raise | |
82 |
|
87 |
General Comments 0
You need to be logged in to leave comments.
Login now