@@ -502,32 +502,32 @@ def __init__(self, parent, id, figure=None):
502
502
self ._isDrawn = False
503
503
self ._rubberband_rect = None
504
504
505
- self .Bind (wx .EVT_SIZE , self ._onSize )
506
- self .Bind (wx .EVT_PAINT , self ._onPaint )
507
- self .Bind (wx .EVT_CHAR_HOOK , self ._onKeyDown )
508
- self .Bind (wx .EVT_KEY_UP , self ._onKeyUp )
509
- self .Bind (wx .EVT_LEFT_DOWN , self ._onMouseButton )
510
- self .Bind (wx .EVT_LEFT_DCLICK , self ._onMouseButton )
511
- self .Bind (wx .EVT_LEFT_UP , self ._onMouseButton )
512
- self .Bind (wx .EVT_MIDDLE_DOWN , self ._onMouseButton )
513
- self .Bind (wx .EVT_MIDDLE_DCLICK , self ._onMouseButton )
514
- self .Bind (wx .EVT_MIDDLE_UP , self ._onMouseButton )
515
- self .Bind (wx .EVT_RIGHT_DOWN , self ._onMouseButton )
516
- self .Bind (wx .EVT_RIGHT_DCLICK , self ._onMouseButton )
517
- self .Bind (wx .EVT_RIGHT_UP , self ._onMouseButton )
518
- self .Bind (wx .EVT_MOUSE_AUX1_DOWN , self ._onMouseButton )
519
- self .Bind (wx .EVT_MOUSE_AUX1_UP , self ._onMouseButton )
520
- self .Bind (wx .EVT_MOUSE_AUX2_DOWN , self ._onMouseButton )
521
- self .Bind (wx .EVT_MOUSE_AUX2_UP , self ._onMouseButton )
522
- self .Bind (wx .EVT_MOUSE_AUX1_DCLICK , self ._onMouseButton )
523
- self .Bind (wx .EVT_MOUSE_AUX2_DCLICK , self ._onMouseButton )
524
- self .Bind (wx .EVT_MOUSEWHEEL , self ._onMouseWheel )
525
- self .Bind (wx .EVT_MOTION , self ._onMotion )
526
- self .Bind (wx .EVT_LEAVE_WINDOW , self ._onLeave )
527
- self .Bind (wx .EVT_ENTER_WINDOW , self ._onEnter )
528
-
529
- self .Bind (wx .EVT_MOUSE_CAPTURE_CHANGED , self ._onCaptureLost )
530
- self .Bind (wx .EVT_MOUSE_CAPTURE_LOST , self ._onCaptureLost )
505
+ self .Bind (wx .EVT_SIZE , self ._on_size )
506
+ self .Bind (wx .EVT_PAINT , self ._on_paint )
507
+ self .Bind (wx .EVT_CHAR_HOOK , self ._on_key_down )
508
+ self .Bind (wx .EVT_KEY_UP , self ._on_key_up )
509
+ self .Bind (wx .EVT_LEFT_DOWN , self ._on_mouse_button )
510
+ self .Bind (wx .EVT_LEFT_DCLICK , self ._on_mouse_button )
511
+ self .Bind (wx .EVT_LEFT_UP , self ._on_mouse_button )
512
+ self .Bind (wx .EVT_MIDDLE_DOWN , self ._on_mouse_button )
513
+ self .Bind (wx .EVT_MIDDLE_DCLICK , self ._on_mouse_button )
514
+ self .Bind (wx .EVT_MIDDLE_UP , self ._on_mouse_button )
515
+ self .Bind (wx .EVT_RIGHT_DOWN , self ._on_mouse_button )
516
+ self .Bind (wx .EVT_RIGHT_DCLICK , self ._on_mouse_button )
517
+ self .Bind (wx .EVT_RIGHT_UP , self ._on_mouse_button )
518
+ self .Bind (wx .EVT_MOUSE_AUX1_DOWN , self ._on_mouse_button )
519
+ self .Bind (wx .EVT_MOUSE_AUX1_UP , self ._on_mouse_button )
520
+ self .Bind (wx .EVT_MOUSE_AUX2_DOWN , self ._on_mouse_button )
521
+ self .Bind (wx .EVT_MOUSE_AUX2_UP , self ._on_mouse_button )
522
+ self .Bind (wx .EVT_MOUSE_AUX1_DCLICK , self ._on_mouse_button )
523
+ self .Bind (wx .EVT_MOUSE_AUX2_DCLICK , self ._on_mouse_button )
524
+ self .Bind (wx .EVT_MOUSEWHEEL , self ._on_mouse_wheel )
525
+ self .Bind (wx .EVT_MOTION , self ._on_motion )
526
+ self .Bind (wx .EVT_LEAVE_WINDOW , self ._on_leave )
527
+ self .Bind (wx .EVT_ENTER_WINDOW , self ._on_enter )
528
+
529
+ self .Bind (wx .EVT_MOUSE_CAPTURE_CHANGED , self ._on_capture_lost )
530
+ self .Bind (wx .EVT_MOUSE_CAPTURE_LOST , self ._on_capture_lost )
531
531
532
532
self .SetBackgroundStyle (wx .BG_STYLE_PAINT ) # Reduce flicker.
533
533
self .SetBackgroundColour (wx .WHITE )
@@ -645,25 +645,25 @@ def print_figure(self, filename, *args, **kwargs):
645
645
if self ._isDrawn :
646
646
self .draw ()
647
647
648
- def _onPaint (self , event ):
648
+ def _on_paint (self , event ):
649
649
"""Called when wxPaintEvt is generated."""
650
- _log .debug ("%s - _onPaint ()" , type (self ))
650
+ _log .debug ("%s - _on_paint ()" , type (self ))
651
651
drawDC = wx .PaintDC (self )
652
652
if not self ._isDrawn :
653
653
self .draw (drawDC = drawDC )
654
654
else :
655
655
self .gui_repaint (drawDC = drawDC )
656
656
drawDC .Destroy ()
657
657
658
- def _onSize (self , event ):
658
+ def _on_size (self , event ):
659
659
"""
660
660
Called when wxEventSize is generated.
661
661
662
662
In this application we attempt to resize to fit the window, so it
663
663
is better to take the performance hit and redraw the whole window.
664
664
"""
665
665
666
- _log .debug ("%s - _onSize ()" , type (self ))
666
+ _log .debug ("%s - _on_size ()" , type (self ))
667
667
sz = self .GetParent ().GetSizer ()
668
668
if sz :
669
669
si = sz .GetItem (self )
@@ -724,14 +724,14 @@ def _get_key(self, event):
724
724
725
725
return key
726
726
727
- def _onKeyDown (self , event ):
727
+ def _on_key_down (self , event ):
728
728
"""Capture key press."""
729
729
key = self ._get_key (event )
730
730
FigureCanvasBase .key_press_event (self , key , guiEvent = event )
731
731
if self :
732
732
event .Skip ()
733
733
734
- def _onKeyUp (self , event ):
734
+ def _on_key_up (self , event ):
735
735
"""Release key."""
736
736
key = self ._get_key (event )
737
737
FigureCanvasBase .key_release_event (self , key , guiEvent = event )
@@ -759,11 +759,11 @@ def _set_capture(self, capture=True):
759
759
if capture :
760
760
self .CaptureMouse ()
761
761
762
- def _onCaptureLost (self , event ):
762
+ def _on_capture_lost (self , event ):
763
763
"""Capture changed or lost"""
764
764
self ._set_capture (False )
765
765
766
- def _onMouseButton (self , event ):
766
+ def _on_mouse_button (self , event ):
767
767
"""Start measuring on an axis."""
768
768
event .Skip ()
769
769
self ._set_capture (event .ButtonDown () or event .ButtonDClick ())
@@ -786,7 +786,7 @@ def _onMouseButton(self, event):
786
786
elif event .ButtonUp ():
787
787
self .button_release_event (x , y , button , guiEvent = event )
788
788
789
- def _onMouseWheel (self , event ):
789
+ def _on_mouse_wheel (self , event ):
790
790
"""Translate mouse wheel events into matplotlib events"""
791
791
# Determine mouse location
792
792
x = event .GetX ()
@@ -806,19 +806,19 @@ def _onMouseWheel(self, event):
806
806
self ._skipwheelevent = True
807
807
FigureCanvasBase .scroll_event (self , x , y , step , guiEvent = event )
808
808
809
- def _onMotion (self , event ):
809
+ def _on_motion (self , event ):
810
810
"""Start measuring on an axis."""
811
811
x = event .GetX ()
812
812
y = self .figure .bbox .height - event .GetY ()
813
813
event .Skip ()
814
814
FigureCanvasBase .motion_notify_event (self , x , y , guiEvent = event )
815
815
816
- def _onLeave (self , event ):
816
+ def _on_leave (self , event ):
817
817
"""Mouse has left the window."""
818
818
event .Skip ()
819
819
FigureCanvasBase .leave_notify_event (self , guiEvent = event )
820
820
821
- def _onEnter (self , event ):
821
+ def _on_enter (self , event ):
822
822
"""Mouse has entered the window."""
823
823
x = event .GetX ()
824
824
y = self .figure .bbox .height - event .GetY ()
@@ -937,7 +937,7 @@ def __init__(self, num, fig):
937
937
938
938
self .canvas .SetMinSize ((2 , 2 ))
939
939
940
- self .Bind (wx .EVT_CLOSE , self ._onClose )
940
+ self .Bind (wx .EVT_CLOSE , self ._on_close )
941
941
942
942
@property
943
943
def toolmanager (self ):
@@ -959,8 +959,8 @@ def get_figure_manager(self):
959
959
_log .debug ("%s - get_figure_manager()" , type (self ))
960
960
return self .figmgr
961
961
962
- def _onClose (self , event ):
963
- _log .debug ("%s - onClose ()" , type (self ))
962
+ def _on_close (self , event ):
963
+ _log .debug ("%s - on_close ()" , type (self ))
964
964
self .canvas .close_event ()
965
965
self .canvas .stop_event_loop ()
966
966
# set FigureManagerWx.frame to None to prevent repeated attempts to
@@ -1345,15 +1345,15 @@ def __init__(self, parent, help_entries):
1345
1345
grid_sizer .Add (label , 0 , 0 , 0 )
1346
1346
# finalize layout, create button
1347
1347
sizer .Add (grid_sizer , 0 , wx .ALL , 6 )
1348
- OK = wx .Button (self , wx .ID_OK )
1349
- sizer .Add (OK , 0 , wx .ALIGN_CENTER_HORIZONTAL | wx .ALL , 8 )
1348
+ ok = wx .Button (self , wx .ID_OK )
1349
+ sizer .Add (ok , 0 , wx .ALIGN_CENTER_HORIZONTAL | wx .ALL , 8 )
1350
1350
self .SetSizer (sizer )
1351
1351
sizer .Fit (self )
1352
1352
self .Layout ()
1353
- self .Bind (wx .EVT_CLOSE , self .OnClose )
1354
- OK .Bind (wx .EVT_BUTTON , self .OnClose )
1353
+ self .Bind (wx .EVT_CLOSE , self ._on_close )
1354
+ ok .Bind (wx .EVT_BUTTON , self ._on_close )
1355
1355
1356
- def OnClose (self , event ):
1356
+ def _on_close (self , event ):
1357
1357
_HelpDialog ._instance = None # remove global reference
1358
1358
self .DestroyLater ()
1359
1359
event .Skip ()
0 commit comments