Changeset 11b094f in sasview for src/sas/sasgui/perspectives/fitting/basepage.py
- Timestamp:
- Feb 19, 2017 6:02:07 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:
- 4387385
- Parents:
- e92a352 (diff), 2510b9b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
re92a352 r11b094f 1105 1105 """ 1106 1106 for key, value in self.master_category_dict.iteritems(): 1107 formfactor = state.formfactorcombobox.split(":") 1108 if isinstance(formfactor, list): 1109 formfactor = formfactor[0] 1107 1110 for list_item in value: 1108 if state.formfactorcomboboxin list_item:1111 if formfactor in list_item: 1109 1112 return self.categorybox.Items.index(key) 1110 1113 return 0 … … 1152 1155 self._show_combox_helper() 1153 1156 # select the current model 1154 try: 1155 # to support older version 1156 category_pos = int(state.categorycombobox) 1157 except: 1158 state.formfactorcombobox = state.formfactorcombobox.lower() 1159 state.formfactorcombobox = \ 1160 state.formfactorcombobox.replace('model', '') 1161 state.formfactorcombobox = unicode(state.formfactorcombobox) 1162 state.categorycombobox = unicode(state.categorycombobox) 1163 if state.categorycombobox in self.categorybox.Items: 1164 category_pos = self.categorybox.Items.index( 1165 state.categorycombobox) 1166 else: 1167 # Look in master list for model name (model.lower) 1168 category_pos = self.get_cat_combo_box_pos(state) 1157 state._convert_to_sasmodels() 1158 state.categorycombobox = unicode(state.categorycombobox) 1159 if state.categorycombobox in self.categorybox.Items: 1160 category_pos = self.categorybox.Items.index( 1161 state.categorycombobox) 1162 else: 1163 # Look in master list for model name (model.lower) 1164 category_pos = self.get_cat_combo_box_pos(state) 1169 1165 1170 1166 self.categorybox.Select(category_pos) 1171 1167 self._show_combox(None) 1172 try: 1173 # to support older version 1174 formfactor_pos = int(state.formfactorcombobox) 1175 except: 1176 formfactor_pos = 0 1177 for ind_form in range(self.formfactorbox.GetCount()): 1178 if self.formfactorbox.GetString(ind_form) == \ 1179 (state.formfactorcombobox): 1180 formfactor_pos = int(ind_form) 1168 from models import PLUGIN_NAME_BASE 1169 if self.categorybox.GetValue() == 'Customized Models' \ 1170 and PLUGIN_NAME_BASE not in state.formfactorcombobox: 1171 state.formfactorcombobox = \ 1172 PLUGIN_NAME_BASE + state.formfactorcombobox 1173 formfactor_pos = 0 1174 for ind_form in range(self.formfactorbox.GetCount()): 1175 if self.formfactorbox.GetString(ind_form) == \ 1176 (state.formfactorcombobox): 1177 formfactor_pos = int(ind_form) 1178 break 1179 1180 self.formfactorbox.Select(formfactor_pos) 1181 1182 structfactor_pos = 0 1183 if state.structurecombobox is not None: 1184 state.structurecombobox = unicode(state.structurecombobox) 1185 for ind_struct in range(self.structurebox.GetCount()): 1186 if self.structurebox.GetString(ind_struct) == \ 1187 (state.structurecombobox): 1188 structfactor_pos = int(ind_struct) 1181 1189 break 1182 1183 self.formfactorbox.Select(formfactor_pos)1184 1185 structfactor_pos = 01186 try:1187 # to support older version1188 structfactor_pos = int(state.structurecombobox)1189 except:1190 if state.structurecombobox is not None:1191 state.structurecombobox = unicode(state.structurecombobox)1192 for ind_struct in range(self.structurebox.GetCount()):1193 if self.structurebox.GetString(ind_struct) == \1194 (state.structurecombobox):1195 structfactor_pos = int(ind_struct)1196 break1197 1190 1198 1191 self.structurebox.SetSelection(structfactor_pos) … … 1384 1377 # self.state.struct_rbutton = self.struct_rbutton.GetValue() 1385 1378 # self.state.plugin_rbutton = self.plugin_rbutton.GetValue() 1386 self.state.structurecombobox = self.structurebox.Get Label()1387 self.state.formfactorcombobox = self.formfactorbox.Get Label()1388 self.state.categorycombobox = self.categorybox.Get Label()1379 self.state.structurecombobox = self.structurebox.GetValue() 1380 self.state.formfactorcombobox = self.formfactorbox.GetValue() 1381 self.state.categorycombobox = self.categorybox.GetValue() 1389 1382 1390 1383 # post state to fit panel … … 1587 1580 if len(statelist) == 0 or len(listtorestore) == 0: 1588 1581 return 1589 if len(statelist) != len(listtorestore):1590 return1591 1582 1592 1583 for j in range(len(listtorestore)): 1593 item_page = listtorestore[j] 1594 item_page_info = statelist[j] 1595 # change the state of the check box for simple parameters 1596 if item_page[0] is not None: 1597 item_page[0].SetValue(item_page_info[0]) 1598 if item_page[2] is not None: 1599 item_page[2].SetValue(item_page_info[2]) 1600 if item_page[2].__class__.__name__ == "ComboBox": 1601 if item_page_info[2] in self.model.fun_list: 1602 fun_val = self.model.fun_list[item_page_info[2]] 1603 self.model.setParam(item_page_info[1], fun_val) 1604 if item_page[3] is not None: 1605 # show or hide text +/- 1606 if item_page_info[2]: 1607 item_page[3].Show(True) 1608 else: 1609 item_page[3].Hide() 1610 if item_page[4] is not None: 1611 # show of hide the text crtl for fitting error 1612 if item_page_info[4][0]: 1613 item_page[4].Show(True) 1614 item_page[4].SetValue(item_page_info[4][1]) 1615 else: 1616 item_page[3].Hide() 1617 if item_page[5] is not None: 1618 # show of hide the text crtl for fitting error 1619 item_page[5].Show(item_page_info[5][0]) 1620 item_page[5].SetValue(item_page_info[5][1]) 1621 1622 if item_page[6] is not None: 1623 # show of hide the text crtl for fitting error 1624 item_page[6].Show(item_page_info[6][0]) 1625 item_page[6].SetValue(item_page_info[6][1]) 1584 for param in statelist: 1585 if param[1] == listtorestore[j][1]: 1586 item_page = listtorestore[j] 1587 item_page_info = param 1588 if (item_page_info[1] == "theta" or item_page_info[1] == 1589 "phi") and not self._is_2D(): 1590 break 1591 # change the state of the check box for simple parameters 1592 if item_page[0] is not None: 1593 item_page[0].SetValue(item_page_info[0]) 1594 if item_page[2] is not None: 1595 item_page[2].SetValue(item_page_info[2]) 1596 if item_page[2].__class__.__name__ == "ComboBox": 1597 if item_page_info[2] in self.model.fun_list: 1598 fun_val = self.model.fun_list[item_page_info[2]] 1599 self.model.setParam(item_page_info[1], fun_val) 1600 if item_page[3] is not None: 1601 # show or hide text +/- 1602 if item_page_info[2]: 1603 item_page[3].Show(True) 1604 else: 1605 item_page[3].Hide() 1606 if item_page[4] is not None: 1607 # show of hide the text crtl for fitting error 1608 if item_page_info[4][0]: 1609 item_page[4].Show(True) 1610 item_page[4].SetValue(str(item_page_info[4][1])) 1611 else: 1612 item_page[3].Hide() 1613 if item_page[5] is not None: 1614 # show of hide the text crtl for fitting error 1615 item_page[5].Show(True) 1616 item_page[5].SetValue(str(item_page_info[5][1])) 1617 if item_page[6] is not None: 1618 # show of hide the text crtl for fitting error 1619 item_page[6].Show(True) 1620 item_page[6].SetValue(str(item_page_info[6][1])) 1621 break 1626 1622 1627 1623 def _reset_strparam_state(self, listtorestore, statelist):
Note: See TracChangeset
for help on using the changeset viewer.