Changeset b682c6a in sasview for src/sas/sasgui/perspectives
- Timestamp:
- Aug 17, 2017 10:14:00 AM (7 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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- c9ecd1b
- Parents:
- ce2819b (diff), a06ee7e (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. - Location:
- src/sas/sasgui/perspectives
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/calculator/model_editor.py
ra1b8fee r07ec714 643 643 self.name_hsizer = None 644 644 self.name_tcl = None 645 self.overwrite_cb = None 645 646 self.desc_sizer = None 646 647 self.desc_tcl = None … … 657 658 self.warning = "" 658 659 #This does not seem to be used anywhere so commenting out for now 659 # -- PDB 2/26/17 660 # -- PDB 2/26/17 660 661 #self._description = "New Plugin Model" 661 662 self.function_tcl = None … … 689 690 #title name [string] 690 691 name_txt = wx.StaticText(self, -1, 'Function Name : ') 691 overwrite_cb = wx.CheckBox(self, -1, "Overwrite existing plugin model of this name?", (10, 10))692 overwrite_cb.SetValue(False)693 overwrite_cb.SetToolTipString("Overwrite it if already exists?")694 wx.EVT_CHECKBOX(self, overwrite_cb.GetId(), self.on_over_cb)692 self.overwrite_cb = wx.CheckBox(self, -1, "Overwrite existing plugin model of this name?", (10, 10)) 693 self.overwrite_cb.SetValue(False) 694 self.overwrite_cb.SetToolTipString("Overwrite it if already exists?") 695 wx.EVT_CHECKBOX(self, self.overwrite_cb.GetId(), self.on_over_cb) 695 696 self.name_tcl = wx.TextCtrl(self, -1, size=(PANEL_WIDTH * 3 / 5, -1)) 696 697 self.name_tcl.Bind(wx.EVT_TEXT_ENTER, self.on_change_name) … … 700 701 self.name_tcl.SetToolTipString(hint_name) 701 702 self.name_hsizer.AddMany([(self.name_tcl, 0, wx.LEFT | wx.TOP, 0), 702 ( overwrite_cb, 0, wx.LEFT, 20)])703 (self.overwrite_cb, 0, wx.LEFT, 20)]) 703 704 self.name_sizer.AddMany([(name_txt, 0, wx.LEFT | wx.TOP, 10), 704 705 (self.name_hsizer, 0, … … 740 741 self.param_sizer.AddMany([(param_txt, 0, wx.LEFT, 10), 741 742 (self.param_tcl, 1, wx.EXPAND | wx.ALL, 10)]) 742 743 743 744 # Parameters with polydispersity 744 745 pd_param_txt = wx.StaticText(self, -1, 'Fit Parameters requiring ' + \ … … 755 756 self.pd_param_tcl.setDisplayLineNumbers(True) 756 757 self.pd_param_tcl.SetToolTipString(pd_param_tip) 757 758 758 759 self.param_sizer.AddMany([(pd_param_txt, 0, wx.LEFT, 10), 759 760 (self.pd_param_tcl, 1, wx.EXPAND | wx.ALL, 10)]) … … 995 996 info = 'Error' 996 997 color = 'red' 998 self.overwrite_cb.SetValue(True) 999 self.overwrite_name = True 997 1000 else: 998 1001 self._notes = result … … 1030 1033 if has_scipy: 1031 1034 lines.insert(0, 'import scipy') 1032 1033 # Think about 2D later 1035 1036 # Think about 2D later 1034 1037 #self.is_2d = func_str.count("#self.ndim = 2") 1035 1038 #line_2d = '' 1036 1039 #if self.is_2d: 1037 1040 # line_2d = CUSTOM_2D_TEMP.split('\n') 1038 1039 # Also think about test later 1041 1042 # Also think about test later 1040 1043 #line_test = TEST_TEMPLATE.split('\n') 1041 1044 #local_params = '' … … 1043 1046 spaces4 = ' '*4 1044 1047 spaces13 = ' '*13 1045 spaces16 = ' '*16 1048 spaces16 = ' '*16 1046 1049 param_names = [] # to store parameter names 1047 1050 has_scipy = func_str.count("scipy.") … … 1055 1058 out_f.write(line + '\n') 1056 1059 if line.count('#name'): 1057 out_f.write('name = "%s" \n' % name) 1060 out_f.write('name = "%s" \n' % name) 1058 1061 elif line.count('#title'): 1059 out_f.write('title = "User model for %s"\n' % name) 1062 out_f.write('title = "User model for %s"\n' % name) 1060 1063 elif line.count('#description'): 1061 out_f.write('description = "%s"\n' % desc_str) 1064 out_f.write('description = "%s"\n' % desc_str) 1062 1065 elif line.count('#parameters'): 1063 1066 out_f.write('parameters = [ \n') … … 1065 1068 p_line = param_line.lstrip().rstrip() 1066 1069 if p_line: 1067 pname, pvalue = self.get_param_helper(p_line)1070 pname, pvalue, desc = self.get_param_helper(p_line) 1068 1071 param_names.append(pname) 1069 out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], '', ' '],\n" % (spaces16, pname, pvalue))1072 out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], '', '%s'],\n" % (spaces16, pname, pvalue, desc)) 1070 1073 for param_line in pd_param_str.split('\n'): 1071 1074 p_line = param_line.lstrip().rstrip() 1072 1075 if p_line: 1073 pname, pvalue = self.get_param_helper(p_line)1076 pname, pvalue, desc = self.get_param_helper(p_line) 1074 1077 param_names.append(pname) 1075 out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], 'volume', ' '],\n" % (spaces16, pname, pvalue))1078 out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], 'volume', '%s'],\n" % (spaces16, pname, pvalue, desc)) 1076 1079 out_f.write('%s]\n' % spaces13) 1077 1080 1078 1081 # No form_volume or ER available in simple model editor 1079 1082 out_f.write('def form_volume(*arg): \n') … … 1082 1085 out_f.write('def ER(*arg): \n') 1083 1086 out_f.write(' return 1.0 \n') 1084 1087 1085 1088 # function to compute 1086 1089 out_f.write('\n') … … 1091 1094 for func_line in func_str.split('\n'): 1092 1095 out_f.write('%s%s\n' % (spaces4, func_line)) 1093 1096 1094 1097 Iqxy_string = 'return Iq(numpy.sqrt(x**2+y**2) ' 1095 1098 1096 1099 out_f.write('\n') 1097 1100 out_f.write('def Iqxy(x, y ') … … 1113 1116 items = line.split(";") 1114 1117 for item in items: 1115 name = item.split("=")[0].lstrip().rstrip() 1118 name = item.split("=")[0].strip() 1119 description = "" 1116 1120 try: 1117 value = item.split("=")[1].lstrip().rstrip() 1121 value = item.split("=")[1].strip() 1122 if value.count("#"): 1123 # If line ends in a comment, remove it before parsing float 1124 index = value.index("#") 1125 description = value[(index + 1):].strip() 1126 value = value[:value.index("#")].strip() 1118 1127 float(value) 1119 except :1128 except ValueError: 1120 1129 value = 1.0 # default 1121 1130 1122 return name, value 1131 return name, value, description 1123 1132 1124 1133 def set_function_helper(self, line): … … 1204 1213 import numpy 1205 1214 1206 #name 1215 #name 1207 1216 1208 1217 #title … … 1210 1219 #description 1211 1220 1212 #parameters 1221 #parameters 1213 1222 1214 1223 """ -
src/sas/sasgui/perspectives/calculator/pyconsole.py
r7432acb r4627657 37 37 Iqxy = model.evalDistribution([qx, qy]) 38 38 39 result = """ 40 Iq(%s) = %s 41 Iqxy(%s, %s) = %s 42 """%(q, Iq, qx, qy, Iqxy) 39 # check the model's unit tests run 40 from sasmodels.model_test import run_one 41 result = run_one(path) 43 42 44 43 return result … … 89 88 ok = wx.Button(self, wx.ID_OK, "OK") 90 89 91 # Mysterious constraint layouts from 90 # Mysterious constraint layouts from 92 91 # https://www.wxpython.org/docs/api/wx.lib.layoutf.Layoutf-class.html 93 92 lc = layoutf.Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok)) -
src/sas/sasgui/perspectives/fitting/fitting.py
ra534432 r489f53a 257 257 toks = os.path.splitext(label) 258 258 path = os.path.join(models.find_plugins_dir(), toks[0]) 259 message = "Are you sure you want to delete the file {}?".format(path) 260 dlg = wx.MessageDialog(self.frame, message, '', wx.YES_NO | wx.ICON_QUESTION) 261 if not dlg.ShowModal() == wx.ID_YES: 262 return 259 263 try: 260 264 for ext in ['.py', '.pyc']: 261 265 p_path = path + ext 266 if ext == '.pyc' and not os.path.isfile(path + ext): 267 # If model is invalid, .pyc file may not exist as model has 268 # never been compiled. Don't try and delete it 269 continue 262 270 os.remove(p_path) 263 271 self.update_custom_combo() … … 361 369 'Add a new model function') 362 370 wx.EVT_MENU(owner, wx_id, self.make_new_model) 363 371 364 372 wx_id = wx.NewId() 365 373 self.edit_model_menu.Append(wx_id, 'Sum|Multi(p1, p2)', … … 383 391 '(Re)Load all models present in user plugin_models folder') 384 392 wx.EVT_MENU(owner, wx_id, self.load_plugin_models) 385 393 386 394 def set_edit_menu_helper(self, owner=None, menu=None): 387 395 """ … … 1734 1742 @param unsmeared_error: data error, rescaled to unsmeared model 1735 1743 """ 1736 1737 number_finite = np.count_nonzero(np.isfinite(y)) 1744 1745 number_finite = np.count_nonzero(np.isfinite(y)) 1738 1746 np.nan_to_num(y) 1739 1747 new_plot = self.create_theory_1D(x, y, page_id, model, data, state, … … 1794 1802 msg = "Computing Error: Model did not return any finite value." 1795 1803 wx.PostEvent(self.parent, StatusEvent(status = msg, info="error")) 1796 else: 1804 else: 1797 1805 msg = "Computation completed!" 1798 1806 if number_finite != y.size: … … 1824 1832 that can be plot. 1825 1833 """ 1826 number_finite = np.count_nonzero(np.isfinite(image)) 1834 number_finite = np.count_nonzero(np.isfinite(image)) 1827 1835 np.nan_to_num(image) 1828 1836 new_plot = Data2D(image=image, err_image=data.err_data) … … 1927 1935 ## and may be the cause of other noted instabilities 1928 1936 ## 1929 ## -PDB August 12, 2014 1937 ## -PDB August 12, 2014 1930 1938 while self.calc_2D.isrunning(): 1931 1939 time.sleep(0.1) … … 1969 1977 if (self.calc_1D is not None) and self.calc_1D.isrunning(): 1970 1978 self.calc_1D.stop() 1971 ## stop just raises the flag -- the thread is supposed to 1979 ## stop just raises the flag -- the thread is supposed to 1972 1980 ## then kill itself but cannot. Paul Kienzle came up with 1973 1981 ## this fix to prevent threads from stepping on each other … … 1981 1989 ## a request to stop the computation. 1982 1990 ## It seems thus that the whole thread approach used here 1983 ## May need rethinking 1991 ## May need rethinking 1984 1992 ## 1985 1993 ## -PDB August 12, 2014 … … 2146 2154 residuals.dxw = None 2147 2155 residuals.ytransform = 'y' 2148 # For latter scale changes 2156 # For latter scale changes 2149 2157 residuals.xaxis('\\rm{Q} ', 'A^{-1}') 2150 2158 residuals.yaxis('\\rm{Residuals} ', 'normalized') -
src/sas/sasgui/perspectives/fitting/models.py
r146c669 rb682c6a 187 187 try: 188 188 model = load_custom_model(path) 189 model.name = PLUGIN_NAME_BASE + model.name 189 if not model.name.count(PLUGIN_NAME_BASE): 190 model.name = PLUGIN_NAME_BASE + model.name 190 191 plugins[model.name] = model 191 192 except Exception: … … 300 301 for name, plug in self.stored_plugins.iteritems(): 301 302 self.model_dictionary[name] = plug 302 303 303 304 self._get_multifunc_models() 304 305 -
src/sas/sasgui/perspectives/pr/inversion_panel.py
r7432acb rcb62bd5 70 70 self.rg_ctl = None 71 71 self.iq0_ctl = None 72 self.bck_chk = None 72 self.bck_value = None 73 self.bck_est_ctl = None 74 self.bck_man_ctl = None 75 self.est_bck = True 76 self.bck_input = None 73 77 self.bck_ctl = None 74 78 … … 312 316 # Read the panel's parameters 313 317 flag, alpha, dmax, nfunc, qmin, \ 314 qmax, height, width = self._read_pars()318 qmax, height, width, bck = self._read_pars() 315 319 316 320 state.nfunc = nfunc … … 326 330 327 331 # Background evaluation checkbox 328 state.estimate_bck = self.bck_chk.IsChecked() 332 state.estimate_bck = self.est_bck 333 state.bck_value = bck 329 334 330 335 # Estimates … … 371 376 self.plot_data.SetValue(str(state.file)) 372 377 373 # Background evaluation checkbox 374 self.bck_chk.SetValue(state.estimate_bck) 378 # Background value 379 self.bck_est_ctl.SetValue(state.estimate_bck) 380 self.bck_man_ctl.SetValue(not state.estimate_bck) 381 if not state.estimate_bck: 382 self.bck_input.Enable() 383 self.bck_input.SetValue(str(state.bck_value)) 384 self.est_bck = state.estimate_bck 385 self.bck_value = state.bck_value 375 386 376 387 # Estimates … … 431 442 wx.EXPAND | wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 15) 432 443 433 self.bck_chk = wx.CheckBox(self, -1, "Estimate background level") 434 hint_msg = "Check box to let the fit estimate " 435 hint_msg += "the constant background level." 436 self.bck_chk.SetToolTipString(hint_msg) 437 self.bck_chk.Bind(wx.EVT_CHECKBOX, self._on_pars_changed) 444 radio_sizer = wx.GridBagSizer(5, 5) 445 446 self.bck_est_ctl = wx.RadioButton(self, -1, "Estimate background level", 447 name="estimate_bck", style=wx.RB_GROUP) 448 self.bck_man_ctl = wx.RadioButton(self, -1, "Input manual background level", 449 name="manual_bck") 450 451 self.bck_est_ctl.Bind(wx.EVT_RADIOBUTTON, self._on_bck_changed) 452 self.bck_man_ctl.Bind(wx.EVT_RADIOBUTTON, self._on_bck_changed) 453 454 radio_sizer.Add(self.bck_est_ctl, (0,0), (1,1), wx.LEFT | wx.EXPAND) 455 radio_sizer.Add(self.bck_man_ctl, (0,1), (1,1), wx.RIGHT | wx.EXPAND) 456 438 457 iy += 1 439 pars_sizer.Add( self.bck_chk, (iy, 0), (1, 2),458 pars_sizer.Add(radio_sizer, (iy, 0), (1, 2), 440 459 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 460 461 background_label = wx.StaticText(self, -1, "Background: ") 462 self.bck_input = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, 463 size=(60, 20), value="0.0") 464 self.bck_input.Disable() 465 self.bck_input.Bind(wx.EVT_TEXT, self._read_pars) 466 background_units = wx.StaticText(self, -1, "[A^(-1)]", size=(55, 20)) 467 iy += 1 468 469 background_sizer = wx.GridBagSizer(5, 5) 470 471 background_sizer.Add(background_label, (0, 0), (1,1), 472 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 23) 473 background_sizer.Add(self.bck_input, (0, 1), (1,1), 474 wx.LEFT | wx.ADJUST_MINSIZE, 5) 475 background_sizer.Add(background_units, (0, 2), (1,1), 476 wx.LEFT | wx.ADJUST_MINSIZE, 5) 477 pars_sizer.Add(background_sizer, (iy, 0), (1, 2), 478 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 479 441 480 boxsizer1.Add(pars_sizer, 0, wx.EXPAND) 442 481 vbox.Add(boxsizer1, (iy_vb, 0), (1, 1), … … 764 803 self._on_pars_changed() 765 804 805 def _on_bck_changed(self, evt=None): 806 self.est_bck = self.bck_est_ctl.GetValue() 807 if self.est_bck: 808 self.bck_input.Disable() 809 else: 810 self.bck_input.Enable() 811 766 812 def _on_pars_changed(self, evt=None): 767 813 """ … … 770 816 scenes. 771 817 """ 772 flag, alpha, dmax, nfunc, qmin, qmax, height, width = self._read_pars() 773 has_bck = self.bck_chk.IsChecked() 818 flag, alpha, dmax, nfunc, qmin, qmax, height, width, bck = self._read_pars() 774 819 775 820 # If the pars are valid, estimate alpha … … 783 828 d_max=dmax, 784 829 q_min=qmin, q_max=qmax, 785 bck=has_bck, 830 est_bck=self.est_bck, 831 bck_val=bck, 786 832 height=height, 787 833 width=width) … … 797 843 height = 0 798 844 width = 0 845 background = 0 799 846 flag = True 800 847 # Read slit height … … 890 937 self.qmax_ctl.Refresh() 891 938 892 return flag, alpha, dmax, nfunc, qmin, qmax, height, width 939 # Read background 940 if not self.est_bck: 941 try: 942 bck_str = self.bck_input.GetValue() 943 if len(bck_str.strip()) == 0: 944 background = 0.0 945 else: 946 background = float(bck_str) 947 self.bck_input.SetBackgroundColour(wx.WHITE) 948 except ValueError: 949 background = 0.0 950 self.bck_input.SetBackgroundColour("pink") 951 self.bck_input.Refresh() 952 953 return flag, alpha, dmax, nfunc, qmin, qmax, height, width, background 893 954 894 955 def _on_explore(self, evt): … … 915 976 # Push it to the manager 916 977 917 flag, alpha, dmax, nfunc, qmin, qmax, height, width = self._read_pars() 918 has_bck = self.bck_chk.IsChecked() 978 flag, alpha, dmax, nfunc, qmin, qmax, height, width, bck = self._read_pars() 919 979 920 980 if flag: … … 928 988 d_max=dmax, 929 989 q_min=qmin, q_max=qmax, 930 bck=has_bck, 990 est_bck=self.est_bck, 991 bck_val = bck, 931 992 height=height, 932 993 width=width) -
src/sas/sasgui/perspectives/pr/inversion_state.py
r7432acb ra0e6b1b 36 36 ["qmin", "qmin"], 37 37 ["qmax", "qmax"], 38 ["estimate_bck", "estimate_bck"]] 38 ["estimate_bck", "estimate_bck"], 39 ["bck_value", "bck_value"]] 39 40 40 41 ## List of P(r) inversion outputs … … 62 63 self.estimate_bck = False 63 64 self.timestamp = time.time() 65 self.bck_value = 0.0 64 66 65 67 # Inversion parameters … … 109 111 state += "Timestamp: %s\n" % self.timestamp 110 112 state += "Estimate bck: %s\n" % str(self.estimate_bck) 113 state += "Bck Value: %s\n" % str(self.bck_value) 111 114 state += "No. terms: %s\n" % str(self.nfunc) 112 115 state += "D_max: %s\n" % str(self.d_max) … … 296 299 self.coefficients.append(float(c)) 297 300 except: 298 # Bad data, skip. We will count the number of 299 # coefficients at the very end and deal with 301 # Bad data, skip. We will count the number of 302 # coefficients at the very end and deal with 300 303 # inconsistencies then. 301 304 pass … … 329 332 cov_row.append(float(c)) 330 333 except: 331 # Bad data, skip. We will count the number of 332 # coefficients at the very end and deal with 334 # Bad data, skip. We will count the number of 335 # coefficients at the very end and deal with 333 336 # inconsistencies then. 334 337 pass … … 461 464 tree = etree.parse(path, parser=etree.ETCompatXMLParser()) 462 465 # Check the format version number 463 # Specifying the namespace will take care of the file 464 #format version 466 # Specifying the namespace will take care of the file 467 #format version 465 468 root = tree.getroot() 466 469 -
src/sas/sasgui/perspectives/pr/media/pr_help.rst
r1221196 r1abd19c 49 49 P(r) inversion requires that the background be perfectly subtracted. This is 50 50 often difficult to do well and thus many data sets will include a background. 51 For those cases, the user should check the "estimate background" box and the 52 module will do its best to estimate it. 51 For those cases, the user should check the "Estimate background level" option 52 and the module will do its best to estimate it. If you know the background value 53 for your data, select the "Input manual background level" option. Note that 54 this value will be treated as having 0 error. 53 55 54 56 The P(r) module is constantly computing in the background what the optimum -
src/sas/sasgui/perspectives/pr/pr.py
ra1b8fee rcb62bd5 68 68 self.q_min = None 69 69 self.q_max = None 70 self.has_bck = False 70 self.est_bck = False 71 self.bck_val = 0 71 72 self.slit_height = 0 72 73 self.slit_width = 0 … … 828 829 self.control_panel.iq0 = pr.iq0(out) 829 830 self.control_panel.bck = pr.background 831 self.control_panel.bck_input.SetValue("{:.2g}".format(pr.background)) 830 832 831 833 # Show I(q) fit … … 907 909 908 910 def setup_plot_inversion(self, alpha, nfunc, d_max, q_min=None, q_max=None, 909 bck=False, height=0, width=0):911 est_bck=False, bck_val=0, height=0, width=0): 910 912 """ 911 913 Set up inversion from plotted data … … 916 918 self.q_min = q_min 917 919 self.q_max = q_max 918 self.has_bck = bck 920 self.est_bck = est_bck 921 self.bck_val = bck_val 919 922 self.slit_height = height 920 923 self.slit_width = width … … 930 933 def estimate_plot_inversion(self, alpha, nfunc, d_max, 931 934 q_min=None, q_max=None, 932 bck=False, height=0, width=0):935 est_bck=False, bck_val=0, height=0, width=0): 933 936 """ 934 937 Estimate parameters from plotted data … … 939 942 self.q_min = q_min 940 943 self.q_max = q_max 941 self.has_bck = bck 944 self.est_bck = est_bck 945 self.bck_val = bck_val 942 946 self.slit_height = height 943 947 self.slit_width = width … … 973 977 pr.x = self.current_plottable.x 974 978 pr.y = self.current_plottable.y 975 pr. has_bck = self.has_bck979 pr.est_bck = self.est_bck 976 980 pr.slit_height = self.slit_height 977 981 pr.slit_width = self.slit_width 982 pr.background = self.bck_val 978 983 979 984 # Keep track of the plot window title to ensure that … … 1019 1024 self.q_min = q_min 1020 1025 self.q_max = q_max 1021 self. has_bck = bck1026 self.est_bck = bck 1022 1027 self.slit_height = height 1023 1028 self.slit_width = width … … 1042 1047 self.q_min = q_min 1043 1048 self.q_max = q_max 1044 self. has_bck = bck1049 self.est_bck = bck 1045 1050 self.slit_height = height 1046 1051 self.slit_width = width … … 1115 1120 pr.y = y 1116 1121 pr.err = err 1117 pr. has_bck = self.has_bck1122 pr.est_bck = self.est_bck 1118 1123 pr.slit_height = self.slit_height 1119 1124 pr.slit_width = self.slit_width -
src/sas/sasgui/perspectives/fitting/fitpage.py
red2276f r6a455cd3 1236 1236 wx.PostEvent(self.parent, new_event) 1237 1237 # update list of plugins if new plugin is available 1238 custom_model = CUSTOM_MODEL1239 1238 mod_cat = self.categorybox.GetStringSelection() 1240 if mod_cat == custom_model: 1239 if mod_cat == CUSTOM_MODEL: 1240 temp_id = self.model.id 1241 1241 temp = self.parent.update_model_list() 1242 for v in self.parent.model_dictionary.values(): 1243 if v.id == temp_id: 1244 self.model = v() 1245 break 1242 1246 if temp: 1243 1247 self.model_list_box = temp -
src/sas/sasgui/perspectives/fitting/fitpanel.py
r67b0a99 rd79feea 92 92 # state must be cloned 93 93 state = page.get_state().clone() 94 if data is not None or page.model is not None: 94 # data_list only populated with real data 95 # Fake object in data from page.get_data() if model is selected 96 if len(page.data_list) is not 0 and page.model is not None: 95 97 new_doc = self._manager.state_reader.write_toXML(data, 96 98 state, 97 99 batch_state) 100 # Fit #2 through #n are append to first fit 98 101 if doc is not None and hasattr(doc, "firstChild"): 99 child = new_doc.firstChild.firstChild 100 doc.firstChild.appendChild(child) 102 # Only append if properly formed new_doc 103 if new_doc is not None and hasattr(new_doc, "firstChild"): 104 child = new_doc.firstChild.firstChild 105 doc.firstChild.appendChild(child) 106 # First fit defines the main document 101 107 else: 102 108 doc = new_doc … … 395 401 temp_data = page.get_data() 396 402 if temp_data is not None and temp_data.id in data: 397 self.SetSelection(pos) 398 self.on_close_page(event=None) 399 temp = self.GetSelection() 400 self.DeletePage(temp) 403 self.close_page_with_data(temp_data) 401 404 if self.sim_page is not None: 402 405 if len(self.sim_page.model_list) == 0: … … 405 408 self.on_close_page(event=None) 406 409 temp = self.GetSelection() 407 self.DeletePage( temp)410 self.DeletePage(pos) 408 411 self.sim_page = None 409 412 self.batch_on = False
Note: See TracChangeset
for help on using the changeset viewer.