Changeset 3b605bb in sasview
- Timestamp:
- Apr 8, 2009 3:02:18 PM (16 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:
- 6999659
- Parents:
- 8a1ab69
- Location:
- sansview/perspectives/fitting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
rb787e68c r3b605bb 206 206 #----------------------------------------------------- 207 207 self.sizer4.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) 208 self.sizer4_4.Layout() 208 209 self.sizer4.Layout() 209 210 self.Layout() 210 211 self.SetScrollbars(20,20,200,100) 212 self.Refresh() 211 213 212 214 … … 675 677 flag= name != "NoStructure" 676 678 if flag and (class_name in self.model_list_box["Structure Factors"]): 677 self.structurebox.Show(True) 678 self.text2.Show(True) 679 self.multip_cb.SetValue(True) 679 self.structurebox.Enable() 680 680 items = self.structurebox.GetItems() 681 681 self.sizer1.Layout() … … 729 729 for k, list in self.model_list_box.iteritems(): 730 730 if k in["P(Q)*S(Q)","Shapes" ] and class_name in self.model_list_box["Shapes"]: 731 732 if class_name in self.model_list_box["P(Q)*S(Q)"]: 733 self.structurebox.Enable() 734 else: 735 self.structurebox.Disable() 736 self.structurebox.SetSelection(0) 737 731 738 self.shape_rbutton.SetValue(True) 732 739 ## fill the form factor list with new model … … 746 753 self.plugin_rbutton.SetValue(True) 747 754 if class_name in list: 755 self.structurebox.SetSelection(0) 756 self.structurebox.Disable() 748 757 ## fill the form factor list with new model 749 758 self._populate_box(self.formfactorbox, list) … … 784 793 self.struct_rbutton = wx.RadioButton(self, -1, "Structure Factor ") 785 794 self.plugin_rbutton = wx.RadioButton(self, -1, "Customized Models") 786 self.multip_cb = wx.CheckBox(self, -1,"P(Q)*S(Q)")787 788 789 795 790 796 self.Bind( wx.EVT_RADIOBUTTON, self._show_combox, … … 796 802 self.Bind( wx.EVT_RADIOBUTTON, self._show_combox, 797 803 id= self.plugin_rbutton.GetId() ) 798 wx.EVT_CHECKBOX(self, self.multip_cb.GetId() , self._show_combox )804 799 805 800 sizer_radiobutton = wx.GridSizer( 3, 3,5, 5)806 sizer_radiobutton = wx.GridSizer(2, 2,5, 5) 801 807 sizer_radiobutton.Add(self.shape_rbutton) 802 808 sizer_radiobutton.Add(self.shape_indep_rbutton) 803 sizer_radiobutton.Add(self.multip_cb)804 809 sizer_radiobutton.Add(self.plugin_rbutton) 805 810 sizer_radiobutton.Add(self.struct_rbutton) … … 810 815 self.text2 = wx.StaticText( self,-1,"* S(Q)" ) 811 816 812 self.text2.Hide()813 817 814 818 self.formfactorbox = wx.ComboBox(self, -1,style=wx.CB_READONLY) … … 820 824 wx.EVT_COMBOBOX(self.formfactorbox,-1, self._on_select_model) 821 825 wx.EVT_COMBOBOX(self.structurebox,-1, self._on_select_model) 822 self.structurebox.Hide() 826 827 823 828 824 829 ## fill combox box … … 829 834 self._populate_box( self.structurebox, 830 835 self.model_list_box["Structure Factors"]) 836 self.structurebox.Insert("None", 0,None) 837 self.structurebox.SetSelection(0) 838 self.structurebox.Disable() 839 840 if self.model.__class__ in self.model_list_box["P(Q)*S(Q)"]: 841 self.structurebox.Enable() 842 831 843 832 844 ## check model type to show sizer … … 863 875 event.GetEventObject()==self.shape_rbutton: 864 876 ##fill the combobox with form factor list 865 self.structurebox. Hide()866 self. text2.Hide()877 self.structurebox.SetSelection(0) 878 self.structurebox.Disable() 867 879 self.formfactorbox.Clear() 868 880 self._populate_box( self.formfactorbox,self.model_list_box["Shapes"]) … … 871 883 event.GetEventObject()==self.shape_indep_rbutton: 872 884 ##fill the combobox with shape independent factor list 873 self.structurebox. Hide()874 self. text2.Hide()885 self.structurebox.SetSelection(0) 886 self.structurebox.Disable() 875 887 self.formfactorbox.Clear() 876 888 self._populate_box( self.formfactorbox, … … 880 892 event.GetEventObject()==self.struct_rbutton: 881 893 ##fill the combobox with structure factor list 882 self.structurebox. Hide()883 self. text2.Hide()894 self.structurebox.SetSelection(0) 895 self.structurebox.Disable() 884 896 self.formfactorbox.Clear() 885 897 self._populate_box( self.formfactorbox, … … 890 902 891 903 ##fill the combobox with form factor list 892 self.structurebox.Hide() 893 self.text2.Hide() 904 self.structurebox.Disable() 894 905 self.formfactorbox.Clear() 895 906 self._populate_box( self.formfactorbox, 896 907 self.model_list_box["Customized Models"]) 897 908 898 if not self.multip_cb.GetValue():899 self.structurebox.Hide()900 self.text2.Hide()901 n = self.formfactorbox.GetCurrentSelection()902 model = self.formfactorbox.GetClientData(n)903 self.model = model()904 ## user check multiplication option905 else:906 ##for this release907 flag1= self.plugin_rbutton.GetValue()or self.struct_rbutton.GetValue()\908 or self.shape_indep_rbutton.GetValue()909 flag2= False910 911 n = self.formfactorbox.GetCurrentSelection()912 form_factor = self.formfactorbox.GetClientData(n)913 ## selecting only multiplication model914 if self.shape_rbutton.GetValue():915 if not form_factor in self.model_list_box["multiplication"]:916 flag2 = True917 ## multiplication not available for structure factor918 if flag1 or flag2:919 self.multip_cb.SetValue(False)920 self.structurebox.Hide()921 self.text2.Hide()922 return923 ## allow only some to have multiplication924 925 self.structurebox.Show(True)926 self.text2.Show(True)927 ## draw multiplication model928 n = self.structurebox.GetCurrentSelection()929 struct_factor = self.structurebox.GetClientData(n)930 931 from sans.models.MultiplicationModel import MultiplicationModel932 self.model= MultiplicationModel(form_factor(),struct_factor())933 934 909 self._on_select_model(event=None) 935 self.sizer4_4. Clear()910 self.sizer4_4.Layout() 936 911 self.sizer4.Layout() 937 938 939 self.set_scroll() 940 912 self.Layout() 913 self.Refresh() 914 self.SetScrollbars(20,20,200,100) 941 915 942 916 def _populate_box(self, combobox, list): … … 970 944 self._disp_obj_dict = {} 971 945 self.disp_cb_dict ={} 972 973 946 f_id = self.formfactorbox.GetCurrentSelection() 947 form_factor = self.formfactorbox.GetClientData( f_id ) 948 if not form_factor in self.model_list_box["multiplication"]: 949 self.structurebox.Disable() 950 self.structurebox.SetSelection(0) 951 952 974 953 s_id = self.structurebox.GetCurrentSelection() 975 form_factor = self.formfactorbox.GetClientData( f_id )976 954 struct_factor = self.structurebox.GetClientData( s_id ) 977 978 if not form_factor in self.model_list_box["multiplication"]: 979 self.multip_cb.SetValue(False) 980 self.structurebox.Hide() 981 self.text2.Hide() 982 self.sizer4_4.Clear() 983 self.sizer4.Layout() 984 985 if self.multip_cb.GetValue(): 955 956 if struct_factor !=None: 986 957 from sans.models.MultiplicationModel import MultiplicationModel 987 958 self.model= MultiplicationModel(form_factor(),struct_factor()) 988 989 959 else: 990 960 self.model= form_factor() … … 992 962 ## post state to fit panel 993 963 self.save_current_state() 964 self.sizer4_4.Layout() 965 self.sizer4.Layout() 966 self.Layout() 967 self.SetScrollbars(20,20,200,100) 968 self.Refresh() 969 994 970 995 971 … … 1077 1053 else: 1078 1054 ## set gaussian sizer 1079 #self._set_sizer_gaussian()1080 1055 self._on_select_Disp(event=None) 1081 1056 else: … … 1089 1064 self.save_current_state() 1090 1065 1091 self.sizer4.Layout() 1092 self.Layout() 1093 self.SetScrollbars(20,20,200,100) 1066 1094 1067 1095 1068 … … 1109 1082 self.sizer4_4.Layout() 1110 1083 self.sizer4.Layout() 1111 1112 1084 self.SetScrollbars(20,20,200,100) 1113 return 1114 1085 1115 1086 1116 1087 def _reset_dispersity(self): … … 1123 1094 from sans.models.dispersion_models import GaussianDispersion 1124 1095 if len(self.disp_cb_dict)==0: 1096 self.sizer4_4.Clear(True) 1097 self.sizer4_4.Layout() 1098 self.sizer4.Layout() 1099 self.Layout() 1100 self.Refresh() 1101 self.SetScrollbars(20,20,200,100) 1125 1102 return 1126 1103 … … 1136 1113 self._draw_model() 1137 1114 1115 self.sizer4_4.Layout() 1116 self.sizer4.Layout() 1117 self.Layout() 1118 self.SetScrollbars(20,20,200,100) 1119 self.Refresh() 1120 1121 1138 1122 1139 1123 def _on_select_Disp(self,event): … … 1151 1135 if name=="ArrayDispersion": 1152 1136 self._set_sizer_arraydispersion() 1153 1137 1154 1138 self.state.disp_box= n 1155 1139 ## post state to fit panel … … 1157 1141 wx.PostEvent(self.parent, event) 1158 1142 1143 self.sizer4_4.Layout() 1144 self.sizer4.Layout() 1145 self.Layout() 1146 self.SetScrollbars(20,20,200,100) 1147 self.Refresh() 1148 1149 1150 1159 1151 1160 1152 def _set_sizer_arraydispersion(self): -
sansview/perspectives/fitting/fitpage.py
rb787e68c r3b605bb 394 394 self._on_select_model_helper() 395 395 self.set_model_param_sizer(self.model) 396 self._set_sizer_gaussian()397 398 evt = ModelEventbox(model=self.model)399 wx.PostEvent(self.event_owner, evt)400 396 try: 401 397 self.compute_chisqr() 402 self.text1_1.Show()403 self.tcChi.Show()404 398 except: 405 399 ## error occured on chisqr computation 406 400 pass 401 self.enable_disp.SetValue(False) 402 self.disable_disp.SetValue(True) 403 self._set_dipers_Param(event=None) 404 405 evt = ModelEventbox(model=self.model) 406 wx.PostEvent(self.event_owner, evt) 407 407 408 408 409 def _onparamEnter(self,event): -
sansview/perspectives/fitting/fitpanel.py
rb787e68c r3b605bb 231 231 qmin=qmin, qmax=qmax, npts=npts, reset=reset) 232 232 else: 233 self.model_page.select_model(model, page_title)233 self.model_page.select_model(model, "Model") 234 234 235 235 -
sansview/perspectives/fitting/modelpage.py
rb787e68c r3b605bb 99 99 """ 100 100 self._on_select_model_helper() 101 self.set_model_param_sizer(self.model) 102 self._set_sizer_gaussian() 103 self.name = self.model.name 104 self.model_view.SetFocus() 105 self.parent.model_page.name = self.name 106 self.parent.draw_model_name = self.name 107 self._draw_model() 101 self.select_model(self.model, self.model.name) 102 108 103 109 104 def _fill_model_sizer(self, sizer): … … 253 248 ## keep the sizer view consistent with the model menu selecting 254 249 self._set_model_sizer_selection( self.model ) 255 250 self.enable_disp.SetValue(False) 251 self.disable_disp.SetValue(True) 252 self._set_dipers_Param(event=None) 256 253 self.model_view.SetFocus() 257 254
Note: See TracChangeset
for help on using the changeset viewer.