Changeset 70ec588d in sasview for plottools/src/danse/common


Ignore:
Timestamp:
Jan 10, 2012 12:42:28 PM (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:
592cb156
Parents:
cfe1feb
Message:

reorganized the list of context menu items

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plottools/src/danse/common/plottools/PlotPanel.py

    r0e553fd r70ec588d  
    265265        # check if zoomed. 
    266266        self.is_zoomed = False 
     267        # Plottables 
     268        self.plots = {} 
    267269         
    268270        # Default locations 
     
    640642        """ 
    641643        list = {} 
     644        menu = event.GetEventObject() 
     645        id = event.GetId() 
     646        self.set_selected_from_menu(menu, id) 
    642647        plotlist = self.graph.returnPlottable() 
    643648        if self.graph.selected_plottable is not None: 
     
    661666                                self.xmin, self.xmax) 
    662667            dlg.ShowModal()  
    663  
     668             
     669    def set_selected_from_menu(self, menu, id): 
     670        """ 
     671        Set selected_plottable from context menu selection 
     672         
     673        :param menu: context menu item 
     674        :param id: menu item id 
     675        """ 
     676        if len(self.plots) < 1: 
     677            return 
     678        name = menu.GetHelpString(id) 
     679        for plot in self.plots.values(): 
     680            if plot.name == name: 
     681                self.graph.selected_plottable = plot.id 
     682                break 
     683             
    664684    def linear_plottable_fit(self, plot):  
    665685        """ 
     
    917937        # reset postion 
    918938        self.position = None 
     939        if self.graph.selected_plottable != None: 
     940            self.graph.selected_plottable = None 
    919941         
    920942        self.onContextMenu(event) 
Note: See TracChangeset for help on using the changeset viewer.