Changeset 4fea1df in sasview for src/sas/sasgui/perspectives/fitting/simfitpage.py
- Timestamp:
- Oct 6, 2016 9:29:09 PM (8 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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- cb823f0
- Parents:
- 1dbdb83
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/simfitpage.py
re89aed5 r4fea1df 1050 1050 """ 1051 1051 1052 # FIXME: Not tracking data set name on loading ==> NECESSARY! 1052 1053 model_map = {} 1053 fit.fit_panel.add_sim_page() 1054 if fit.fit_panel.sim_page is None: 1055 fit.fit_panel.add_sim_page() 1056 sim_page = fit.fit_panel.sim_page 1054 1057 1055 1058 # Process each model and associate old M# with new M# 1056 1059 i = 0 1057 for model in fit.fit_panel.sim_page.model_list:1060 for model in sim_page.model_list: 1058 1061 model_id = self._format_id(model[1].keys()[0]) 1059 1062 for saved_model in self.model_list: … … 1065 1068 model[3].name 1066 1069 check = bool(saved_model.pop('checked')) 1067 fit.fit_panel.sim_page.model_list[i][0].SetValue(check)1070 sim_page.model_list[i][0].SetValue(check) 1068 1071 continue 1069 1072 i += 1 1070 fit.fit_panel.sim_page.check_model_name(None)1073 sim_page.check_model_name(None) 1071 1074 1072 1075 if len(self.constraints_list) > 0: 1073 fit.fit_panel.sim_page.hide_constraint.SetValue(False) 1074 fit.fit_panel.sim_page.show_constraint.SetValue(True) 1075 fit.fit_panel.sim_page._display_constraint(None) 1076 1077 for constraint in self.constraints_list: 1078 model_cbox = constraint.pop('model_cbox') 1079 constraint_value = constraint.pop('constraint') 1076 sim_page.hide_constraint.SetValue(False) 1077 sim_page.show_constraint.SetValue(True) 1078 sim_page._display_constraint(None) 1079 1080 for index, item in enumerate(self.constraints_list): 1081 model_cbox = item.pop('model_cbox') 1082 constraint_value = item.pop('constraint') 1083 param = item.pop('param_cbox') 1084 equality = item.pop('egal_txt') 1080 1085 for key, value in model_map.iteritems(): 1081 1086 model_cbox.replace(key, value) 1082 1087 constraint_value.replace(key, value) 1083 1088 1084 bt_remove = wx.Button(fit.fit_panel.sim_page, 1085 fit.fit_panel.sim_page._ids.next(), 'Remove') 1086 bt_remove.Bind(wx.EVT_BUTTON, fit.fit_panel.sim_page.on_remove, 1087 id=bt_remove.GetId()) 1088 bt_remove.SetToolTipString("Remove constraint.") 1089 param_cbox = wx.ComboBox(fit.fit_panel.sim_page, wx.ID_ANY, 1090 style=wx.CB_READONLY, size=(100, -1)) 1091 egal_txt = wx.StaticText(fit.fit_panel.sim_page, wx.ID_ANY, " = ") 1092 # Model list 1093 model_cbox_sizer = wx.ComboBox(fit.fit_panel.sim_page, 1094 wx.ID_ANY, style=wx.CB_READONLY) 1095 model_cbox_sizer.Clear() 1096 wx.EVT_COMBOBOX(model_cbox_sizer, wx.ID_ANY, 1097 fit.fit_panel.sim_page._on_select_model) 1098 constraint_sizer = wx.TextCtrl(fit.fit_panel.sim_page, wx.ID_ANY) 1099 sizer_constraint = wx.BoxSizer(wx.HORIZONTAL) 1100 sizer_constraint.Add((5, -1)) 1101 sizer_constraint.Add(model_cbox_sizer, flag=wx.RIGHT | wx.EXPAND, 1102 border=10) 1103 sizer_constraint.Add(param_cbox, flag=wx.RIGHT | wx.EXPAND, 1104 border=5) 1105 sizer_constraint.Add(egal_txt, flag=wx.RIGHT | wx.EXPAND, border=5) 1106 sizer_constraint.Add(constraint_sizer, flag=wx.RIGHT | wx.EXPAND, 1107 border=10) 1108 sizer_constraint.Add(bt_remove, flag=wx.RIGHT | wx.EXPAND, 1109 border=10) 1110 new_const = ConstraintLine(model_cbox=model_cbox_sizer, 1111 param_cbox=constraint.pop('param_cbox'), 1112 egal_txt=constraint.pop('egal_txt'), 1113 constraint=constraint_value, 1114 btRemove=bt_remove, 1115 sizer=sizer_constraint 1116 ) 1117 # ConstraintLine = namedtuple('ConstraintLine', 1118 # 'model_cbox param_cbox egal_txt constraint btRemove sizer') 1119 fit.fit_panel.sim_page.sizer_constraints.Insert( 1120 before=fit.fit_panel.sim_page.nb_constraint, 1121 item=sizer_constraint, flag=wx.TOP | wx.BOTTOM | wx.EXPAND, 1122 border=5) 1123 fit.fit_panel.sim_page.constraints_list.append(new_const) 1089 sim_page.constraints_list[index][0].SetValue(model_cbox) 1090 sim_page._on_select_model(None) 1091 sim_page.constraints_list[index][1].SetValue(param) 1092 sim_page.constraints_list[index][2].SetLabel(equality) 1093 sim_page.constraints_list[index][3].SetValue(constraint_value) 1094 sim_page._on_add_constraint(None) 1124 1095 1125 1096 def _format_id(self, original_id):
Note: See TracChangeset
for help on using the changeset viewer.