12
12
13
13
try :
14
14
from matplotlib .backends .qt4_compat import QtCore
15
- from matplotlib .backends .backend_qt import MODIFIER_KEYS
16
- HAS_QT = True
15
+ from matplotlib .backends .backend_qt4 import MODIFIER_KEYS , SUPER , ALT , CTRL , SHIFT
16
+
17
+ _ , ControlModifier , ControlKey = MODIFIER_KEYS [CTRL ]
18
+ _ , AltModifier , AltKey = MODIFIER_KEYS [ALT ]
19
+ _ , SuperModifier , SuperKey = MODIFIER_KEYS [SUPER ]
20
+ _ , ShiftModifier , ShiftKey = MODIFIER_KEYS [SHIFT ]
17
21
18
- ShiftModifier = QtCore .Qt .ShiftModifier
19
- ControlModifier , ControlKey = MODIFIER_KEYS ['ctrl' ]
20
- AltModifier , AltKey = MODIFIER_KEYS ['alt' ]
21
- SuperModifier , SuperKey = MODIFIER_KEYS ['super' ]
22
- except ImportError :
22
+ HAS_QT = True
23
+ except ImportError as e :
23
24
HAS_QT = False
24
25
25
26
@@ -72,7 +73,7 @@ def test_shift():
72
73
73
74
@cleanup
74
75
@knownfailureif (not HAS_QT )
75
- def test_noshift ():
76
+ def test_lower ():
76
77
assert_correct_key (QtCore .Qt .Key_A ,
77
78
QtCore .Qt .NoModifier ,
78
79
u'a' ,
@@ -90,7 +91,7 @@ def test_control():
90
91
91
92
@cleanup
92
93
@knownfailureif (not HAS_QT )
93
- def test_unicode ():
94
+ def test_unicode_upper ():
94
95
assert_correct_key (QtCore .Qt .Key_Aacute ,
95
96
ShiftModifier ,
96
97
unichr (193 ),
@@ -99,7 +100,7 @@ def test_unicode():
99
100
100
101
@cleanup
101
102
@knownfailureif (not HAS_QT )
102
- def test_unicode_noshift ():
103
+ def test_unicode_lower ():
103
104
assert_correct_key (QtCore .Qt .Key_Aacute ,
104
105
QtCore .Qt .NoModifier ,
105
106
unichr (193 ),
@@ -109,7 +110,7 @@ def test_unicode_noshift():
109
110
@cleanup
110
111
@knownfailureif (not HAS_QT )
111
112
def test_alt_control ():
112
- assert_correct_key (QtCore . Qt . Key_Control ,
113
+ assert_correct_key (ControlKey ,
113
114
AltModifier ,
114
115
u'' ,
115
116
u'alt+control' )
@@ -118,7 +119,7 @@ def test_alt_control():
118
119
@cleanup
119
120
@knownfailureif (not HAS_QT )
120
121
def test_control_alt ():
121
- assert_correct_key (QtCore . Qt . Key_Alt ,
122
+ assert_correct_key (AltKey ,
122
123
ControlModifier ,
123
124
u'' ,
124
125
u'ctrl+alt' )
@@ -128,6 +129,6 @@ def test_control_alt():
128
129
@knownfailureif (not HAS_QT )
129
130
def test_modifier_order ():
130
131
assert_correct_key (QtCore .Qt .Key_Aacute ,
131
- (ControlModifier & AltModifier & SuperModifier ),
132
+ (ControlModifier | AltModifier | SuperModifier ),
132
133
u'' ,
133
134
u'ctrl+alt+super+' + unichr (225 ))
0 commit comments