@@ -153,25 +153,25 @@ class FigureCanvasQT( QtGui.QWidget, FigureCanvasBase ):
153
153
_modifier_keys = [
154
154
(QtCore .Qt .MetaModifier , 'super' , QtCore .Qt .Key_Meta ),
155
155
(QtCore .Qt .AltModifier , 'alt' , QtCore .Qt .Key_Alt ),
156
- (QtCore .Qt .ControlModifier , 'ctrl' , QtCore .Qt .Key_Control )
156
+ (QtCore .Qt .ControlModifier , 'ctrl' , QtCore .Qt .Key_Control )
157
157
]
158
-
158
+
159
159
_ctrl_modifier = QtCore .Qt .ControlModifier
160
-
160
+
161
161
if sys .platform == 'darwin' :
162
- # in OSX, the control and super (aka cmd/apple) keys are switched, so
162
+ # in OSX, the control and super (aka cmd/apple) keys are switched, so
163
163
# switch them back.
164
164
keyvald .update ({
165
165
QtCore .Qt .Key_Control : 'super' , # cmd/apple key
166
166
QtCore .Qt .Key_Meta : 'control' ,
167
167
})
168
-
168
+
169
169
_modifier_keys = [
170
170
(QtCore .Qt .ControlModifier , 'super' , QtCore .Qt .Key_Control ),
171
171
(QtCore .Qt .AltModifier , 'alt' , QtCore .Qt .Key_Alt ),
172
172
(QtCore .Qt .MetaModifier , 'ctrl' , QtCore .Qt .Key_Meta ),
173
173
]
174
-
174
+
175
175
_ctrl_modifier = QtCore .Qt .MetaModifier
176
176
177
177
# map Qt button codes to MouseEvent's ones:
@@ -242,7 +242,7 @@ def mouseMoveEvent( self, event ):
242
242
# flipy so y=0 is bottom of canvas
243
243
y = self .figure .bbox .height - event .y ()
244
244
FigureCanvasBase .motion_notify_event ( self , x , y )
245
- #if DEBUG: print 'mouse move'
245
+ #if DEBUG: print( 'mouse move')
246
246
247
247
def mouseReleaseEvent ( self , event ):
248
248
x = event .x ()
@@ -304,16 +304,16 @@ def _get_key( self, event ):
304
304
if event .key () < 256 :
305
305
key = unicode (event .text ())
306
306
# if the control key is being pressed, we don't get the correct
307
- # characters, so interpret them directly from the event.key().
308
- # Unfortunately, this means that we cannot handle key's case
307
+ # characters, so interpret them directly from the event.key().
308
+ # Unfortunately, this means that we cannot handle key's case
309
309
# since event.key() is not case sensitive, whereas event.text() is,
310
310
# Finally, since it is not possible to get the CapsLock state
311
- # we cannot accurately compute the case of a pressed key when
311
+ # we cannot accurately compute the case of a pressed key when
312
312
# ctrl+shift+p is pressed.
313
313
if int (event .modifiers ()) & self ._ctrl_modifier :
314
314
# we always get an uppercase character
315
315
key = chr (event .key ())
316
- # if shift is not being pressed, lowercase it (as mentioned,
316
+ # if shift is not being pressed, lowercase it (as mentioned,
317
317
# this does not take into account the CapsLock state)
318
318
if not int (event .modifiers ()) & QtCore .Qt .ShiftModifier :
319
319
key = key .lower ()
@@ -322,9 +322,9 @@ def _get_key( self, event ):
322
322
key = self .keyvald .get (event .key ())
323
323
324
324
if key is not None :
325
- # prepend the ctrl, alt, super keys if appropriate (sorted in that order)
325
+ # prepend the ctrl, alt, super keys if appropriate (sorted in that order)
326
326
for modifier , prefix , Qt_key in self ._modifier_keys :
327
- if event .key () != Qt_key and int (event .modifiers ()) & modifier == modifier :
327
+ if event .key () != Qt_key and int (event .modifiers ()) & modifier == modifier :
328
328
key = u'{}+{}' .format (prefix , key )
329
329
330
330
return key
@@ -437,7 +437,7 @@ def _show_message(self,s):
437
437
438
438
def full_screen_toggle (self ):
439
439
if self .window .isFullScreen ():
440
- self .window .showNormal ()
440
+ self .window .showNormal ()
441
441
else :
442
442
self .window .showFullScreen ()
443
443
@@ -505,20 +505,16 @@ def _init_toolbar(self):
505
505
if text is None :
506
506
self .addSeparator ()
507
507
else :
508
- a = self .addAction (self ._icon (image_file + '.png' ), text , getattr (self , callback ))
508
+ a = self .addAction (self ._icon (image_file + '.png' ),
509
+ text , getattr (self , callback ))
509
510
if tooltip_text is not None :
510
511
a .setToolTip (tooltip_text )
511
-
512
+
512
513
if figureoptions is not None :
513
514
a = self .addAction (self ._icon ("qt4_editor_options.png" ),
514
515
'Customize' , self .edit_parameters )
515
516
a .setToolTip ('Edit curves line and axes parameters' )
516
517
517
- a = self .addAction (self ._icon ('filesave.png' ), 'Save' ,
518
- self .save_figure )
519
- a .setToolTip ('Save the figure' )
520
-
521
-
522
518
self .buttons = {}
523
519
524
520
# Add the x,y location widget at the right side of the toolbar
@@ -628,7 +624,6 @@ def save_figure(self, *args):
628
624
selectedFilter = filter
629
625
filters .append (filter )
630
626
filters = ';;' .join (filters )
631
-
632
627
fname = _getSaveFileName (self , "Choose a filename to save to" ,
633
628
start , filters , selectedFilter )
634
629
if fname :
0 commit comments