Changeset da6c9847 in sasview


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+

Location:
src/sans/plottools
Files:
2 edited

Legend:

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

    rcafa75f rda6c9847  
    11131113    @property 
    11141114    def is_zoomed(self): 
    1115         if hasattr(self.toolbar, "wx_ids"): 
    1116             back = self.toolbar.wx_ids['Back'] 
    1117         else: # CRUFT 
    1118             back = self.toolbar._NTB2_BACK 
    1119         toolbar_zoomed = self.toolbar.GetToolEnabled(back) 
     1115        toolbar_zoomed = self.toolbar.GetToolEnabled(self.toolbar.wx_ids['Back']) 
    11201116        return self._is_zoomed or toolbar_zoomed 
    11211117 
  • 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.