mailr18669 - /trunk/lib/text/table.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 - 16:28:
Author: bugman
Date: Thu Mar  7 16:28:40 2013
New Revision: 18669

URL: http://svn.gna.org/viewcvs/relax?rev=18669&view=rev
Log:
Created the lib.text.table module.

This originates from the prompt.uf_docstring module as most of that module is 
functions for creating
formatted text tables.


Added:
    trunk/lib/text/table.py
      - copied, changed from r18589, trunk/prompt/uf_docstring.py

Copied: trunk/lib/text/table.py (from r18589, trunk/prompt/uf_docstring.py)
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/text/table.py?p2=trunk/lib/text/table.py&p1=trunk/prompt/uf_docstring.py&r1=18589&r2=18669&rev=18669&view=diff
==============================================================================
--- trunk/prompt/uf_docstring.py (original)
+++ trunk/lib/text/table.py Thu Mar  7 16:28:40 2013
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2009-2012 Edward d'Auvergne                                  
 #
+# Copyright (C) 2009-2013 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -20,7 +20,7 @@
 
###############################################################################
 
 # Module docstring.
-"""The base class for all the user function classes."""
+"""Functions for the text formatting of tables."""
 
 # Python module imports.
 from copy import deepcopy
@@ -32,59 +32,6 @@
 from relax_string import strip_lead
 from status import Status; status = Status()
 from user_functions.data import Uf_tables; uf_tables = Uf_tables()
-
-
-def bold_text(text):
-    """Convert the text to bold.
-
-    This is for use in the help system.
-
-    @param text:    The text to make bold.
-    @type text:     str
-    @return:        The bold text.
-    @rtype:         str
-    """
-
-    # Init.
-    new_text = ''
-
-    # Add the bold character to all characters.
-    for i in range(len(text)):
-        new_text += "%s\b%s" % (text[i], text[i])
-
-    # Return the text.
-    return new_text
-
-
-def build_subtitle(text, bold=True, start_nl=True):
-    """Create the formatted subtitle string.
-
-    @param text:        The name of the subtitle.
-    @type text:         str
-    @keyword bold:      A flag which if true will return bold text.  
Otherwise an underlined title will be returned.
-    @type bold:         bool
-    @keyword start_nl:  A flag which if True will add a newline to the start 
of the text.
-    @type start_nl:     bool
-    @return:            The formatted subtitle.
-    @rtype:             str
-    """
-
-    # Starting newline.
-    if start_nl:
-        new = "\n"
-    else:
-        new = ""
-
-    # Bold.
-    if bold:
-        new += "%s\n\n" % bold_text(text)
-
-    # Underline.
-    else:
-        new += "%s\n%s\n\n" % (text, "~"*len(text))
-
-    # Return the subtitle.
-    return new
 
 
 def create_table(label):
@@ -237,26 +184,6 @@
     return text
 
 
-def format_text(text):
-    """Format the line of text by wrapping.
-
-    @param text:    The line of text to wrap.
-    @type text:     str
-    @return:        The wrapped text.
-    @rtype:         str
-    """
-
-    # Then wrap each line.
-    new_text = ""
-
-    # Wrap the line.
-    for wrapped_line in wrap(text, status.text_width):
-        new_text += wrapped_line + "\n"
-
-    # Return the formatted text.
-    return new_text
-
-
 def table_line(text=None, widths=None, bottom=False):
     """Format a line of a table.
 




Related Messages


Powered by MHonArc, Updated Thu Mar 07 17:20:01 2013