mailr15540 - /1.3/prompt/help.py


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

Header


Content

Posted by edward on March 19, 2012 - 10:29:
Author: bugman
Date: Mon Mar 19 10:29:55 2012
New Revision: 15540

URL: http://svn.gna.org/viewcvs/relax?rev=15540&view=rev
Log:
The prompt UI help system is now using status.text_width to wrap text.

This is currently only for the 'help' print out.


Modified:
    1.3/prompt/help.py

Modified: 1.3/prompt/help.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/help.py?rev=15540&r1=15539&r2=15540&view=diff
==============================================================================
--- 1.3/prompt/help.py (original)
+++ 1.3/prompt/help.py Mon Mar 19 10:29:55 2012
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003, 2004 Edward d'Auvergne                                 
 #
+# Copyright (C) 2003-2012 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -20,9 +20,16 @@
 #                                                                            
 #
 
###############################################################################
 
+# Module docstring.
+"""The prompt UI help system."""
+
 # Python module imports.
 import pydoc
 import sys
+from textwrap import wrap
+
+# relax module imports.
+from status import Status; status = Status()
 
 
 # Generic string printed out for function classes.
@@ -39,15 +46,23 @@
 
 class _Helper:
     text = """\
-For assistance in using a function, simply type 'help(function)'.  All 
functions can be viewed by
-hitting the [TAB] key.  In addition to functions, if 'help(object)' is 
typed, the help for the
-python object is returned.  This system is similar to the help function 
built into the python
-interpreter, which has been renamed to help_python, with the interactive 
component removed.  For the
-interactive python help system, type 'help_python()'.
+For assistance in using a function, simply type 'help(function)'.  All 
functions can be viewed by hitting the [TAB] key.  In addition to functions, 
if 'help(object)' is typed, the help for the python object is returned.  This 
system is similar to the help function built into the python interpreter, 
which has been renamed to help_python, with the interactive component 
removed.  For the interactive python help system, type 'help_python()'.
     """
 
     def __repr__(self):
-        return self.text
+        """String representation of the object.
+
+        @return:    The help description.
+        @rtype:     str
+        """
+
+        # Wrap the text.
+        string = ''
+        for line in wrap(self.text, status.text_width):
+            string += line + '\n'
+
+        # Return the wrapped text.
+        return string
 
 
     def __call__(self, *args, **kwds):




Related Messages


Powered by MHonArc, Updated Mon Mar 19 10:40:02 2012