Author: bugman Date: Fri May 4 08:42:30 2012 New Revision: 15944 URL: http://svn.gna.org/viewcvs/relax?rev=15944&view=rev Log: The prompt help system now uses bold text for the title line and all subtitles. The subtitle underlines are now not used, but the ability to underline is retained. Modified: branches/uf_redesign/prompt/base_class.py branches/uf_redesign/prompt/objects.py Modified: branches/uf_redesign/prompt/base_class.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/base_class.py?rev=15944&r1=15943&r2=15944&view=diff ============================================================================== --- branches/uf_redesign/prompt/base_class.py (original) +++ branches/uf_redesign/prompt/base_class.py Fri May 4 08:42:30 2012 @@ -40,6 +40,28 @@ width = 80 else: width = 100 + + +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_doc(fn): @@ -96,17 +118,27 @@ -def _build_subtitle(text): +def _build_subtitle(text, bold=True): """Create the formatted subtitle string. - @param text: The name of the subtitle. - @type text: str - @return: The formatted subtitle. - @rtype: str - """ - - # Format and return. - return "\n%s\n%s\n\n" % (text, "~"*len(text)) + @param text: The name of the subtitle. + @type text: str + @keyword colour: A flag which if true will return bold text. Otherwise an underlined title will be returned. + @type colour: bool + @return: The formatted subtitle. + @rtype: str + """ + + # Bold. + if bold: + new = "\n%s\n\n" % _bold_text(text) + + # Underline. + else: + new = "\n%s\n%s\n\n" % (text, "~"*len(text)) + + # Return the subtitle. + return new def _format_text(text): Modified: branches/uf_redesign/prompt/objects.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/objects.py?rev=15944&r1=15943&r2=15944&view=diff ============================================================================== --- branches/uf_redesign/prompt/objects.py (original) +++ branches/uf_redesign/prompt/objects.py Fri May 4 08:42:30 2012 @@ -24,7 +24,7 @@ """Module containing the special objects for auto-generating the user functions and classes.""" # relax module imports. -from prompt.base_class import _build_subtitle, _format_text, _strip_lead +from prompt.base_class import _bold_text, _build_subtitle, _format_text, _strip_lead from prompt.help import relax_class_help from relax_errors import RelaxError @@ -101,7 +101,7 @@ self.__relax_help__ = "" # Add the title. - self.__relax_help__ = "%s%s\n" % (self.__relax_help__, self._title) + self.__relax_help__ = "%s%s\n" % (self.__relax_help__, _bold_text(self._title)) # Add the keyword args. if self._kargs != None: