Changeset 4523b68 in sasview
- Timestamp:
- Aug 18, 2010 5:30:03 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:
- a706353b
- Parents:
- 645f9b6
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
r3c44c66 r4523b68 929 929 self.formfactorbox.Select(int(state.formfactorcombobox)) 930 930 self.structurebox.SetSelection(state.structurecombobox ) 931 931 if state.multi_factor != None: 932 self.multifactorbox.SetSelection(state.multi_factor-1) 933 932 934 #reset the fitting engine type 933 935 self.engine_type = state.engine_type … … 1584 1586 else: 1585 1587 boxsizer1 = box_sizer 1586 1588 sizer_buttons = wx.BoxSizer(wx.HORIZONTAL) 1587 1589 #-------------------------------------------------------- 1588 1590 self.shape_rbutton = wx.RadioButton(self, -1, 'Shapes', style=wx.RB_GROUP) … … 1605 1607 sizer_radiobutton.Add(self.shape_rbutton) 1606 1608 sizer_radiobutton.Add(self.shape_indep_rbutton) 1609 1607 1610 sizer_radiobutton.Add(self.plugin_rbutton) 1608 1611 sizer_radiobutton.Add(self.struct_rbutton) 1612 sizer_buttons.Add(sizer_radiobutton) 1613 # detail button 1614 if object !=None: 1615 sizer_buttons.Add((50,0)) 1616 sizer_buttons.Add(object) 1609 1617 1610 1618 sizer_selection = wx.BoxSizer(wx.HORIZONTAL) 1619 mutifactor_selection = wx.BoxSizer(wx.HORIZONTAL) 1611 1620 1612 1621 self.text1 = wx.StaticText( self,-1,"" ) 1613 1622 self.text2 = wx.StaticText( self,-1,"P(Q)*S(Q)" ) 1614 1623 self.mutifactor_text = wx.StaticText( self,-1,"No. of Shells: " ) 1615 1624 1616 1625 self.formfactorbox = wx.ComboBox(self, -1,style=wx.CB_READONLY) … … 1619 1628 1620 1629 self.structurebox = wx.ComboBox(self, -1,style=wx.CB_READONLY) 1621 1630 self.multifactorbox = wx.ComboBox(self, -1,style=wx.CB_READONLY) 1622 1631 self.initialize_combox() 1623 1632 1624 1633 wx.EVT_COMBOBOX(self.formfactorbox,-1, self._on_select_model) 1625 1634 wx.EVT_COMBOBOX(self.structurebox,-1, self._on_select_model) 1626 1627 1635 wx.EVT_COMBOBOX(self.multifactorbox,-1, self._on_select_model) 1636 1628 1637 ## check model type to show sizer 1629 1638 if self.model !=None: … … 1637 1646 sizer_selection.Add((5,5)) 1638 1647 sizer_selection.Add(self.structurebox) 1639 sizer_selection.Add((5,5)) 1640 1641 boxsizer1.Add( sizer_radiobutton ) 1642 boxsizer1.Add( (20,20)) 1648 #sizer_selection.Add((5,5)) 1649 mutifactor_selection.Add((10,5)) 1650 mutifactor_selection.Add(self.mutifactor_text) 1651 mutifactor_selection.Add(self.multifactorbox) 1652 1653 boxsizer1.Add( sizer_buttons ) 1654 boxsizer1.Add( (15,15)) 1643 1655 boxsizer1.Add( sizer_selection ) 1644 if object !=None: 1645 boxsizer1.Add( (-72,-72)) 1646 boxsizer1.Add( object, 0, wx.ALIGN_RIGHT| wx.RIGHT, 35) 1647 boxsizer1.Add( (60,60)) 1656 boxsizer1.Add( (10,10)) 1657 boxsizer1.Add(mutifactor_selection) 1658 1659 self._set_multfactor_combobox() 1660 1648 1661 #-------------------------------------------------------- 1649 1662 sizer.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) 1650 1663 sizer.Layout() 1651 1664 self.SetScrollbars(20,20,25,65) 1665 1666 def _set_multfactor_combobox(self): 1667 """ 1668 Set comboBox for muitfactor of CoreMultiShellModel 1669 """ 1670 for idx in range(1,5): 1671 self.multifactorbox.Append(str(idx),int(idx)) 1672 self.multifactorbox.SetSelection(0) 1673 self._hide_multfactor_combobox() 1674 1675 def _show_multfactor_combobox(self): 1676 """ 1677 Show the comboBox of muitfactor of CoreMultiShellModel 1678 """ 1679 if not self.mutifactor_text.IsShown(): 1680 self.mutifactor_text.Show(True) 1681 if not self.multifactorbox.IsShown(): 1682 self.multifactorbox.Show(True) 1683 1684 def _hide_multfactor_combobox(self): 1685 """ 1686 Hide the comboBox of muitfactor of CoreMultiShellModel 1687 """ 1688 if self.mutifactor_text.IsShown(): 1689 self.mutifactor_text.Hide() 1690 if self.multifactorbox.IsShown(): 1691 self.multifactorbox.Hide() 1692 1652 1693 1653 1694 def _show_combox_helper(self): … … 1797 1838 self.structurebox.Enable() 1798 1839 self.text2.Enable() 1840 1841 if form_factor != None: 1842 # set multifactor for Mutifunctional models 1843 if form_factor().name == 'CoreMultiShellModel': 1844 self._show_multfactor_combobox() 1845 m_id = self.multifactorbox.GetCurrentSelection() 1846 self.multi_factor = self.multifactorbox.GetClientData(m_id) 1847 if self.multi_factor == None: self.multi_factor =0 1848 form_factor = form_factor(int(self.multi_factor)) 1849 else: 1850 self._hide_multfactor_combobox() 1851 form_factor = form_factor() 1852 self.multi_factor = None 1853 else: 1854 self._hide_multfactor_combobox() 1855 self.multi_factor = None 1856 1799 1857 s_id = self.structurebox.GetCurrentSelection() 1800 1858 struct_factor = self.structurebox.GetClientData( s_id ) 1801 1859 1802 1860 if struct_factor !=None: 1803 1861 from sans.models.MultiplicationModel import MultiplicationModel 1804 self.model= MultiplicationModel(form_factor (),struct_factor())1862 self.model= MultiplicationModel(form_factor,struct_factor()) 1805 1863 1806 1864 else: 1807 1865 if form_factor != None: 1808 self.model= form_factor ()1866 self.model= form_factor 1809 1867 else: 1810 1868 self.model = None 1811 1869 return self.model 1870 1871 1812 1872 ## post state to fit panel 1813 1873 self.state.parameters =[] 1814 1874 self.state.model =self.model 1875 self.state.qmin = self.qmin_x 1876 self.state.multi_factor = self.multi_factor 1815 1877 self.disp_list =self.model.getDispParamList() 1816 1878 self.state.disp_list = self.disp_list -
sansview/perspectives/fitting/models.py
r5062bbf r4523b68 182 182 self.shape_list.append(CoreShellModel) 183 183 self.multiplication_factor.append(CoreShellModel) 184 185 from sans.models.Core FourShellModel import CoreFourShellModel186 self.shape_list.append(Core FourShellModel)187 self.multiplication_factor.append(Core FourShellModel)184 185 from sans.models.CoreMultiShellModel import CoreMultiShellModel 186 self.shape_list.append(CoreMultiShellModel) 187 self.multiplication_factor.append(CoreMultiShellModel) 188 188 189 189 from sans.models.VesicleModel import VesicleModel -
sansview/perspectives/fitting/pagestate.py
rb63dc6e r4523b68 223 223 self.npts = None 224 224 self.name = "" 225 self.multi_factor = None 225 226 ## enable smearering state 226 227 self.enable_smearer = False … … 297 298 obj.qmin = copy.deepcopy(self.qmin) 298 299 obj.qmax = copy.deepcopy(self.qmax) 300 obj.multi_factor = copy.deepcopy(self.multi_factor) 299 301 obj.npts = copy.deepcopy(self.npts ) 300 302 obj.cb1 = copy.deepcopy(self.cb1) -
theoryview/perspectives/theory/basepage.py
r74755ff r4523b68 94 94 if self.model != None: 95 95 self.disp_list= self.model.getDispParamList() 96 96 self.multi_factor = None 97 97 ##enable model 2D draw 98 98 self.enable2D= False … … 497 497 ## reset state of checkbox,textcrtl and regular parameters value 498 498 self.reset_page(previous_state) 499 499 500 500 501 def onSave(self, event): … … 505 506 if self.model==None: 506 507 return 508 self.save_current_state() 509 """ 507 510 if hasattr(self,"enable_disp"): 508 511 self.state.enable_disp = copy.deepcopy(self.enable_disp.GetValue()) … … 511 514 512 515 self.state.model.name= self.model.name 513 516 """ 514 517 new_state = self.state.clone() 515 518 new_state.model.name = self.state.model.name … … 697 700 self.structurebox.SetSelection(state.structurecombobox ) 698 701 self.formfactorbox.SetSelection(state.formfactorcombobox) 699 702 if state.multi_factor != None: 703 self.multifactorbox.SetSelection(state.multi_factor-1) 704 #draw the pnael according to the new model parameter 705 self._on_select_model(event=None) 706 700 707 ## enable the view 2d button if this is a modelpage type 701 708 if hasattr(self,"model_view"): … … 1153 1160 else: 1154 1161 boxsizer1 = box_sizer 1155 1162 sizer_buttons = wx.BoxSizer(wx.HORIZONTAL) 1156 1163 #-------------------------------------------------------- 1157 1164 self.shape_rbutton = wx.RadioButton(self, -1, 'Shapes', style=wx.RB_GROUP) … … 1177 1184 sizer_radiobutton.Add(self.struct_rbutton) 1178 1185 1186 sizer_buttons.Add(sizer_radiobutton) 1187 # detail button 1188 if object !=None: 1189 sizer_buttons.Add((50,0)) 1190 sizer_buttons.Add(object) 1191 1179 1192 sizer_selection = wx.BoxSizer(wx.HORIZONTAL) 1180 1193 mutifactor_selection = wx.BoxSizer(wx.HORIZONTAL) 1181 1194 self.text1 = wx.StaticText( self,-1,"" ) 1182 1195 self.text2 = wx.StaticText( self,-1,"P(Q)*S(Q)" ) 1183 1196 self.mutifactor_text = wx.StaticText( self,-1,"No. of Shells: " ) 1184 1197 1185 1198 self.formfactorbox = wx.ComboBox(self, -1,style=wx.CB_READONLY) … … 1189 1202 1190 1203 self.structurebox = wx.ComboBox(self, -1,style=wx.CB_READONLY) 1204 self.multifactorbox = wx.ComboBox(self, -1,style=wx.CB_READONLY) 1191 1205 wx.EVT_COMBOBOX(self.formfactorbox,-1, self._on_select_model) 1192 1206 wx.EVT_COMBOBOX(self.structurebox,-1, self._on_select_model) 1193 1207 wx.EVT_COMBOBOX(self.multifactorbox,-1, self._on_select_model) 1194 1208 1195 1209 ## fill combox box … … 1224 1238 sizer_selection.Add((5,5)) 1225 1239 sizer_selection.Add(self.structurebox) 1226 sizer_selection.Add((5,5)) 1227 1228 boxsizer1.Add( sizer_radiobutton ) 1229 boxsizer1.Add( (20,20)) 1240 #sizer_selection.Add((5,5)) 1241 mutifactor_selection.Add((10,5)) 1242 mutifactor_selection.Add(self.mutifactor_text) 1243 mutifactor_selection.Add(self.multifactorbox) 1244 1245 boxsizer1.Add( sizer_buttons ) 1246 boxsizer1.Add( (15,15)) 1230 1247 boxsizer1.Add( sizer_selection ) 1231 if object !=None: 1232 boxsizer1.Add( (-72,-72)) 1233 boxsizer1.Add( object, 0, wx.ALIGN_RIGHT| wx.RIGHT, 35) 1234 boxsizer1.Add( (60,60)) 1248 boxsizer1.Add( (10,10)) 1249 boxsizer1.Add(mutifactor_selection) 1250 1251 self._set_multfactor_combobox() 1252 1235 1253 #-------------------------------------------------------- 1236 1254 sizer.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) … … 1238 1256 self.SetScrollbars(20,20,25,65) 1239 1257 1258 def _set_multfactor_combobox(self): 1259 """ 1260 Set comboBox for muitfactor of CoreMultiShellModel 1261 """ 1262 for idx in range(1,5): 1263 self.multifactorbox.Append(str(idx),int(idx)) 1264 self.multifactorbox.SetSelection(0) 1265 self._hide_multfactor_combobox() 1266 1267 def _show_multfactor_combobox(self): 1268 """ 1269 Show the comboBox of muitfactor of CoreMultiShellModel 1270 """ 1271 if not self.mutifactor_text.IsShown(): 1272 self.mutifactor_text.Show(True) 1273 if not self.multifactorbox.IsShown(): 1274 self.multifactorbox.Show(True) 1275 1276 def _hide_multfactor_combobox(self): 1277 """ 1278 Hide the comboBox of muitfactor of CoreMultiShellModel 1279 """ 1280 if self.mutifactor_text.IsShown(): 1281 self.mutifactor_text.Hide() 1282 if self.multifactorbox.IsShown(): 1283 self.multifactorbox.Hide() 1284 1240 1285 1241 1286 def _show_combox(self, event): … … 1419 1464 self.structurebox.Enable() 1420 1465 self.text2.Enable() 1421 1466 1467 if form_factor != None: 1468 # set multifactor for Mutifunctional models 1469 if form_factor().name == 'CoreMultiShellModel': 1470 self._show_multfactor_combobox() 1471 m_id = self.multifactorbox.GetCurrentSelection() 1472 self.multi_factor = self.multifactorbox.GetClientData(m_id) 1473 if self.multi_factor == None: self.multi_factor =0 1474 form_factor = form_factor(int(self.multi_factor)) 1475 else: 1476 self._hide_multfactor_combobox() 1477 form_factor = form_factor() 1478 self.multi_factor = None 1479 else: 1480 self._hide_multfactor_combobox() 1481 self.multi_factor = None 1482 1422 1483 s_id = self.structurebox.GetCurrentSelection() 1423 1484 struct_factor = self.structurebox.GetClientData( s_id ) … … 1425 1486 if struct_factor !=None: 1426 1487 from sans.models.MultiplicationModel import MultiplicationModel 1427 self.model= MultiplicationModel(form_factor (),struct_factor())1488 self.model= MultiplicationModel(form_factor,struct_factor()) 1428 1489 1429 1490 else: 1430 1491 if form_factor != None: 1431 self.model= form_factor ()1492 self.model= form_factor 1432 1493 else: 1433 1494 self.model = None … … 1437 1498 self.state.parameters =[] 1438 1499 self.state.model =self.model 1500 self.state.qmin = self.qmin_x 1501 self.state.multi_factor = self.multi_factor 1439 1502 self.disp_list =self.model.getDispParamList() 1440 1503 self.state.disp_list = self.disp_list -
theoryview/perspectives/theory/models.py
r74755ff r4523b68 190 190 self.shape_list.append(CoreShellModel) 191 191 self.multiplication_factor.append(CoreShellModel) 192 193 from sans.models.Core FourShellModel import CoreFourShellModel194 self.shape_list.append(Core FourShellModel)195 self.multiplication_factor.append(Core FourShellModel)196 192 193 from sans.models.CoreMultiShellModel import CoreMultiShellModel 194 self.shape_list.append(CoreMultiShellModel) 195 self.multiplication_factor.append(CoreMultiShellModel) 196 197 197 from sans.models.VesicleModel import VesicleModel 198 198 self.shape_list.append(VesicleModel) -
theoryview/perspectives/theory/pagestate.py
r74755ff r4523b68 84 84 self.npts = None 85 85 self.name="" 86 self.multi_factor = None 86 87 ## enable smearering state 87 88 self.enable_smearer = False … … 146 147 obj.qmin = copy.deepcopy(self.qmin) 147 148 obj.qmax = copy.deepcopy(self.qmax) 149 obj.multi_factor = copy.deepcopy(self.multi_factor) 148 150 obj.npts = copy.deepcopy(self.npts ) 149 151 obj.cb1 = copy.deepcopy(self.cb1)
Note: See TracChangeset
for help on using the changeset viewer.