@@ -861,7 +861,7 @@ def Printer_Setup(self, event=None):
861
861
simply asks for image width and margin for printing. """
862
862
863
863
dmsg = """Width of output figure in inches.
864
- The current aspect ration will be kept."""
864
+ The current aspect ratio will be kept."""
865
865
866
866
dlg = wx .Dialog (self , - 1 , 'Page Setup for Printing' , (- 1 ,- 1 ))
867
867
df = dlg .GetFont ()
@@ -1546,8 +1546,11 @@ def GetToolBar(self):
1546
1546
return self .toolbar
1547
1547
1548
1548
def Destroy (self , * args , ** kwargs ):
1549
- self .canvas .mpl_disconnect (self .toolbar ._idDrag )
1550
- # Rationale for line above: see issue 2941338.
1549
+ try :
1550
+ self .canvas .mpl_disconnect (self .toolbar ._idDrag )
1551
+ # Rationale for line above: see issue 2941338.
1552
+ except AttributeError :
1553
+ pass # classic toolbar lacks the attribute
1551
1554
wx .Frame .Destroy (self , * args , ** kwargs )
1552
1555
if self .toolbar is not None :
1553
1556
self .toolbar .Destroy ()
@@ -1707,6 +1710,8 @@ def _onMenuItemSelected(self, evt):
1707
1710
else :
1708
1711
new = True
1709
1712
self ._menu .Check (evt .GetId (), new )
1713
+ # Lines above would be deleted based on svn tracker ID 2841525;
1714
+ # not clear whether this matters or not.
1710
1715
self ._toolbar .set_active (self .getActiveAxes ())
1711
1716
evt .Skip ()
1712
1717
@@ -1720,7 +1725,11 @@ def updateAxes(self, maxAxis):
1720
1725
self ._menu .Append (menuId , "Axis %d" % i , "Select axis %d" % i , True )
1721
1726
self ._menu .Check (menuId , True )
1722
1727
bind (self , wx .EVT_MENU , self ._onMenuItemSelected , id = menuId )
1723
- self ._toolbar .set_active (range (len (self ._axisId )))
1728
+ elif maxAxis < len (self ._axisId ):
1729
+ for menuId in self ._axisId [maxAxis :]:
1730
+ self ._menu .Delete (menuId )
1731
+ self ._axisId = self ._axisId [:maxAxis ]
1732
+ self ._toolbar .set_active (range (maxAxis ))
1724
1733
1725
1734
def getActiveAxes (self ):
1726
1735
"""Return a list of the selected axes."""
@@ -2080,7 +2089,8 @@ def zoomy(self, in_out):
2080
2089
2081
2090
def update (self ):
2082
2091
"""
2083
- Update the toolbar menu - called when (e.g.) a new subplot or axes are added
2092
+ Update the toolbar menu - called when (e.g.) a new subplot
2093
+ or axes are added
2084
2094
"""
2085
2095
DEBUG_MSG ("update()" , 1 , self )
2086
2096
self ._axes = self .canvas .figure .get_axes ()
0 commit comments