File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 2
2
"""
3
3
4
4
import os
5
- import warnings
6
- from matplotlib import rcParams
5
+ from matplotlib import rcParams , verbose
7
6
8
7
# Available APIs.
9
8
QT_API_PYQT = 'PyQt4' # API is not set here; Python 2.x default is V 1
36
35
if QT_API in (QT_API_PYQT , QT_API_PYQTv2 ):
37
36
import sip
38
37
if QT_API == QT_API_PYQTv2 :
39
- sip .setapi ('QString' , 2 )
40
- sip .setapi ('QVariant' , 2 )
38
+ if QT_API_ENV == 'pyqt' :
39
+ cond = ("Found 'QT_API=pyqt' environment variable. "
40
+ "Setting PyQt4 API accordingly.\n " )
41
+ else :
42
+ cond = "PyQt API v2 specified."
43
+ try :
44
+ sip .setapi ('QString' , 2 )
45
+ except :
46
+ res = 'QString API v2 specification failed. Defaulting to v1.'
47
+ verbose .report (cond + res , 'helpful' )
48
+ # condition has now been reported, no need to repeat it:
49
+ cond = ""
50
+ try :
51
+ sip .setapi ('QVariant' , 2 )
52
+ except :
53
+ res = 'QVariant API v2 specification failed. Defaulting to v1.'
54
+ verbose .report (cond + res , 'helpful' )
41
55
42
56
from PyQt4 import QtCore , QtGui
43
57
You can’t perform that action at this time.
0 commit comments