Changeset fe48fcc in sasview for sansguiframe


Ignore:
Timestamp:
Aug 31, 2011 10:56:12 AM (13 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:
49a470d
Parents:
e4a703a
Message:

added 2D plot label modif

Location:
sansguiframe/src/sans/guiframe/local_perspectives/plotting
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter1D.py

    re4a703a rfe48fcc  
    247247            ## Set the view scale for all plots 
    248248            self._onEVT_FUNC_PROPERTY() 
     249            self.toolbar.update() 
    249250         
    250251           
  • sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter2D.py

    re4a703a rfe48fcc  
    2020from danse.common.plottools.PlotPanel import PlotPanel 
    2121from danse.common.plottools.plottables import Graph 
     22from danse.common.plottools.LabelDialog import LabelDialog 
    2223from sans.guiframe.events import EVT_NEW_PLOT 
    2324from sans.guiframe.events import EVT_SLICER_PARS 
     
    198199        self.graph.xaxis(data._xaxis, data._xunit) 
    199200        self.graph.yaxis(data._yaxis, data._yunit) 
    200         self.graph.title(self.data2D.name) 
     201        if data.label == None: 
     202            data.label = data.name 
     203        self.graph.title(data.label) 
    201204        self.graph.render(self) 
    202205        self.draw_plot() 
     
    210213                        ylo > data.ymin and yhi < data.ymax): 
    211214                self.subplot.set_xlim((xlo, xhi))      
    212                 self.subplot.set_ylim((ylo, yhi))   
     215                self.subplot.set_ylim((ylo, yhi))  
     216            else:  
     217                self.toolbar.update() 
    213218 
    214219    def onContextMenu(self, event): 
     
    298303                    wx.EVT_MENU(self, id, self._onEditSlicer)  
    299304            slicerpop.AppendSeparator()  
     305             
     306        id = wx.NewId() 
     307        slicerpop.Append(id, '&Edit Label', 'Edit Label') 
     308        wx.EVT_MENU(self, id, self.onEditLabels) 
     309        slicerpop.AppendSeparator() 
     310         
    300311        id = wx.NewId() 
    301312        slicerpop.Append(id, '&2D Color Map') 
     
    307318        pos = self.ScreenToClient(pos) 
    308319        self.PopupMenu(slicerpop, pos) 
    309     
     320             
     321    def onEditLabels(self, event): 
     322        """ 
     323        Edit legend label 
     324        """ 
     325        selected_plot = self.plots[self.graph.selected_plottable] 
     326        label = selected_plot.label 
     327        dial = LabelDialog(None, -1, 'Change Label', label) 
     328        if dial.ShowModal() == wx.ID_OK: 
     329            newLabel = dial.getText()  
     330            selected_plot.label = newLabel 
     331        dial.Destroy() 
     332        ## render the graph 
     333        self.subplot.set_title(selected_plot.label) 
     334        self.subplot.figure.canvas.draw_idle() 
     335         
    310336    def _onEditDetector(self, event): 
    311337        """ 
Note: See TracChangeset for help on using the changeset viewer.