Changeset e88ebfd in sasview for sansview/perspectives/fitting/basepage.py
- Timestamp:
- Mar 11, 2011 4:39:00 PM (14 years ago)
- 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:
- ee2b492
- Parents:
- 14cd91b1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
rb2d9826 re88ebfd 946 946 return True 947 947 948 948 def set_model_state(self, state): 949 """ 950 reset page given a model state 951 """ 952 self.disp_cb_dict = state.disp_cb_dict 953 self.disp_list = state.disp_list 954 955 ## set the state of the radio box 956 self.shape_rbutton.SetValue(state.shape_rbutton ) 957 self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton) 958 self.struct_rbutton.SetValue(state.struct_rbutton) 959 self.plugin_rbutton.SetValue(state.plugin_rbutton) 960 961 ## fill model combobox 962 self._show_combox_helper() 963 #select the current model 964 self.formfactorbox.Select(int(state.formfactorcombobox)) 965 self.structurebox.SetSelection(state.structurecombobox ) 966 if state.multi_factor != None: 967 self.multifactorbox.SetSelection(state.multi_factor) 968 969 ## reset state of checkbox,textcrtl and regular parameters value 970 self._reset_parameters_state(self.orientation_params_disp, 971 state.orientation_params_disp) 972 self._reset_parameters_state(self.orientation_params, 973 state.orientation_params) 974 self._reset_parameters_state(self.str_parameters, 975 state.str_parameters) 976 self._reset_parameters_state(self.parameters,state.parameters) 977 ## display dispersion info layer 978 self.enable_disp.SetValue(state.enable_disp) 979 self.disable_disp.SetValue(state.disable_disp) 980 981 if hasattr(self, "disp_box"): 982 983 self.disp_box.SetSelection(state.disp_box) 984 n= self.disp_box.GetCurrentSelection() 985 dispersity= self.disp_box.GetClientData(n) 986 name = dispersity.__name__ 987 988 self._set_dipers_Param(event=None) 989 990 if name == "ArrayDispersion": 991 992 for item in self.disp_cb_dict.keys(): 993 994 if hasattr(self.disp_cb_dict[item], "SetValue") : 995 self.disp_cb_dict[item].SetValue(\ 996 state.disp_cb_dict[item]) 997 # Create the dispersion objects 998 from sans.models.dispersion_models import ArrayDispersion 999 disp_model = ArrayDispersion() 1000 if hasattr(state,"values")and\ 1001 self.disp_cb_dict[item].GetValue() == True: 1002 if len(state.values)>0: 1003 self.values=state.values 1004 self.weights=state.weights 1005 disp_model.set_weights(self.values, 1006 state.weights) 1007 else: 1008 self._reset_dispersity() 1009 1010 self._disp_obj_dict[item] = disp_model 1011 # Set the new model as the dispersion object 1012 #for the selected parameter 1013 self.model.set_dispersion(item, disp_model) 1014 1015 self.model._persistency_dict[item] = \ 1016 [state.values, state.weights] 1017 1018 else: 1019 keys = self.model.getParamList() 1020 for item in keys: 1021 if item in self.disp_list and \ 1022 not self.model.details.has_key(item): 1023 self.model.details[item] = ["", None, None] 1024 for k,v in self.state.disp_cb_dict.iteritems(): 1025 self.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 1026 self.state.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 1027 ## smearing info restore 1028 if hasattr(self, "enable_smearer"): 1029 ## set smearing value whether or not the data 1030 #contain the smearing info 1031 self.enable_smearer.SetValue(state.enable_smearer) 1032 self.disable_smearer.SetValue(state.disable_smearer) 1033 self.onSmear(event=None) 1034 self.pinhole_smearer.SetValue(state.pinhole_smearer) 1035 self.slit_smearer.SetValue(state.slit_smearer) 1036 ## we have two more options for smearing 1037 if self.pinhole_smearer.GetValue(): self.onPinholeSmear(event=None) 1038 elif self.slit_smearer.GetValue(): self.onSlitSmear(event=None) 1039 1040 ## reset state of checkbox,textcrtl and dispersity parameters value 1041 self._reset_parameters_state(self.fittable_param,state.fittable_param) 1042 self._reset_parameters_state(self.fixed_param,state.fixed_param) 1043 1044 ## draw the model with previous parameters value 1045 self._onparamEnter_helper() 1046 self.select_param(event=None) 1047 #Save state_fit 1048 self.save_current_state_fit() 1049 self._lay_out() 1050 self.Refresh() 1051 949 1052 def reset_page_helper(self, state): 950 1053 """
Note: See TracChangeset
for help on using the changeset viewer.