mailr16572 - in /branches/uf_redesign/prompt: help.py uf_objects.py


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

Header


Content

Posted by edward on May 31, 2012 - 18:03:
Author: bugman
Date: Thu May 31 18:03:49 2012
New Revision: 16572

URL: http://svn.gna.org/viewcvs/relax?rev=16572&view=rev
Log:
Large improvements to the prompt help strings for the user function classes.

These are now formatted with section using bold text.


Modified:
    branches/uf_redesign/prompt/help.py
    branches/uf_redesign/prompt/uf_objects.py

Modified: branches/uf_redesign/prompt/help.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/help.py?rev=16572&r1=16571&r2=16572&view=diff
==============================================================================
--- branches/uf_redesign/prompt/help.py (original)
+++ branches/uf_redesign/prompt/help.py Thu May 31 18:03:49 2012
@@ -35,10 +35,7 @@
 # Generic string printed out for function classes.
 ##################################################
 
-relax_class_help = """
-This is a python class which contains user functions.  To list these 
functions, either place a
-period at the end of class name and hit the tab key, or type 
'dir(class_name)'.
-"""
+relax_class_help = "This is a python class which contains user functions.  
To list these functions, either place a period at the end of class name and 
hit the tab key, or type 'dir(class_name)'."
 
 
 # Helper classes.

Modified: branches/uf_redesign/prompt/uf_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/uf_objects.py?rev=16572&r1=16571&r2=16572&view=diff
==============================================================================
--- branches/uf_redesign/prompt/uf_objects.py (original)
+++ branches/uf_redesign/prompt/uf_objects.py Thu May 31 18:03:49 2012
@@ -46,21 +46,45 @@
 
         # Store the args.
         self._name = name
-
-        # Build the relax help system string.
-        self.__relax_help__ = desc
-        self.__relax_help__ += "\n%s" % relax_class_help
+        self._desc = desc
+
+
+    def __repr__(self):
+        """Replacement function for displaying an instance of this user 
function class."""
+
+        # Return a description.
+        return "<The %s user function class object>" % self._name
+
+
+    def _build_doc(self):
+        """Create the user function class documentation.
+
+        @return:    The user function class documentation to use in the help 
system.
+        @rtype:     str
+        """
+
+        # Initialise.
+        doc = ""
+
+        # The title.
+        doc += build_subtitle("The %s user function class." % self._name, 
start_nl=False)
+
+        # The synopsis.
+        doc += build_subtitle("Synopsis")
+        doc += self._desc
+        doc += "\n\n"
+
+        # Usage help string.
+        doc += build_subtitle("Usage")
+        doc += format_text(relax_class_help)
 
         # Add a description to the help string.
         if hasattr(self, '__description__'):
-            self.__relax_help__ += "\n\n%s" % 
strip_lead(self.__description__)
-
-
-    def __repr__(self):
-        """Replacement function for displaying an instance of this user 
function class."""
-
-        # Return a description.
-        return "<The %s user function class object>" % self._name
+            doc += build_subtitle("Description")
+            doc += "\n\n%s" % strip_lead(self.__description__)
+
+        # Return the documentation.
+        return doc
 
 
 
@@ -232,7 +256,7 @@
         # Initialise.
         doc = ""
 
-        # A title.
+        # The title.
         doc += build_subtitle("The %s user function." % self._name, 
start_nl=False)
 
         # The synopsis.




Related Messages


Powered by MHonArc, Updated Thu May 31 18:20:01 2012