@@ -1126,12 +1126,20 @@ def __init__(self, canvas):
1126
1126
1127
1127
NavigationToolbar2 .__init__ (self , canvas )
1128
1128
self ._idle = True
1129
- self .prevZoomRect = None
1129
+ self ._prevZoomRect = None
1130
1130
# for now, use alternate zoom-rectangle drawing on all
1131
1131
# Macs. N.B. In future versions of wx it may be possible to
1132
1132
# detect Retina displays with window.GetContentScaleFactor()
1133
1133
# 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" )
1135
1143
1136
1144
def get_canvas (self , frame , fig ):
1137
1145
return type (self .canvas )(frame , - 1 , fig )
@@ -1201,53 +1209,53 @@ def set_cursor(self, cursor):
1201
1209
def press_zoom (self , event ):
1202
1210
super ().press_zoom (event )
1203
1211
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 ()
1206
1214
else :
1207
1215
if event .inaxes is not None :
1208
- self .savedRetinaImage = self .canvas .copy_from_bbox (
1216
+ self ._savedRetinaImage = self .canvas .copy_from_bbox (
1209
1217
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
1213
1221
1214
1222
def release_zoom (self , event ):
1215
1223
super ().release_zoom (event )
1216
1224
if self .mode .name == 'ZOOM' :
1217
1225
# When the mouse is released we reset the overlay and it
1218
1226
# 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
1222
1230
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
1229
1237
1230
1238
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
1232
1240
# wx.DCOverlay does not work properly on Retina displays.
1233
1241
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
1239
1247
lineX = (X0 , X0 , X1 , X1 , X0 )
1240
1248
lineY = (Y0 , Y1 , Y1 , Y0 , Y0 )
1241
- self .prevZoomRect = self .zoomAxes .plot (
1249
+ self ._prevZoomRect = self ._zoomAxes .plot (
1242
1250
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 )
1245
1253
return
1246
1254
1247
1255
# Use an Overlay to draw a rubberband-like bounding box.
1248
1256
1249
1257
dc = wx .ClientDC (self .canvas )
1250
- odc = wx .DCOverlay (self .wxoverlay , dc )
1258
+ odc = wx .DCOverlay (self ._wxoverlay , dc )
1251
1259
odc .Clear ()
1252
1260
1253
1261
# Mac's DC is already the same as a GCDC, and it causes
@@ -1439,14 +1447,14 @@ def set_cursor(self, cursor):
1439
1447
class RubberbandWx (backend_tools .RubberbandBase ):
1440
1448
def __init__ (self , * args , ** kwargs ):
1441
1449
backend_tools .RubberbandBase .__init__ (self , * args , ** kwargs )
1442
- self .wxoverlay = None
1450
+ self ._wxoverlay = None
1443
1451
1444
1452
def draw_rubberband (self , x0 , y0 , x1 , y1 ):
1445
1453
# 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 ()
1448
1456
dc = wx .ClientDC (self .canvas )
1449
- odc = wx .DCOverlay (self .wxoverlay , dc )
1457
+ odc = wx .DCOverlay (self ._wxoverlay , dc )
1450
1458
odc .Clear ()
1451
1459
1452
1460
dc = wx .GCDC (dc )
@@ -1477,10 +1485,10 @@ def draw_rubberband(self, x0, y0, x1, y1):
1477
1485
dc .DrawRectangle (rect )
1478
1486
1479
1487
def remove_rubberband (self ):
1480
- if self .wxoverlay is None :
1488
+ if self ._wxoverlay is None :
1481
1489
return
1482
- self .wxoverlay .Reset ()
1483
- self .wxoverlay = None
1490
+ self ._wxoverlay .Reset ()
1491
+ self ._wxoverlay = None
1484
1492
1485
1493
else :
1486
1494
# on Mac OS retina displays DCOverlay does not work
0 commit comments