Ignore:
Timestamp:
Aug 24, 2012 4:47:40 PM (12 years ago)
Author:
Jae Cho <jhjcho@…>
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:
b82e536
Parents:
9bc37a8
Message:

data operation: added scale for 2D plot

File:
1 edited

Legend:

Unmodified
Added
Removed
  • calculatorview/src/sans/perspectives/calculator/data_operator.py

    r7bfc888 r6e48fd0  
    639639        self.is_number = is_number 
    640640        self.content = content 
     641        self.point = None 
    641642        self.position = (0.4, 0.5) 
    642643        self.scale = 'linear' 
     
    673674        self.plots = {} 
    674675        self.clear() 
     676        self.point = plot 
    675677        try: 
    676678            self.figure.delaxes(self.figure.axes[0]) 
     
    804806        id = wx.NewId() 
    805807        slicerpop = wx.Menu() 
    806         slicerpop.Append(id, '&Change Scale') 
    807         wx.EVT_MENU(self, id, self._onProperties) 
     808        data = self.point 
     809        if issubclass(data.__class__, Data1D): 
     810            slicerpop.Append(id, '&Change Scale') 
     811            wx.EVT_MENU(self, id, self._onProperties) 
     812        else: 
     813            slicerpop.Append(id, '&Toggle Linear/Log Scale') 
     814            wx.EVT_MENU(self, id, self.ontogglescale)      
    808815        try: 
    809816            # mouse event 
     
    814821            pos_x, pos_y = self.toolbar.GetPositionTuple() 
    815822            pos = (pos_x, pos_y + 5) 
    816              
    817823        self.PopupMenu(slicerpop, pos) 
     824         
     825    def ontogglescale(self, event):  
     826        """ 
     827        On toggle 2d scale 
     828        """ 
     829        self._onToggleScale(event)   
     830        try: 
     831            # mpl >= 1.1.0 
     832            self.figure.tight_layout() 
     833        except: 
     834            self.figure.subplots_adjust(left=0.1, bottom=0.1)  
     835        try: 
     836            self.figure.delaxes(self.figure.axes[1]) 
     837        except: 
     838            pass 
    818839         
    819840    def _onProperties(self, event): 
Note: See TracChangeset for help on using the changeset viewer.