Changeset 9a585d0 in sasview


Ignore:
Timestamp:
Feb 13, 2009 12:41:08 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
96f97f3
Parents:
ea290ee
Message:

make plotter1D and plotter2D context menu in the same order

Location:
guiframe/local_perspectives/plotting
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • guiframe/local_perspectives/plotting/Plotter1D.py

    r96d7959 r9a585d0  
    175175        # Option to save the data displayed 
    176176         
     177       
     178                 
     179        # Various plot options 
     180        id = wx.NewId() 
     181        slicerpop.Append(id,'&Save image', 'Save image as PNG') 
     182        wx.EVT_MENU(self, id, self.onSaveImage) 
     183         
     184        id = wx.NewId() 
     185        slicerpop.Append(id,'&Print image', 'Print image ') 
     186        wx.EVT_MENU(self, id, self.onPrint)   
     187            
     188        slicerpop.AppendSeparator() 
     189        item_list = self.parent.get_context_menu(self.graph) 
     190        #print "item_list",item_list 
     191        if (not item_list==None) and (not len(item_list)==0): 
     192            for item in item_list: 
     193                try: 
     194                    id = wx.NewId() 
     195                    slicerpop.Append(id, item[0], item[1]) 
     196                    wx.EVT_MENU(self, id, item[2]) 
     197                except: 
     198                    pass 
     199                    #print sys.exc_value 
     200                    #print RuntimeError, "View1DPanel.onContextMenu: bad menu item" 
     201            slicerpop.AppendSeparator() 
    177202        #for plot in self.graph.plottables: 
    178203        if self.graph.selected_plottable in self.plots: 
     
    189214            self.action_ids[str(id)] = plot 
    190215            wx.EVT_MENU(self, id, self._onRemove) 
    191             
     216            slicerpop.AppendSeparator() 
    192217            # Option to hide 
    193218            #TODO: implement functionality to hide a plottable (legend click) 
    194219             
    195                  
    196         # Various plot options 
    197         id = wx.NewId() 
    198         slicerpop.Append(id,'&Save image', 'Save image as PNG') 
    199         wx.EVT_MENU(self, id, self.onSaveImage) 
    200          
    201         slicerpop.AppendSeparator() 
    202         item_list = self.parent.get_context_menu(self.graph) 
    203         #print "item_list",item_list 
    204         if (not item_list==None) and (not len(item_list)==0): 
    205                 for item in item_list: 
    206                     try: 
    207                         id = wx.NewId() 
    208                         slicerpop.Append(id, item[0], item[1]) 
    209                         wx.EVT_MENU(self, id, item[2]) 
    210                     except: 
    211                         pass 
    212                         #print sys.exc_value 
    213                         #print RuntimeError, "View1DPanel.onContextMenu: bad menu item" 
    214          
    215220        
    216221        if self.graph.selected_plottable in self.plots: 
     
    232237                wx.EVT_MENU(self, id, self.onFitting) 
    233238                 
    234         slicerpop.AppendSeparator() 
     239            slicerpop.AppendSeparator() 
    235240        id = wx.NewId() 
    236241        slicerpop.Append(id, '&Change scale') 
     
    240245        slicerpop.Append(id, '&Reset Graph') 
    241246        wx.EVT_MENU(self, id, self.onResetGraph)   
    242          
     247        """ 
    243248        slicerpop.AppendSeparator()  
    244249        id = wx.NewId() 
     
    249254        slicerpop.Append(id,'&Printer Preview', 'Set image size') 
    250255        wx.EVT_MENU(self, id, self.onPrinterPreview) 
    251      
    252         id = wx.NewId() 
    253         slicerpop.Append(id,'&Print image', 'Print image ') 
    254         wx.EVT_MENU(self, id, self.onPrint)      
     256        """ 
     257         
    255258 
    256259        pos = event.GetPosition() 
  • guiframe/local_perspectives/plotting/Plotter2D.py

    rea290ee r9a585d0  
    180180        slicerpop.set_plots(self.plots) 
    181181        slicerpop.set_graph(self.graph) 
    182      
     182         
     183              
     184        id = wx.NewId() 
     185        slicerpop.Append(id, '&Save image') 
     186        wx.EVT_MENU(self, id, self.onSaveImage) 
     187         
     188        id = wx.NewId() 
     189        slicerpop.Append(id,'&Print image', 'Print image ') 
     190        wx.EVT_MENU(self, id, self.onPrint) 
     191         
     192        slicerpop.AppendSeparator() 
    183193        item_list = self.parent.get_context_menu(self.graph) 
    184194        if (not item_list==None) and (not len(item_list)==0): 
     
    194204                        #print RuntimeError, "View1DPanel2D.onContextMenu: bad menu item" 
    195205         
    196         slicerpop.AppendSeparator() 
     206                slicerpop.AppendSeparator() 
    197207        id = wx.NewId() 
    198208        slicerpop.Append(id, '&Edit Detector Parameters') 
     
    231241            wx.EVT_MENU(self, id, self._onEditSlicer)  
    232242        slicerpop.AppendSeparator()  
    233             
    234         id = wx.NewId() 
    235         slicerpop.Append(id, '&Save image') 
    236         wx.EVT_MENU(self, id, self.onSaveImage)  
    237          
     243        
     244        """ 
    238245        # Option to save the data displayed 
    239246        id = wx.NewId() 
     
    244251        slicerpop.Append(id,'&Printer Preview', 'Set image size') 
    245252        wx.EVT_MENU(self, id, self.onPrinterPreview) 
    246      
    247         id = wx.NewId() 
    248         slicerpop.Append(id,'&Print image', 'Print image ') 
    249         wx.EVT_MENU(self, id, self.onPrint) 
    250         slicerpop.AppendSeparator() 
     253        """ 
    251254        id = wx.NewId() 
    252255        slicerpop.Append(id, '&Toggle Linear/Log scale') 
     
    261264        print "edit detortor param",self.zmin_2D, self.zmax_2D 
    262265        import detector_dialog 
    263         dialog = detector_dialog.DetectorDialog(None, -1, "") 
     266        dialog = detector_dialog.DetectorDialog(self, -1,base=self.parent) 
    264267        xnpts = len(self.data2D.x_bins) 
    265268        ynpts = len(self.data2D.y_bins) 
  • guiframe/local_perspectives/plotting/detector_dialog.py

    rea290ee r9a585d0  
    77import wx 
    88from sans.guiframe.utils import format_number 
    9  
     9from sans.guicomm.events import StatusEvent ,NewPlotEvent,SlicerEvent 
    1010class DetectorDialog(wx.Dialog): 
    1111    """ 
     
    1313    """ 
    1414     
    15     def __init__(self, *args, **kwds): 
     15    def __init__(self,parent,id=1,base=None, *args, **kwds): 
    1616 
    1717        kwds["style"] = wx.DEFAULT_DIALOG_STYLE 
    18         wx.Dialog.__init__(self, *args, **kwds) 
    19          
     18        wx.Dialog.__init__(self,parent,id=1, *args, **kwds) 
     19        self.parent=base 
    2020        self.label_xnpts = wx.StaticText(self, -1, "Detector width in pixels") 
    2121        self.label_ynpts = wx.StaticText(self, -1, "Detector Height in pixels") 
     
    6666            if value and float( value)==0.0: 
    6767                flag = False 
     68                wx.PostEvent(self.parent, StatusEvent(status="Enter number greater than zero")) 
    6869                self.zmin_ctl.SetBackgroundColour("pink") 
    6970                self.zmin_ctl.Refresh() 
     
    7374        except: 
    7475            flag = False 
     76            wx.PostEvent(self.parent, StatusEvent(status="Enter float value")) 
    7577            self.zmin_ctl.SetBackgroundColour("pink") 
    7678            self.zmin_ctl.Refresh() 
     
    7981            if value and int(value)==0.0: 
    8082                flag = False 
     83                wx.PostEvent(self.parent, StatusEvent(status="Enter number greater than zero")) 
    8184                self.zmax_ctl.SetBackgroundColour("pink") 
    8285                self.zmax_ctl.Refresh() 
     
    8689        except: 
    8790            flag = False 
     91            wx.PostEvent(self.parent, StatusEvent(status="Enter Integer value")) 
    8892            self.zmax_ctl.SetBackgroundColour("pink") 
    8993            self.zmax_ctl.Refresh() 
Note: See TracChangeset for help on using the changeset viewer.