Changes in src/sas/sasgui/perspectives/fitting/basepage.py [d3911e3:9e0aa69a] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
rd3911e3 r9e0aa69a 1106 1106 """ 1107 1107 for key, value in self.master_category_dict.iteritems(): 1108 formfactor = state.formfactorcombobox.split(":") 1109 if isinstance(formfactor, list): 1110 formfactor = formfactor[0] 1108 1111 for list_item in value: 1109 if state.formfactorcomboboxin list_item:1112 if formfactor in list_item: 1110 1113 return self.categorybox.Items.index(key) 1111 1114 return 0 … … 1153 1156 self._show_combox_helper() 1154 1157 # select the current model 1155 try: 1156 # to support older version 1157 category_pos = int(state.categorycombobox) 1158 except: 1159 state.formfactorcombobox = state.formfactorcombobox.lower() 1160 state.formfactorcombobox = \ 1161 state.formfactorcombobox.replace('model', '') 1162 state.formfactorcombobox = unicode(state.formfactorcombobox) 1163 state.categorycombobox = unicode(state.categorycombobox) 1164 if state.categorycombobox in self.categorybox.Items: 1165 category_pos = self.categorybox.Items.index( 1166 state.categorycombobox) 1167 else: 1168 # Look in master list for model name (model.lower) 1169 category_pos = self.get_cat_combo_box_pos(state) 1158 state._convert_to_sasmodels() 1159 state.categorycombobox = unicode(state.categorycombobox) 1160 if state.categorycombobox in self.categorybox.Items: 1161 category_pos = self.categorybox.Items.index( 1162 state.categorycombobox) 1163 else: 1164 # Look in master list for model name (model.lower) 1165 category_pos = self.get_cat_combo_box_pos(state) 1170 1166 1171 1167 self.categorybox.Select(category_pos) 1172 1168 self._show_combox(None) 1173 try: 1174 # to support older version 1175 formfactor_pos = int(state.formfactorcombobox) 1176 except: 1177 formfactor_pos = 0 1178 for ind_form in range(self.formfactorbox.GetCount()): 1179 if self.formfactorbox.GetString(ind_form) == \ 1180 (state.formfactorcombobox): 1181 formfactor_pos = int(ind_form) 1169 from models import PLUGIN_NAME_BASE 1170 if self.categorybox.GetValue() == 'Customized Models' \ 1171 and PLUGIN_NAME_BASE not in state.formfactorcombobox: 1172 state.formfactorcombobox = \ 1173 PLUGIN_NAME_BASE + state.formfactorcombobox 1174 formfactor_pos = 0 1175 for ind_form in range(self.formfactorbox.GetCount()): 1176 if self.formfactorbox.GetString(ind_form) == \ 1177 (state.formfactorcombobox): 1178 formfactor_pos = int(ind_form) 1179 break 1180 1181 self.formfactorbox.Select(formfactor_pos) 1182 1183 structfactor_pos = 0 1184 if state.structurecombobox is not None: 1185 state.structurecombobox = unicode(state.structurecombobox) 1186 for ind_struct in range(self.structurebox.GetCount()): 1187 if self.structurebox.GetString(ind_struct) == \ 1188 (state.structurecombobox): 1189 structfactor_pos = int(ind_struct) 1182 1190 break 1183 1184 self.formfactorbox.Select(formfactor_pos)1185 1186 structfactor_pos = 01187 try:1188 # to support older version1189 structfactor_pos = int(state.structurecombobox)1190 except:1191 if state.structurecombobox is not None:1192 state.structurecombobox = unicode(state.structurecombobox)1193 for ind_struct in range(self.structurebox.GetCount()):1194 if self.structurebox.GetString(ind_struct) == \1195 (state.structurecombobox):1196 structfactor_pos = int(ind_struct)1197 break1198 1191 1199 1192 self.structurebox.SetSelection(structfactor_pos) … … 1385 1378 # self.state.struct_rbutton = self.struct_rbutton.GetValue() 1386 1379 # self.state.plugin_rbutton = self.plugin_rbutton.GetValue() 1387 self.state.structurecombobox = self.structurebox.Get Label()1388 self.state.formfactorcombobox = self.formfactorbox.Get Label()1389 self.state.categorycombobox = self.categorybox.Get Label()1380 self.state.structurecombobox = self.structurebox.GetValue() 1381 self.state.formfactorcombobox = self.formfactorbox.GetValue() 1382 self.state.categorycombobox = self.categorybox.GetValue() 1390 1383 1391 1384 # post state to fit panel … … 1435 1428 self.qmax_x = tempmax 1436 1429 is_modified = True 1437 1438 1430 if is_2Ddata: 1439 # set mask1440 1431 is_modified = self._validate_Npts() 1441 1432 else: 1433 is_modified = self._validate_Npts_1D() 1442 1434 else: 1443 1435 self.fitrange = False … … 1454 1446 # Theory case: need to get npts value to draw 1455 1447 self.npts_x = float(self.Npts_total.GetValue()) 1448 self.Npts_fit.SetValue(str(self.Npts_total.GetValue())) 1449 self._save_plotting_range() 1456 1450 self.create_default_data() 1457 1451 self.state_change = True … … 1574 1568 if len(statelist) == 0 or len(listtorestore) == 0: 1575 1569 return 1576 if len(statelist) != len(listtorestore):1577 return1578 1570 1579 1571 for j in range(len(listtorestore)): 1580 item_page = listtorestore[j] 1581 item_page_info = statelist[j] 1582 # change the state of the check box for simple parameters 1583 if item_page[0] is not None: 1584 item_page[0].SetValue(item_page_info[0]) 1585 if item_page[2] is not None: 1586 item_page[2].SetValue(item_page_info[2]) 1587 if item_page[2].__class__.__name__ == "ComboBox": 1588 if item_page_info[2] in self.model.fun_list: 1589 fun_val = self.model.fun_list[item_page_info[2]] 1590 self.model.setParam(item_page_info[1], fun_val) 1591 if item_page[3] is not None: 1592 # show or hide text +/- 1593 if item_page_info[2]: 1594 item_page[3].Show(True) 1595 else: 1596 item_page[3].Hide() 1597 if item_page[4] is not None: 1598 # show of hide the text crtl for fitting error 1599 if item_page_info[4][0]: 1600 item_page[4].Show(True) 1601 item_page[4].SetValue(item_page_info[4][1]) 1602 else: 1603 item_page[3].Hide() 1604 if item_page[5] is not None: 1605 # show of hide the text crtl for fitting error 1606 item_page[5].Show(item_page_info[5][0]) 1607 item_page[5].SetValue(item_page_info[5][1]) 1608 1609 if item_page[6] is not None: 1610 # show of hide the text crtl for fitting error 1611 item_page[6].Show(item_page_info[6][0]) 1612 item_page[6].SetValue(item_page_info[6][1]) 1572 for param in statelist: 1573 if param[1] == listtorestore[j][1]: 1574 item_page = listtorestore[j] 1575 item_page_info = param 1576 if (item_page_info[1] == "theta" or item_page_info[1] == 1577 "phi") and not self._is_2D(): 1578 break 1579 # change the state of the check box for simple parameters 1580 if item_page[0] is not None: 1581 item_page[0].SetValue(item_page_info[0]) 1582 if item_page[2] is not None: 1583 item_page[2].SetValue(item_page_info[2]) 1584 if item_page[2].__class__.__name__ == "ComboBox": 1585 if item_page_info[2] in self.model.fun_list: 1586 fun_val = self.model.fun_list[item_page_info[2]] 1587 self.model.setParam(item_page_info[1], fun_val) 1588 if item_page[3] is not None: 1589 # show or hide text +/- 1590 if item_page_info[2]: 1591 item_page[3].Show(True) 1592 else: 1593 item_page[3].Hide() 1594 if item_page[4] is not None: 1595 # show of hide the text crtl for fitting error 1596 if item_page_info[4][0]: 1597 item_page[4].Show(True) 1598 item_page[4].SetValue(str(item_page_info[4][1])) 1599 else: 1600 item_page[3].Hide() 1601 if item_page[5] is not None: 1602 # show of hide the text crtl for fitting error 1603 item_page[5].Show(True) 1604 item_page[5].SetValue(str(item_page_info[5][1])) 1605 if item_page[6] is not None: 1606 # show of hide the text crtl for fitting error 1607 item_page[6].Show(True) 1608 item_page[6].SetValue(str(item_page_info[6][1])) 1609 break 1613 1610 1614 1611 def _reset_strparam_state(self, listtorestore, statelist): … … 2132 2129 flag = False 2133 2130 else: 2134 self.Npts_fit.SetValue(str(len(index_data[index_data ])))2131 self.Npts_fit.SetValue(str(len(index_data[index_data is True]))) 2135 2132 self.fitrange = True 2136 2133 … … 2167 2164 flag = False 2168 2165 else: 2169 self.Npts_fit.SetValue(str(len(index_data[index_data is True]))) 2166 val = index_data[index_data is True] 2167 val = len(val) if isinstance(val, list) else 1 2168 self.Npts_fit.SetValue(str(val)) 2170 2169 self.fitrange = True 2171 2170
Note: See TracChangeset
for help on using the changeset viewer.