Changeset 0ed400d in sasview for calculatorview/src/sans/perspectives/calculator
- Timestamp:
- Sep 6, 2012 3:17:00 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:
- 7034fc0
- Parents:
- 82cd844
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/src/sans/perspectives/calculator/model_editor.py
r82cd844 r0ed400d 750 750 func_str) 751 751 tr_msg = _compileFile(self.fname) 752 msg = tr_msg.__str__()752 msg = str(tr_msg.__str__()) 753 753 # Compile error 754 754 if msg: 755 msg.replace(" ", "\n") 755 756 msg += "\nCompiling Failed" 756 else:757 proc = subprocess.Popen(['python','%s'% self.fname],758 bufsize=1,759 stdout=subprocess.PIPE,760 stderr=subprocess.STDOUT,761 universal_newlines=True,762 shell=False)763 while proc.poll() is None:764 line = proc.stdout.readline()765 if line:766 #the real code does filtering here767 if line.count("Error"):768 msg = line.rstrip()769 757 else: 770 758 msg = "Error: The func(x) must 'return' a value at least.\n" … … 775 763 msg = "Name exists already." 776 764 # Prepare for the messagebox 777 if not msg: 778 if self.base != None: 779 self.base.update_custom_combo() 780 msg = "Successful!!!" 781 msg += " " + self._notes 782 msg += " Please look for it in the 'Customized Models' box." 783 info = 'Info' 784 color = 'blue' 785 else: 765 if self.base != None and not msg: 766 self.base.update_custom_combo() 767 Model = None 768 exec "from %s import Model"% name 769 try: 770 Model().run(0.01) 771 except: 772 msg = "Error " 773 _, value, _ = sys.exc_info() 774 msg += "in %s:\n%s\n" % (name, value) 775 if msg: 786 776 info = 'Error' 787 777 color = 'red' … … 792 782 except: 793 783 pass 794 self._msg_box.SetLabel(msg) 784 else: 785 msg = "Successful!!!" 786 msg += " " + self._notes 787 msg += " Please look for it in the 'Customized Models' box." 788 info = 'Info' 789 color = 'blue' 790 # Not to display long error msg 791 if info == 'Error': 792 mss = info 793 else: 794 mss = msg 795 self._msg_box.SetLabel(mss) 795 796 self._msg_box.SetForegroundColour(color) 796 797 # Send msg to the top window
Note: See TracChangeset
for help on using the changeset viewer.