mailr22190 - in /branches/double_rotor: ./ lib/errors.py lib/warnings.py prompt/interpreter.py relax.py status.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on February 14, 2014 - 14:32:
Author: bugman
Date: Fri Feb 14 14:32:41 2014
New Revision: 22190

URL: http://svn.gna.org/viewcvs/relax?rev=22190&view=rev
Log:
Merged revisions 22181-22189 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r22181 | tlinnet | 2014-02-14 10:32:15 +0100 (Fri, 14 Feb 2014) | 3 lines
  
  Shifted the pedantic flag to escalate flag. The option -p would insted be 
used for the option --prompt.
  
  Fix for sr #3117, (https://gna.org/support/?3117) - Functionality to 
inspect interactively after running script - The equivalence to python -i
........
  r22182 | tlinnet | 2014-02-14 10:32:17 +0100 (Fri, 14 Feb 2014) | 3 lines
  
  Added the -p --prompt option for running a relax script and inspect 
interactively.
  
  Fix for sr #3117, (https://gna.org/support/?3117) - Functionality to 
inspect interactively after running script - The equivalence to python -i
........
  r22183 | tlinnet | 2014-02-14 11:22:56 +0100 (Fri, 14 Feb 2014) | 1 line
  
  Second
........
  r22184 | tlinnet | 2014-02-14 11:22:57 +0100 (Fri, 14 Feb 2014) | 6 lines
  
  Modified the help text to explain that -p will launch relax in prompt mode 
after running any optionally supplied scripts.
  
  Fix for sr #3117, (https://gna.org/support/?3117) - Functionality to 
inspect interactively after running script - The equivalence to python -i
  
  This is to allow the -p --prompt option to be given without a script. relax 
should support this so that a user doesn't get too confused when
  trying to start in prompt mode with the --prompt flag and support the 
--prompt argument without a script being supplied.
........
  r22185 | tlinnet | 2014-02-14 11:47:33 +0100 (Fri, 14 Feb 2014) | 22 lines
  
  Manually reverted the temporary change of r22184 and 22183.
  
  The command used was:
  
  svn merge -r22184:r22182 .
  
  .....
  r22184 | tlinnet | 2014-02-14 11:22:57 +0100 (Fri, 14 Feb 2014) | 6 lines
  
  Modified the help text to explain that -p will launch relax in prompt mode 
after running any optionally supplied scripts.
  
  Fix for sr #3117, (https://gna.org/support/?3117) - Functionality to 
inspect interactively after running script - The equivalence to python -i
  
  This is to allow the -p --prompt option to be given without a script. relax 
should support this so that a user doesn't get too confused when
  trying to start in prompt mode with the --prompt flag and support the 
--prompt argument without a script being supplied.
  ------------------------------------------------------------------------
  r22183 | tlinnet | 2014-02-14 11:22:56 +0100 (Fri, 14 Feb 2014) | 1 line
  
  Second
  .....
........
  r22186 | tlinnet | 2014-02-14 11:54:44 +0100 (Fri, 14 Feb 2014) | 6 lines
  
  Modified the help text to explain that -p will launch relax in prompt mode 
after running any optionally supplied scripts.
  
  Fix for sr #3117, (https://gna.org/support/?3117) - Functionality to 
inspect interactively after running script - The equivalence to python -i
  
  This is to allow the -p --prompt option to be given without a script. relax 
should support this so that a user doesn't get too confused when
  trying to start in prompt mode with the --prompt flag and support the 
--prompt argument without a script being supplied.
........
  r22187 | tlinnet | 2014-02-14 12:13:05 +0100 (Fri, 14 Feb 2014) | 6 lines
  
  Finished implementing the functionality of interacting with variables after 
executing a script.
  
  Fix for sr #3117, (https://gna.org/support/?3117) - Functionality to 
inspect interactively after running script - The equivalence to python -i
  
  For getting access to variables after executing a script, the variable 
should be saved under: cdp.X, where X define a container.
  The name space issue is discussed in: 
http://thread.gmane.org/gmane.science.nmr.relax.devel/5012
........
  r22188 | tlinnet | 2014-02-14 12:28:25 +0100 (Fri, 14 Feb 2014) | 3 lines
  
  Added Copyright info to modified file.
  
  Fix for sr #3117, (https://gna.org/support/?3117) - Functionality to 
inspect interactively after running script - The equivalence to python -i
........
  r22189 | bugman | 2014-02-14 14:24:25 +0100 (Fri, 14 Feb 2014) | 8 lines
  
  Organisation of the relax command line options into distinct groups.
  
  This follows from the message at 
http://thread.gmane.org/gmane.science.nmr.relax.devel/5024.
  
  The optparse.OptionGroup object is now used to cluster the arguments.  This 
cleans up the output of
  'relax -h' and explains the options to the user in a clearer way.
........

Modified:
    branches/double_rotor/   (props changed)
    branches/double_rotor/lib/errors.py
    branches/double_rotor/lib/warnings.py
    branches/double_rotor/prompt/interpreter.py
    branches/double_rotor/relax.py
    branches/double_rotor/status.py

Propchange: branches/double_rotor/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Feb 14 14:32:41 2014
@@ -1,1 +1,1 @@
-/trunk:1-22179
+/trunk:1-22189

Modified: branches/double_rotor/lib/errors.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/double_rotor/lib/errors.py?rev=22190&r1=22189&r2=22190&view=diff
==============================================================================
--- branches/double_rotor/lib/errors.py (original)
+++ branches/double_rotor/lib/errors.py Fri Feb 14 14:32:41 2014
@@ -131,9 +131,9 @@
     def __str__(self):
         """Modify the behaviour of the error system."""
 
-        # Save the state if the pedantic flag is turned on.
+        # Save the state if the escalate flag is turned on.
         from status import Status; status = Status()
-        if status.pedantic:
+        if status.escalate:
             save_state()
 
         # Modify the error message to include 'RelaxError' at the start 
(using coloured text if a TTY).

Modified: branches/double_rotor/lib/warnings.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/double_rotor/lib/warnings.py?rev=22190&r1=22189&r2=22190&view=diff
==============================================================================
--- branches/double_rotor/lib/warnings.py (original)
+++ branches/double_rotor/lib/warnings.py Fri Feb 14 14:32:41 2014
@@ -39,8 +39,8 @@
     # Add the text 'RelaxWarning: ' to the start of the warning message.
     message = "RelaxWarning: %s\n" % message
 
-    # Print stack-trace in pedantic mode.
-    if status.pedantic:
+    # Print stack-trace in escalate mode.
+    if status.escalate:
         tb = ""
         for frame in inspect.stack()[4:]:
             file = frame[1]
@@ -77,7 +77,7 @@
     warnings.formatwarning = format
 
     # Set warning filters.
-    if status.pedantic:
+    if status.escalate:
         warnings.filterwarnings('error', category=BaseWarning)
     else:
         warnings.filterwarnings('always', category=BaseWarning)

Modified: branches/double_rotor/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/double_rotor/prompt/interpreter.py?rev=22190&r1=22189&r2=22190&view=diff
==============================================================================
--- branches/double_rotor/prompt/interpreter.py (original)
+++ branches/double_rotor/prompt/interpreter.py Fri Feb 14 14:32:41 2014
@@ -1,6 +1,7 @@
 
###############################################################################
 #                                                                            
 #
 # Copyright (C) 2003-2014 Edward d'Auvergne                                  
 #
+# Copyright (C) 2014 Troels E. Linnet                                        
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -266,12 +267,17 @@
             readline.parse_and_bind("tab: complete")
 
         # Execute the script file if given.
-        if script_file:
+        if script_file and not status.prompt:
             # Turn on the user function intro flag.
             status.uf_intro = True
 
             # Run the script.
             return run_script(intro=self.__intro_string, local=locals(), 
script_file=script_file, show_script=self.__show_script, 
raise_relax_error=self.__raise_relax_error)
+
+        # Execute the script and go into prompt if the interactive flag -p 
--prompt is given at startup.
+        if script_file and status.prompt:
+            run_script(intro=self.__intro_string, local=locals(), 
script_file=script_file, show_script=self.__show_script, 
raise_relax_error=self.__raise_relax_error)
+            prompt(intro=None, local=locals())
 
         # Go to the prompt.
         else:

Modified: branches/double_rotor/relax.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/double_rotor/relax.py?rev=22190&r1=22189&r2=22190&view=diff
==============================================================================
--- branches/double_rotor/relax.py (original)
+++ branches/double_rotor/relax.py Fri Feb 14 14:32:41 2014
@@ -41,7 +41,7 @@
 
 # Python modules.
 import numpy
-from optparse import Option, OptionParser
+from optparse import Option, OptionGroup, OptionParser
 from os import F_OK, access, getpid, putenv
 if dep_check.cprofile_module:
     import cProfile as profile
@@ -273,24 +273,43 @@
         # Parser object.
         parser = RelaxParser(self, usage="usage: %prog [options] 
[script_file]")
 
-        # Recognised command line options.
-        parser.add_option('-d', '--debug', action='store_true', 
dest='debug', default=0, help='enable debugging output')
-        parser.add_option('-l', '--log', action='store', type='string', 
dest='log', help='log relax output to the file LOG_FILE', metavar='LOG_FILE')
-        parser.add_option('--licence', action='store_true', dest='licence', 
default=0, help='display the licence')
-        parser.add_option('-t', '--tee', action='store', type='string', 
dest='tee', help='tee relax output to stdout and the file LOG_FILE', 
metavar='LOG_FILE')
-        parser.add_option('-g', '--gui', action='store_true', dest='gui', 
default=0, help='launch the relax GUI')
-        parser.add_option('-p', '--pedantic', action='store_true', 
dest='pedantic', default=0, help='escalate all warnings to errors')
-        parser.add_option('--test', action='store_true', dest='test', 
default=0, help='run relax in test mode')
-        parser.add_option('-x', '--test-suite', action='store_true', 
dest='test_suite', default=0, help='execute the relax test suite')
-        parser.add_option('-s', '--system-tests', action='store_true', 
dest='system_tests', default=0, help='execute the relax system/functional 
tests (part of the test suite)')
-        parser.add_option('-u', '--unit-tests', action='store_true', 
dest='unit_tests', default=0, help='execute the relax unit tests (part of the 
test suite)')
-        parser.add_option('--gui-tests', action='store_true', 
dest='gui_tests', default=0, help='execute the relax GUI tests (part of the 
test suite)')
-        parser.add_option('--time', action='store_true', dest='tt', 
default=0, help='enable the timing of individual tests in the test suite')
-        parser.add_option('-i', '--info', action='store_true', dest='info', 
default=0, help='display information about this version of relax')
-        parser.add_option('-v', '--version', action='store_true', 
dest='version', default=0, help='show the version number and exit')
-        parser.add_option('-m', '--multi', action='store', type='string', 
dest='multiprocessor', default='uni', help='set multi processor method')
-        parser.add_option('-n', '--processors', action='store', type='int', 
dest='n_processors', default=-1, help='set number of processors (may be 
ignored)')
-        parser.add_option('--numpy-raise', action='store_true', 
dest='numpy_raise', default=0, help='convert numpy warnings to errors')
+        # Recognised command line options for the UI.
+        group = OptionGroup(parser, 'UI options')
+        group.add_option('-p', '--prompt', action='store_true', 
dest='prompt', default=0, help='launch relax in prompt mode after running any 
optionally supplied scripts')
+        group.add_option('-g', '--gui', action='store_true', dest='gui', 
default=0, help='launch the relax GUI')
+        group.add_option('-i', '--info', action='store_true', dest='info', 
default=0, help='display information about this version of relax')
+        group.add_option('-v', '--version', action='store_true', 
dest='version', default=0, help='show the version number and exit')
+        group.add_option('--licence', action='store_true', dest='licence', 
default=0, help='display the licence')
+        group.add_option('--test', action='store_true', dest='test', 
default=0, help='run relax in test mode')
+        parser.add_option_group(group)
+
+        # Recognised command line options for the multiprocessor.
+        group = OptionGroup(parser, 'Multi-processor options')
+        group.add_option('-m', '--multi', action='store', type='string', 
dest='multiprocessor', default='uni', help='set multi processor method')
+        group.add_option('-n', '--processors', action='store', type='int', 
dest='n_processors', default=-1, help='set number of processors (may be 
ignored)')
+        parser.add_option_group(group)
+
+        # Recognised command line options for IO redirection.
+        group = OptionGroup(parser, 'IO redirection options')
+        group.add_option('-l', '--log', action='store', type='string', 
dest='log', help='log relax output to the file LOG_FILE', metavar='LOG_FILE')
+        group.add_option('-t', '--tee', action='store', type='string', 
dest='tee', help='tee relax output to stdout and the file LOG_FILE', 
metavar='LOG_FILE')
+        parser.add_option_group(group)
+
+        # Recognised command line options for the test suite.
+        group = OptionGroup(parser, 'Test suite options')
+        group.add_option('-x', '--test-suite', action='store_true', 
dest='test_suite', default=0, help='execute the relax test suite')
+        group.add_option('-s', '--system-tests', action='store_true', 
dest='system_tests', default=0, help='execute the relax system/functional 
tests (part of the test suite)')
+        group.add_option('-u', '--unit-tests', action='store_true', 
dest='unit_tests', default=0, help='execute the relax unit tests (part of the 
test suite)')
+        group.add_option('--gui-tests', action='store_true', 
dest='gui_tests', default=0, help='execute the relax GUI tests (part of the 
test suite)')
+        group.add_option('--time', action='store_true', dest='tt', 
default=0, help='enable the timing of individual tests in the test suite')
+        parser.add_option_group(group)
+
+        # Recognised command line options for debugging.
+        group = OptionGroup(parser, 'Debugging options')
+        group.add_option('-d', '--debug', action='store_true', dest='debug', 
default=0, help='enable debugging output')
+        group.add_option('-e', '--escalate', action='store_true', 
dest='escalate', default=0, help='escalate all warnings to errors')
+        group.add_option('--numpy-raise', action='store_true', 
dest='numpy_raise', default=0, help='convert numpy warnings to errors')
+        parser.add_option_group(group)
 
         # Parse the options.
         (options, args) = parser.parse_args()
@@ -301,9 +320,13 @@
         if options.numpy_raise:
             numpy.seterr(all='raise')
 
-        # Pedantic flag.
-        if options.pedantic:
-            status.pedantic = True
+        # escalate flag.
+        if options.escalate:
+            status.escalate = True
+
+        # Script prompt interactive inspection flag.
+        if options.prompt:
+            status.prompt = True
 
         # Logging.
         if options.log:

Modified: branches/double_rotor/status.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/double_rotor/status.py?rev=22190&r1=22189&r2=22190&view=diff
==============================================================================
--- branches/double_rotor/status.py (original)
+++ branches/double_rotor/status.py Fri Feb 14 14:32:41 2014
@@ -51,7 +51,8 @@
 
             # Initialise some variables.
             self._instance.debug = False
-            self._instance.pedantic = False
+            self._instance.escalate = False
+            self._instance.prompt = False
             self._instance.test_mode = False
             self._instance.uf_intro = False
             self._instance.show_gui = False




Related Messages


Powered by MHonArc, Updated Fri Feb 14 15:20:03 2014