@@ -1126,12 +1126,20 @@ def __init__(self, canvas):
11261126
11271127 NavigationToolbar2 .__init__ (self , canvas )
11281128 self ._idle = True
1129- self .prevZoomRect = None
1129+ self ._prevZoomRect = None
11301130 # for now, use alternate zoom-rectangle drawing on all
11311131 # Macs. N.B. In future versions of wx it may be possible to
11321132 # detect Retina displays with window.GetContentScaleFactor()
11331133 # and/or dc.GetContentScaleFactor()
1134- self .retinaFix = 'wxMac' in wx .PlatformInfo
1134+ self ._retinaFix = 'wxMac' in wx .PlatformInfo
1135+
1136+ prevZoomRect = cbook ._deprecate_privatize_attribute ("3.3" )
1137+ retinaFix = cbook ._deprecate_privatize_attribute ("3.3" )
1138+ savedRetinaImage = cbook ._deprecate_privatize_attribute ("3.3" )
1139+ wxoverlay = cbook ._deprecate_privatize_attribute ("3.3" )
1140+ zoomAxes = cbook ._deprecate_privatize_attribute ("3.3" )
1141+ zoomStartX = cbook ._deprecate_privatize_attribute ("3.3" )
1142+ zoomStartY = cbook ._deprecate_privatize_attribute ("3.3" )
11351143
11361144 def get_canvas (self , frame , fig ):
11371145 return type (self .canvas )(frame , - 1 , fig )
@@ -1201,53 +1209,53 @@ def set_cursor(self, cursor):
12011209 def press_zoom (self , event ):
12021210 super ().press_zoom (event )
12031211 if self .mode .name == 'ZOOM' :
1204- if not self .retinaFix :
1205- self .wxoverlay = wx .Overlay ()
1212+ if not self ._retinaFix :
1213+ self ._wxoverlay = wx .Overlay ()
12061214 else :
12071215 if event .inaxes is not None :
1208- self .savedRetinaImage = self .canvas .copy_from_bbox (
1216+ self ._savedRetinaImage = self .canvas .copy_from_bbox (
12091217 event .inaxes .bbox )
1210- self .zoomStartX = event .xdata
1211- self .zoomStartY = event .ydata
1212- self .zoomAxes = event .inaxes
1218+ self ._zoomStartX = event .xdata
1219+ self ._zoomStartY = event .ydata
1220+ self ._zoomAxes = event .inaxes
12131221
12141222 def release_zoom (self , event ):
12151223 super ().release_zoom (event )
12161224 if self .mode .name == 'ZOOM' :
12171225 # When the mouse is released we reset the overlay and it
12181226 # restores the former content to the window.
1219- if not self .retinaFix :
1220- self .wxoverlay .Reset ()
1221- del self .wxoverlay
1227+ if not self ._retinaFix :
1228+ self ._wxoverlay .Reset ()
1229+ del self ._wxoverlay
12221230 else :
1223- del self .savedRetinaImage
1224- if self .prevZoomRect :
1225- self .prevZoomRect .pop (0 ).remove ()
1226- self .prevZoomRect = None
1227- if self .zoomAxes :
1228- self .zoomAxes = None
1231+ del self ._savedRetinaImage
1232+ if self ._prevZoomRect :
1233+ self ._prevZoomRect .pop (0 ).remove ()
1234+ self ._prevZoomRect = None
1235+ if self ._zoomAxes :
1236+ self ._zoomAxes = None
12291237
12301238 def draw_rubberband (self , event , x0 , y0 , x1 , y1 ):
1231- if self .retinaFix : # On Macs, use the following code
1239+ if self ._retinaFix : # On Macs, use the following code
12321240 # wx.DCOverlay does not work properly on Retina displays.
12331241 rubberBandColor = '#C0C0FF'
1234- if self .prevZoomRect :
1235- self .prevZoomRect .pop (0 ).remove ()
1236- self .canvas .restore_region (self .savedRetinaImage )
1237- X0 , X1 = self .zoomStartX , event .xdata
1238- Y0 , Y1 = self .zoomStartY , event .ydata
1242+ if self ._prevZoomRect :
1243+ self ._prevZoomRect .pop (0 ).remove ()
1244+ self .canvas .restore_region (self ._savedRetinaImage )
1245+ X0 , X1 = self ._zoomStartX , event .xdata
1246+ Y0 , Y1 = self ._zoomStartY , event .ydata
12391247 lineX = (X0 , X0 , X1 , X1 , X0 )
12401248 lineY = (Y0 , Y1 , Y1 , Y0 , Y0 )
1241- self .prevZoomRect = self .zoomAxes .plot (
1249+ self ._prevZoomRect = self ._zoomAxes .plot (
12421250 lineX , lineY , '-' , color = rubberBandColor )
1243- self .zoomAxes .draw_artist (self .prevZoomRect [0 ])
1244- self .canvas .blit (self .zoomAxes .bbox )
1251+ self ._zoomAxes .draw_artist (self ._prevZoomRect [0 ])
1252+ self .canvas .blit (self ._zoomAxes .bbox )
12451253 return
12461254
12471255 # Use an Overlay to draw a rubberband-like bounding box.
12481256
12491257 dc = wx .ClientDC (self .canvas )
1250- odc = wx .DCOverlay (self .wxoverlay , dc )
1258+ odc = wx .DCOverlay (self ._wxoverlay , dc )
12511259 odc .Clear ()
12521260
12531261 # Mac's DC is already the same as a GCDC, and it causes
@@ -1439,14 +1447,14 @@ def set_cursor(self, cursor):
14391447 class RubberbandWx (backend_tools .RubberbandBase ):
14401448 def __init__ (self , * args , ** kwargs ):
14411449 backend_tools .RubberbandBase .__init__ (self , * args , ** kwargs )
1442- self .wxoverlay = None
1450+ self ._wxoverlay = None
14431451
14441452 def draw_rubberband (self , x0 , y0 , x1 , y1 ):
14451453 # Use an Overlay to draw a rubberband-like bounding box.
1446- if self .wxoverlay is None :
1447- self .wxoverlay = wx .Overlay ()
1454+ if self ._wxoverlay is None :
1455+ self ._wxoverlay = wx .Overlay ()
14481456 dc = wx .ClientDC (self .canvas )
1449- odc = wx .DCOverlay (self .wxoverlay , dc )
1457+ odc = wx .DCOverlay (self ._wxoverlay , dc )
14501458 odc .Clear ()
14511459
14521460 dc = wx .GCDC (dc )
@@ -1477,10 +1485,10 @@ def draw_rubberband(self, x0, y0, x1, y1):
14771485 dc .DrawRectangle (rect )
14781486
14791487 def remove_rubberband (self ):
1480- if self .wxoverlay is None :
1488+ if self ._wxoverlay is None :
14811489 return
1482- self .wxoverlay .Reset ()
1483- self .wxoverlay = None
1490+ self ._wxoverlay .Reset ()
1491+ self ._wxoverlay = None
14841492
14851493else :
14861494 # on Mac OS retina displays DCOverlay does not work
0 commit comments