Ignore:
Timestamp:
Mar 31, 2009 11:50:18 AM (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:
59a7f2d
Parents:
a68efd1
Message:

setting default model value on combobox

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/basepage.py

    r00c3aac r9853ad0  
    653653            self._populate_box( self.formfactorbox, 
    654654                                self.model_list_box["Added models"]) 
    655              
    656              
    657         if self.multip_cb.GetValue(): 
     655        if not self.multip_cb.GetValue():  
     656            model = self.formfactorbox.GetClientData(0) 
     657            self.model = model() 
     658             
     659        else: 
    658660            ## multplication not available for structure factor 
    659661            if self.struct_rbutton.GetValue(): 
     
    664666            self.structurebox.Show(True) 
    665667            self.text2.Show(True) 
    666             ## draw empty model 
    667             from sans.models.NullModel import NullModel 
    668             self.model = NullModel() 
    669             self.model.name = "Select P(Q) and S(Q)" 
    670             self.set_model_param_sizer(self.model) 
    671             self.sizer4_4.Clear() 
    672             self.sizer4.Layout() 
    673             self._draw_model() 
    674              
     668            ## draw multplication  model 
     669            form_factor = self.formfactorbox.GetClientData(0) 
     670            struct_factor = self.structurebox.GetClientData(0) 
     671             
     672            from sans.models.MultiplicationModel import MultiplicationModel 
     673            self.model= MultiplicationModel(form_factor(),struct_factor()) 
     674 
     675        self.set_model_param_sizer(self.model) 
     676        self.sizer4_4.Clear() 
     677        self.sizer4.Layout() 
     678             
     679        self._draw_model() 
    675680        self.set_scroll() 
    676681         
     
    691696                    name = model.name 
    692697                combobox.Append(name,models) 
    693              
     698        try: 
     699            combobox.SetSelection(0) 
     700        except: 
     701            pass 
    694702        wx.EVT_COMBOBOX(combobox,-1, self._on_select_model)  
    695703        return 0 
     
    706714        
    707715        if self.multip_cb.GetValue(): 
    708             if struct_factor != None and form_factor != None: 
    709                 from sans.models.MultiplicationModel import MultiplicationModel 
    710                 self.model= MultiplicationModel(form_factor(),struct_factor()) 
    711             else: 
    712                 from sans.models.NullModel import NullModel 
    713                 self.model = NullModel() 
    714                 self.model.name = "Select P(Q) and S(Q)" 
    715                 msg= "select one P(Q) and one S(Q) to plot" 
    716                 wx.PostEvent(self.parent.parent, StatusEvent(status= msg)) 
     716            from sans.models.MultiplicationModel import MultiplicationModel 
     717            self.model= MultiplicationModel(form_factor(),struct_factor()) 
     718             
    717719        else: 
    718             if form_factor != None: 
    719                 self.model= form_factor() 
     720            self.model= form_factor() 
    720721        
    721722         
     
    753754                    is_modified = True     
    754755            except: 
    755                 msg= "Model Drawing  Error:wrong value entered : %s"% sys.exc_value 
    756                 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 
    757                 return  
     756                raise 
     757                #msg= "Model Drawing  Error:wrong value entered : %s"% sys.exc_value 
     758                #wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 
     759                #return  
    758760         
    759761        return is_modified  
Note: See TracChangeset for help on using the changeset viewer.