@@ -1029,12 +1029,10 @@ def __init__(self, num, fig):
1029
1029
# of the frame - so appearance is closer to GTK version
1030
1030
1031
1031
self .toolmanager = self ._get_toolmanager ()
1032
- if self .toolmanager :
1033
- self .statusbar = StatusbarWx (self , self .toolmanager )
1034
- else :
1035
- self .statusbar = StatusBarWx (self )
1036
- self .SetStatusBar (self .statusbar )
1037
- self .toolbar = self ._get_toolbar (self .statusbar )
1032
+ statusbar = (StatusbarWx (self , self .toolmanager )
1033
+ if self .toolmanager else StatusBarWx (self ))
1034
+ self .SetStatusBar (statusbar )
1035
+ self .toolbar = self ._get_toolbar ()
1038
1036
1039
1037
if self .toolmanager :
1040
1038
backend_tools .add_tools_to_manager (self .toolmanager )
@@ -1060,10 +1058,14 @@ def __init__(self, num, fig):
1060
1058
1061
1059
self .Bind (wx .EVT_CLOSE , self ._onClose )
1062
1060
1063
- def _get_toolbar (self , statbar ):
1061
+ @cbook .deprecated ("3.2" , alternative = "self.GetStatusBar()" )
1062
+ @property
1063
+ def statusbar (self ):
1064
+ return self .GetStatusBar ()
1065
+
1066
+ def _get_toolbar (self ):
1064
1067
if rcParams ['toolbar' ] == 'toolbar2' :
1065
1068
toolbar = NavigationToolbar2Wx (self .canvas )
1066
- toolbar .set_status_bar (statbar )
1067
1069
elif matplotlib .rcParams ['toolbar' ] == 'toolmanager' :
1068
1070
toolbar = ToolbarWx (self .toolmanager , self )
1069
1071
else :
@@ -1305,7 +1307,6 @@ def __init__(self, canvas):
1305
1307
NavigationToolbar2 .__init__ (self , canvas )
1306
1308
self .canvas = canvas
1307
1309
self ._idle = True
1308
- self .statbar = None
1309
1310
self .prevZoomRect = None
1310
1311
# for now, use alternate zoom-rectangle drawing on all
1311
1312
# Macs. N.B. In future versions of wx it may be possible to
@@ -1485,12 +1486,20 @@ def draw_rubberband(self, event, x0, y0, x1, y1):
1485
1486
dc .SetBrush (wx .Brush (color ))
1486
1487
dc .DrawRectangle (rect )
1487
1488
1489
+ @cbook .deprecated ("3.2" )
1488
1490
def set_status_bar (self , statbar ):
1489
- self .statbar = statbar
1491
+ self .GetTopLevelParent ().SetStatusBar (statbar )
1492
+
1493
+ @cbook .deprecated ("3.2" ,
1494
+ alternative = "self.GetTopLevelParent().GetStatusBar()" )
1495
+ @property
1496
+ def statbar (self ):
1497
+ return self .GetTopLevelParent ().GetStatusBar ()
1490
1498
1491
1499
def set_message (self , s ):
1492
- if self .statbar is not None :
1493
- self .statbar .set_function (s )
1500
+ status_bar = self .GetTopLevelParent ().GetStatusBar ()
1501
+ if status_bar is not None :
1502
+ status_bar .set_function (s )
1494
1503
1495
1504
def set_history_buttons (self ):
1496
1505
can_backward = self ._nav_stack ._pos > 0
0 commit comments