Changeset da6c9847 in sasview for src/sans/plottools/toolbar.py


Ignore:
Timestamp:
Apr 5, 2014 6:12:17 AM (11 years ago)
Author:
pkienzle
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
a40a875
Parents:
4d7e5d5
Message:

Support matplotlib 1.2+

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sans/plottools/toolbar.py

    reea3ffa rda6c9847  
    2424    def __init__(self, canvas, parent=None): 
    2525        NavigationToolbar2WxAgg.__init__(self, canvas) 
    26          
     26 
     27    # CRUFT: mpl 1.1 uses save rather than save_figure 
     28    try: save_figure = NavigationToolbar2WxAgg.save 
     29    except AttributeError: pass 
    2730    def _init_toolbar(self): 
    2831        self._parent = self.canvas.GetParent() 
     
    3538        _NTB2_PRINT        = wx.NewId() 
    3639        _NTB2_RESET        = wx.NewId() 
     40 
     41        # for mpl 1.2+ compatibility 
     42        self.wx_ids = {} 
     43        self.wx_ids['Back'] = self._NTB2_BACK 
     44        self.wx_ids['Forward'] = self._NTB2_FORWARD 
     45        self.wx_ids['Pan'] = self._NTB2_PAN 
     46        self.wx_ids['Zoom'] = self._NTB2_ZOOM 
    3747 
    3848        self.SetToolBitmapSize(wx.Size(24,24)) 
     
    7282        bind(self, wx.EVT_TOOL, self.zoom, id=self._NTB2_ZOOM) 
    7383        bind(self, wx.EVT_TOOL, self.pan, id=self._NTB2_PAN) 
    74         bind(self, wx.EVT_TOOL, self.save, id=_NTB2_SAVE) 
     84        bind(self, wx.EVT_TOOL, self.save_figure, id=_NTB2_SAVE) 
    7585        bind(self, wx.EVT_TOOL, self.on_print, id=_NTB2_PRINT) 
    7686        bind(self, wx.EVT_TOOL, self.on_reset, id=_NTB2_RESET) 
    7787 
    7888        self.Realize() 
    79          
     89 
    8090    def on_menu(self, event): 
    8191        """ 
     
    8696        except: 
    8797            logging.error("Plot toolbar could not show menu") 
    88          
     98 
    8999    def on_reset(self, event): 
    90100        """ 
     
    95105        except: 
    96106            logging.error("Plot toolbar could not reset plot") 
    97          
     107 
    98108    def on_print(self, event): 
    99109        """ 
Note: See TracChangeset for help on using the changeset viewer.