Ignore:
Timestamp:
Feb 8, 2012 5:18:11 PM (13 years ago)
Author:
Jae Cho <jhjcho@…>
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:
51da9dc
Parents:
9fafa39
Message:

Added more error msg when no return was defined n the function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • calculatorview/src/sans/perspectives/calculator/model_editor.py

    r46472c61 r0a90d92  
    428428            # No input for the model function 
    429429            if func_str.lstrip().rstrip(): 
    430                 self.write_file(self.fname, description, param_str, func_str) 
    431                 tr_msg = _compileFile(self.fname) 
    432                 msg = tr_msg.__str__() 
    433                 # Compile error 
    434                 if msg: 
    435                     _deleteFile(self.fname) 
    436                     msg +=  "\nCompile Failed" 
     430                if func_str.count('return') > 0: 
     431                    self.write_file(self.fname, description, param_str, func_str) 
     432                    tr_msg = _compileFile(self.fname) 
     433                    msg = tr_msg.__str__() 
     434                    # Compile error 
     435                    if msg: 
     436                        _deleteFile(self.fname) 
     437                        msg +=  "\nCompile Failed" 
     438                    else: 
     439                        msg = '' 
    437440                else: 
    438                     msg = '' 
     441                    msg = "Error: The func(x) must 'return' a value at least.\n" 
     442                    msg += "For example: \n\nreturn 2*x" 
    439443            else: 
    440444                msg = 'Error: Function is not defined.' 
Note: See TracChangeset for help on using the changeset viewer.