mailr18678 - in /trunk: lib/text/table.py prompt/uf_docstring.py


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

Header


Content

Posted by edward on March 07, 2013 - 18:09:
Author: bugman
Date: Thu Mar  7 18:09:38 2013
New Revision: 18678

URL: http://svn.gna.org/viewcvs/relax?rev=18678&view=rev
Log:
Added the spacing argument to lib.text.table.format_table().

This removes the reference to the user function table spacing variable from 
this function and shifts
it to the prompt.uf_docstring.create_table() function.


Modified:
    trunk/lib/text/table.py
    trunk/prompt/uf_docstring.py

Modified: trunk/lib/text/table.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/text/table.py?rev=18678&r1=18677&r2=18678&view=diff
==============================================================================
--- trunk/lib/text/table.py (original)
+++ trunk/lib/text/table.py Thu Mar  7 18:09:38 2013
@@ -78,7 +78,7 @@
     return line
 
 
-def format_table(headings=None, contents=None, max_width=None, debug=False):
+def format_table(headings=None, contents=None, max_width=None, 
spacing=False, debug=False):
     """Format and return the table as text.
 
     @keyword headings:  The table header.
@@ -87,6 +87,8 @@
     @type contents:     list of lists of str
     @keyword max_width: The maximum width of the table.
     @type max_width:    int
+    @keyword spacing:   A flag which if True will add blank line between 
each row.
+    @type spacing:      bool
     @keyword debug:     A flag which if True will activate a number of 
debugging printouts.
     @type debug:        bool
     @return:            The formatted table.
@@ -222,7 +224,7 @@
                     col_text[k][j] = lines[k]
 
         # Blank line (between rows when asked, and for the first row after 
the header).
-        if table.spacing or i == 0:
+        if spacing or i == 0:
             text += _table_line(widths=new_widths)
 
         # The contents.

Modified: trunk/prompt/uf_docstring.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/prompt/uf_docstring.py?rev=18678&r1=18677&r2=18678&view=diff
==============================================================================
--- trunk/prompt/uf_docstring.py (original)
+++ trunk/prompt/uf_docstring.py Thu Mar  7 18:09:38 2013
@@ -102,7 +102,7 @@
     num_cols = len(table.headings)
 
     # Generate and return the table.
-    return format_table(headings=[table.headings], contents=table.cells, 
max_width=status.text_width, debug=status.debug)
+    return format_table(headings=[table.headings], contents=table.cells, 
max_width=status.text_width, spacing=table.spacing, debug=status.debug)
 
 
 def format_text(text):




Related Messages


Powered by MHonArc, Updated Thu Mar 07 18:20:02 2013