Changeset be1ec9f in sasview for fittingview/src/sans/perspectives
- Timestamp:
- Jul 13, 2012 6:11:26 PM (12 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:
- 0da4eba
- Parents:
- e95614e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/basepage.py
rd49c956 rbe1ec9f 68 68 ## current model 69 69 self.model = None 70 self.m_name = None 70 71 self.index_model = None 72 self.panel = None 71 73 ## data 72 74 self.data = None … … 88 90 ## total number of point: float 89 91 self.npts = None 92 self.num_points = None 90 93 ## default fitengine type 91 94 self.engine_type = 'scipy' … … 125 128 self.btEditMask = None 126 129 self.btFit = None 130 self.sld_axes = None 131 self.multi_factor = None 127 132 128 133 self.disp_cb_dict = {} … … 230 235 if self.model != None: 231 236 if not self.data.is_data: 232 self._manager.page_finder[self.uid].set_fit_data(data=[self.data]) 237 self._manager.page_finder[self.uid].set_fit_data(data=\ 238 [self.data]) 233 239 self.on_smear_helper(update=True) 234 240 self.state.enable_smearer = self.enable_smearer.GetValue() … … 346 352 and (self.model != None) 347 353 sim_menu.Enable(not self.batch_on and flag) 348 batch_menu = self._manager.menu1.FindItemById(self._manager.id_batchfit) 354 batch_menu = \ 355 self._manager.menu1.FindItemById(self._manager.id_batchfit) 349 356 batch_menu.Enable(self.batch_on and flag) 350 357 … … 361 368 362 369 """ 363 ## Set to True when the mouse is clicked while thewhole string is selected370 ## Set to True when the mouse is clicked while whole string is selected 364 371 full_selection = False 365 372 ## Call back for EVT_SET_FOCUS events … … 431 438 432 439 event.Skip() 433 pass440 #pass 434 441 435 442 def set_page_info(self, page_info): … … 760 767 """ 761 768 # date and time 762 year, month, day, hour, minute, second, tda, ty, tm_isdst \ 763 = time.localtime() 769 year, month, day, hour, minute, second, _, _, _ = time.localtime() 764 770 current_time = str(hour) + ":" + str(minute) + ":" + str(second) 765 771 current_date = str(month) + "/" + str(day) + "/" + str(year) … … 1123 1129 not item in self.model.details: 1124 1130 self.model.details[item] = ["", None, None] 1125 for k, v in self.state.disp_cb_dict.iteritems(): 1126 self.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 1127 self.state.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 1131 self.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 1132 self.state.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 1128 1133 ## smearing info restore 1129 1134 if hasattr(self, "enable_smearer"): … … 1212 1217 formfactor_pos = 0 1213 1218 for ind_form in range(self.formfactorbox.GetCount()): 1214 if self.formfactorbox.GetString(ind_form) == (state.formfactorcombobox): 1219 if self.formfactorbox.GetString(ind_form) == \ 1220 (state.formfactorcombobox): 1215 1221 formfactor_pos = int(ind_form) 1216 1222 break … … 1224 1230 structfactor_pos = 0 1225 1231 for ind_struct in range(self.structurebox.GetCount()): 1226 if self.structurebox.GetString(ind_struct) == (state.structurecombobox): 1232 if self.structurebox.GetString(ind_struct) == \ 1233 (state.structurecombobox): 1227 1234 structfactor_pos = int(ind_struct) 1228 1235 break … … 1383 1390 if self.parent != None: 1384 1391 self._default_save_location = \ 1385 self.parent.parent. _default_save_location1392 self.parent.parent.get_save_location() 1386 1393 dlg = wx.FileDialog(self, "Choose a weight file", 1387 1394 self._default_save_location, "", … … 1397 1404 reset the context menu 1398 1405 """ 1399 for name, statein self.state.saved_states.iteritems():1406 for name, _ in self.state.saved_states.iteritems(): 1400 1407 self.number_saved_state += 1 1401 1408 ## Add item in the context menu … … 1898 1905 x, y = self.model.getProfile() 1899 1906 1900 from danse.common.plottools import Data1D 1907 from danse.common.plottools import Data1D as pf_data1d 1901 1908 #from sans.perspectives.theory.profile_dialog import SLDPanel 1902 1909 from sans.guiframe.local_perspectives.plotting.profile_dialog \ 1903 1910 import SLDPanel 1904 sld_data = Data1D(x, y)1911 sld_data = pf_data1d(x, y) 1905 1912 sld_data.name = 'SLD' 1906 1913 sld_data.axes = self.sld_axes … … 2016 2023 wx.PostEvent(self.parent, StatusEvent(status=msg)) 2017 2024 # Flag to register when a parameter has changed. 2018 is_modified = False2025 #is_modified = False 2019 2026 if tcrtl.GetValue().lstrip().rstrip() != "": 2020 2027 try: 2021 value =float(tcrtl.GetValue())2028 float(tcrtl.GetValue()) 2022 2029 tcrtl.SetBackgroundColour(wx.WHITE) 2023 2030 # If qmin and qmax have been modified, update qmin and qmax … … 2045 2052 if temp_npts != self.num_points: 2046 2053 self.num_points = temp_npts 2047 is_modified = True2054 #is_modified = True 2048 2055 else: 2049 2056 msg = "Cannot Plot :No npts in that Qrange!!! " … … 2146 2153 if form_factor != None: 2147 2154 # set multifactor for Mutifunctional models 2148 if form_factor().__class__ in self.model_list_box["Multi-Functions"]: 2155 if form_factor().__class__ in \ 2156 self.model_list_box["Multi-Functions"]: 2149 2157 m_id = self.multifactorbox.GetCurrentSelection() 2150 2158 multiplicity = form_factor().multiplicity_info[0] … … 2167 2175 # Check len of the text1 and max_multiplicity 2168 2176 text = '' 2169 if form_factor.multiplicity_info[0] == len(form_factor.multiplicity_info[2]): 2177 if form_factor.multiplicity_info[0] == \ 2178 len(form_factor.multiplicity_info[2]): 2170 2179 text = form_factor.multiplicity_info[2][self.multi_factor] 2171 2180 self.mutifactor_text1.SetLabel(text) … … 2273 2282 self.qmax.SetBackgroundColour("pink") 2274 2283 self.qmax.Refresh() 2275 msg = "Npts of Data Error :No or too little npts of %s." % data.name 2284 msg = "Npts of Data Error :" 2285 msg += "No or too little npts of %s." % data.name 2276 2286 wx.PostEvent(self.parent.parent, StatusEvent(status=msg)) 2277 2287 self.fitrange = False … … 2307 2317 self.qmax.SetBackgroundColour("pink") 2308 2318 self.qmax.Refresh() 2309 msg = "Npts of Data Error :No or too little npts of %s." % data.name 2319 msg = "Npts of Data Error :" 2320 msg += "No or too little npts of %s." % data.name 2310 2321 wx.PostEvent(self.parent.parent, StatusEvent(status=msg)) 2311 2322 self.fitrange = False … … 2389 2400 2390 2401 if name in self.model.details.keys(): 2391 2392 2402 self.model.details[name][1:3] = param_min, param_max 2403 is_modified = True 2393 2404 else: 2394 2395 2405 self.model.details[name] = ["", param_min, param_max] 2406 is_modified = True 2396 2407 try: 2397 2408 # Check if the textctr is enabled … … 2707 2718 #so that 2708 2719 # it's not lost when we use the model within another thread. 2709 #TODO: total hack - fix this2710 2720 self.state.model = self.model.clone() 2711 2721 self.model._persistency_dict[name.split('.')[0]] = \ … … 2846 2856 2847 2857 : return graphs: list of figures 2848 : TODO:Move to guiframe2858 : Need Move to guiframe 2849 2859 """ 2850 2860 # set list of graphs … … 2854 2864 gui_manager = self.parent.parent 2855 2865 # loops through the panels [dic] 2856 for item1, item2 in gui_manager.plot_panels.iteritems():2866 for _, item2 in gui_manager.plot_panels.iteritems(): 2857 2867 data_title = self.data.group_id 2858 2868 # try to get all plots belonging to this control panel … … 2874 2884 on 'More details' button 2875 2885 """ 2876 from help_panel import HelpWindow2886 from sans.perspectives.fitting.help_panel import HelpWindow 2877 2887 from sans.models import get_data_path 2878 2888 … … 2922 2932 # Figuring out key combo: Cmd for copy, Alt for paste 2923 2933 if event.CmdDown() and event.ShiftDown(): 2924 flag =self.get_paste()2934 self.get_paste() 2925 2935 elif event.CmdDown(): 2926 flag =self.get_copy()2936 self.get_copy() 2927 2937 else: 2928 2938 event.Skip() … … 2949 2959 2950 2960 # go through the parameters 2951 string = self._get_copy_helper(self.parameters,2961 strings = self._get_copy_helper(self.parameters, 2952 2962 self.orientation_params) 2953 content += string 2963 content += strings 2954 2964 2955 2965 # go through the fittables 2956 string = self._get_copy_helper(self.fittable_param,2966 strings = self._get_copy_helper(self.fittable_param, 2957 2967 self.orientation_params_disp) 2958 content += string 2968 content += strings 2959 2969 2960 2970 # go through the fixed params 2961 string = self._get_copy_helper(self.fixed_param,2971 strings = self._get_copy_helper(self.fixed_param, 2962 2972 self.orientation_params_disp) 2963 content += string 2973 content += strings 2964 2974 2965 2975 # go through the str params 2966 string = self._get_copy_helper(self.str_parameters,2976 strings = self._get_copy_helper(self.str_parameters, 2967 2977 self.orientation_params) 2968 content += string 2978 content += strings 2969 2979 return content 2970 2980 else: … … 3027 3037 3028 3038 disfunc = ',' + disfunc 3029 # TODO:to support array func for copy/paste3039 # Need to support array func for copy/paste 3030 3040 try: 3031 3041 if disfunc.count('array') > 0: … … 3052 3062 data = wx.TextDataObject() 3053 3063 # get wx dataobject 3054 success = wx.TheClipboard.GetData(data)3064 #success = wx.TheClipboard.GetData(data) 3055 3065 # get text 3056 3066 text = data.GetText() … … 3269 3279 """ 3270 3280 Method to be called by sub-classes 3271 TODO: this method doesn't belong here3281 Moveit; This method doesn't belong here 3272 3282 """ 3273 3283 print "BasicPage.update_pinhole_smear was called: skipping"
Note: See TracChangeset
for help on using the changeset viewer.