Changeset 6057915 in sasview for calculatorview/src/sans/perspectives
- Timestamp:
- Sep 5, 2012 6:23:27 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:
- 82cd844
- Parents:
- 1d490fd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/src/sans/perspectives/calculator/model_editor.py
rfe112d1a r6057915 12 12 import os 13 13 from wx.py.editwindow import EditWindow 14 import subprocess 14 15 15 16 if sys.platform.count("win32") > 0: … … 736 737 event.Skip() 737 738 info = 'Info' 739 msg = '' 738 740 # Sort out the errors if occur 739 741 if self.check_name(): … … 743 745 func_str = self.function_tcl.GetText() 744 746 # No input for the model function 745 if func_str.lstrip().rstrip(): 747 if func_str.lstrip().rstrip(): 746 748 if func_str.count('return') > 0: 747 self.write_file(self.fname, description, param_str, func_str) 749 self.write_file(self.fname, description, param_str, 750 func_str) 748 751 tr_msg = _compileFile(self.fname) 749 752 msg = tr_msg.__str__() 750 753 # Compile error 751 754 if msg: 752 _deleteFile(self.fname) 753 msg += "\nCompile Failed" 755 msg += "\nCompiling Failed" 754 756 else: 755 msg = '' 757 proc = subprocess.Popen(['python','%s'% self.fname], 758 bufsize=1, 759 stdout=subprocess.PIPE, 760 stderr=subprocess.STDOUT, 761 universal_newlines=True) 762 763 while proc.poll() is None: 764 line = proc.stdout.readline() 765 if line: 766 #the real code does filtering here 767 if line.count("Error"): 768 msg = line.rstrip() 756 769 else: 757 770 msg = "Error: The func(x) must 'return' a value at least.\n" … … 772 785 else: 773 786 info = 'Error' 774 color = 'red' 775 #wx.MessageBox(msg, info) 776 787 color = 'red' 788 try: 789 # try to remove pyc file if exists 790 #_deleteFile(self.fname) 791 _deleteFile(self.fname + "c") 792 except: 793 pass 777 794 self._msg_box.SetLabel(msg) 778 795 self._msg_box.SetForegroundColour(color) … … 906 923 leave data as it is and close 907 924 """ 908 self.parent. Close()925 self.parent.Show(False)#Close() 909 926 event.Skip() 910 927 … … 931 948 On close event 932 949 """ 933 if self.parent != None: 934 self.parent.new_model_frame = None 935 self.Destroy() 950 self.Show(False) 951 #if self.parent != None: 952 # self.parent.new_model_frame = None 953 #self.Destroy() 936 954 937 955 ## Templates for custom models
Note: See TracChangeset
for help on using the changeset viewer.