Changeset 26d6e045 in sasview for src/sas/sasgui/perspectives/calculator/model_editor.py
- Timestamp:
- May 20, 2016 8:37:21 PM (9 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:
- 5dfbb24
- Parents:
- cd54205
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/calculator/model_editor.py
rcb4ef58 r26d6e045 30 30 from wx.py.editwindow import EditWindow 31 31 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 32 from .pyconsole import show_model_output, check_model 32 33 33 34 … … 45 46 PANEL_WIDTH = 500 46 47 _BOX_WIDTH = 55 47 48 49 def _compile_file(path):50 """51 Compile the file in the path52 """53 try:54 import py_compile55 py_compile.compile(file=path, doraise=True)56 return ''57 except:58 _, value, _ = sys.exc_info()59 return value60 48 61 49 def _delete_file(path): … … 384 372 name2 = label[1] 385 373 self.write_string(fname, name1, name2) 386 self.compile_file(fname) 387 self.parent.update_custom_combo() 374 success = show_model_output(self, fname) 375 if success: 376 self.parent.update_custom_combo() 388 377 msg = self._notes 389 378 info = 'Info' … … 618 607 """ 619 608 path = self.fname 620 _compile_file(path)609 show_model_output(self, path) 621 610 622 611 def delete_file(self, path): … … 954 943 info = 'Info' 955 944 msg = '' 945 result, check_err = '', '' 956 946 # Sort out the errors if occur 957 947 # First check for valid python name then if the name already exists … … 969 959 self.write_file(self.fname, name, description, param_str, 970 960 pd_param_str, func_str) 961 try: 962 result, msg = check_model(self.fname), None 963 except Exception: 964 import traceback 965 result, msg = None, "error building model" 966 check_err = "\n"+traceback.format_exc(limit=2) 967 971 968 # Modified compiling test, as it will fail for sasmodels.sasview_model class 972 969 # Should add a test to check that the class is correctly built … … 1031 1028 color = 'red' 1032 1029 else: 1033 msg = "Successful! " 1030 self._notes = result 1031 msg = "Successful! Please look for %s in Customized Models."%name 1034 1032 msg += " " + self._notes 1035 msg += " Please look for it in the Customized Models."1036 1033 info = 'Info' 1037 1034 color = 'blue' … … 1041 1038 if self.base != None: 1042 1039 from sas.sasgui.guiframe.events import StatusEvent 1043 wx.PostEvent(self.base.parent, StatusEvent(status=msg, info=info)) 1040 wx.PostEvent(self.base.parent, 1041 StatusEvent(status=msg+check_err, info=info)) 1044 1042 self.warning = msg 1045 1043
Note: See TracChangeset
for help on using the changeset viewer.