@@ -153,25 +153,25 @@ class FigureCanvasQT( QtGui.QWidget, FigureCanvasBase ):
153153 _modifier_keys = [
154154 (QtCore .Qt .MetaModifier , 'super' , QtCore .Qt .Key_Meta ),
155155 (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 )
157157 ]
158-
158+
159159 _ctrl_modifier = QtCore .Qt .ControlModifier
160-
160+
161161 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
163163 # switch them back.
164164 keyvald .update ({
165165 QtCore .Qt .Key_Control : 'super' , # cmd/apple key
166166 QtCore .Qt .Key_Meta : 'control' ,
167167 })
168-
168+
169169 _modifier_keys = [
170170 (QtCore .Qt .ControlModifier , 'super' , QtCore .Qt .Key_Control ),
171171 (QtCore .Qt .AltModifier , 'alt' , QtCore .Qt .Key_Alt ),
172172 (QtCore .Qt .MetaModifier , 'ctrl' , QtCore .Qt .Key_Meta ),
173173 ]
174-
174+
175175 _ctrl_modifier = QtCore .Qt .MetaModifier
176176
177177 # map Qt button codes to MouseEvent's ones:
@@ -242,7 +242,7 @@ def mouseMoveEvent( self, event ):
242242 # flipy so y=0 is bottom of canvas
243243 y = self .figure .bbox .height - event .y ()
244244 FigureCanvasBase .motion_notify_event ( self , x , y )
245- #if DEBUG: print 'mouse move'
245+ #if DEBUG: print( 'mouse move')
246246
247247 def mouseReleaseEvent ( self , event ):
248248 x = event .x ()
@@ -304,16 +304,16 @@ def _get_key( self, event ):
304304 if event .key () < 256 :
305305 key = unicode (event .text ())
306306 # 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
309309 # since event.key() is not case sensitive, whereas event.text() is,
310310 # 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
312312 # ctrl+shift+p is pressed.
313313 if int (event .modifiers ()) & self ._ctrl_modifier :
314314 # we always get an uppercase character
315315 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,
317317 # this does not take into account the CapsLock state)
318318 if not int (event .modifiers ()) & QtCore .Qt .ShiftModifier :
319319 key = key .lower ()
@@ -322,9 +322,9 @@ def _get_key( self, event ):
322322 key = self .keyvald .get (event .key ())
323323
324324 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)
326326 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 :
328328 key = u'{}+{}' .format (prefix , key )
329329
330330 return key
@@ -437,7 +437,7 @@ def _show_message(self,s):
437437
438438 def full_screen_toggle (self ):
439439 if self .window .isFullScreen ():
440- self .window .showNormal ()
440+ self .window .showNormal ()
441441 else :
442442 self .window .showFullScreen ()
443443
@@ -505,20 +505,16 @@ def _init_toolbar(self):
505505 if text is None :
506506 self .addSeparator ()
507507 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 ))
509510 if tooltip_text is not None :
510511 a .setToolTip (tooltip_text )
511-
512+
512513 if figureoptions is not None :
513514 a = self .addAction (self ._icon ("qt4_editor_options.png" ),
514515 'Customize' , self .edit_parameters )
515516 a .setToolTip ('Edit curves line and axes parameters' )
516517
517- a = self .addAction (self ._icon ('filesave.png' ), 'Save' ,
518- self .save_figure )
519- a .setToolTip ('Save the figure' )
520-
521-
522518 self .buttons = {}
523519
524520 # Add the x,y location widget at the right side of the toolbar
@@ -628,7 +624,6 @@ def save_figure(self, *args):
628624 selectedFilter = filter
629625 filters .append (filter )
630626 filters = ';;' .join (filters )
631-
632627 fname = _getSaveFileName (self , "Choose a filename to save to" ,
633628 start , filters , selectedFilter )
634629 if fname :
0 commit comments