Ignore:
Timestamp:
Jun 18, 2008 4:10:06 PM (16 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
3fd1ebc
Parents:
4972de2
Message:

Updated for interactive graphs. Improved for standalone use.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • prview/perspectives/pr/inversion_panel.py

    rb659551 raa4b8379  
    115115    pos_err  = 1.0 
    116116     
    117     def __init__(self, parent, id = -1, plots = None, **kwargs): 
     117    def __init__(self, parent, id = -1, plots = None, standalone=False, **kwargs): 
    118118        wx.Panel.__init__(self, parent, id = id, **kwargs) 
    119119         
     
    147147        ## Data manager 
    148148        self.manager   = None 
     149         
     150        ## Standalone flage 
     151        self.standalone = standalone 
    149152         
    150153        self._do_layout() 
     
    181184            #self.label_sugg.Show() 
    182185        elif name=='plotname': 
    183             self.plot_data.SetValue(str(value)) 
    184             self.plot_radio.SetValue(True) 
     186            if self.standalone==False: 
     187                self.plot_data.SetValue(str(value)) 
     188                self.plot_radio.SetValue(True) 
     189                self._on_pars_changed(None) 
     190        elif name=='datafile': 
     191            self.data_file.SetValue(str(value)) 
     192            self.file_radio.SetValue(True) 
    185193            self._on_pars_changed(None) 
    186194        else: 
     
    214222            self.alpha_estimate_ctl.GetValue() 
    215223        elif name=='plotname': 
    216             self.plot_data.GetValue() 
     224            if self.standalone==False: 
     225                self.plot_data.GetValue() 
     226        elif name=='datafile': 
     227            self.data_file.GetValue() 
    217228        else: 
    218229            wx.Panel.__getattr__(self, name) 
     
    230241 
    231242        # ----- I(q) data ----- 
    232         databox = wx.StaticBox(self, -1, "I(q) data") 
     243        databox = wx.StaticBox(self, -1, "I(q) data source") 
    233244         
    234245        boxsizer1 = wx.StaticBoxSizer(databox, wx.VERTICAL) 
     
    248259        pars_sizer.Add(choose_button, (iy,3), (1,1), wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    249260         
    250         iy += 1 
    251         self.plot_radio = wx.RadioButton(self, -1, "Plot data:") 
    252         self.plot_data = wx.TextCtrl(self, -1, size=(100,20)) 
    253         self.plot_data.SetEditable(False) 
    254         pars_sizer.Add(self.plot_radio, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    255         pars_sizer.Add(self.plot_data, (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     261        if self.standalone==False: 
     262            iy += 1 
     263            self.plot_radio = wx.RadioButton(self, -1, "Plot data:") 
     264            self.plot_data = wx.TextCtrl(self, -1, size=(100,20)) 
     265            self.plot_data.SetEditable(False) 
     266            pars_sizer.Add(self.plot_radio, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     267            pars_sizer.Add(self.plot_data, (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    256268         
    257269        boxsizer1.Add(pars_sizer, 0, wx.EXPAND) 
     
    476488        # If the pars are valid, estimate alpha 
    477489        if flag: 
    478             if self.plot_radio.GetValue(): 
     490            if self.standalone==False and self.plot_radio.GetValue(): 
    479491                dataset = self.plot_data.GetValue() 
    480492                self.manager.estimate_plot_inversion(alpha=alpha, nfunc=nfunc,  
     
    571583         
    572584        if flag: 
    573             if self.plot_radio.GetValue(): 
     585            if self.standalone==False and self.plot_radio.GetValue(): 
    574586                dataset = self.plot_data.GetValue() 
    575                 self.manager.setup_plot_inversion(alpha=alpha, nfunc=nfunc,  
    576                                                   d_max=dmax, 
    577                                                   q_min=qmin, q_max=qmax) 
     587                if len(dataset.strip())==0: 
     588                    message = "No data to invert. Select a data set before proceeding with P(r) inversion." 
     589                    wx.PostEvent(self.manager.parent, StatusEvent(status=message)) 
     590                else: 
     591                    self.manager.setup_plot_inversion(alpha=alpha, nfunc=nfunc,  
     592                                                      d_max=dmax, 
     593                                                      q_min=qmin, q_max=qmax) 
    578594            else: 
    579595                path = self.data_file.GetValue() 
    580                 self.manager.setup_file_inversion(alpha=alpha, nfunc=nfunc,  
    581                                                   d_max=dmax, path=path, 
    582                                                   q_min=qmin, q_max=qmax 
    583                                                   ) 
     596                if len(path.strip())==0: 
     597                    message = "No data to invert. Select a data set before proceeding with P(r) inversion." 
     598                    wx.PostEvent(self.manager.parent, StatusEvent(status=message)) 
     599                else: 
     600                    self.manager.setup_file_inversion(alpha=alpha, nfunc=nfunc,  
     601                                                      d_max=dmax, path=path, 
     602                                                      q_min=qmin, q_max=qmax 
     603                                                      ) 
    584604                 
    585605        else: 
Note: See TracChangeset for help on using the changeset viewer.