mailr10826 - in /1.3: info.py prompt/interpreter.py


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

Header


Content

Posted by edward on February 22, 2010 - 18:10:
Author: bugman
Date: Mon Feb 22 18:10:52 2010
New Revision: 10826

URL: http://svn.gna.org/viewcvs/relax?rev=10826&view=rev
Log:
Shifted the relax intro string (written to STDOUT) from the interpreter 
module to the Info_box.


Modified:
    1.3/info.py
    1.3/prompt/interpreter.py

Modified: 1.3/info.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/info.py?rev=10826&r1=10825&r2=10826&view=diff
==============================================================================
--- 1.3/info.py (original)
+++ 1.3/info.py Mon Feb 22 18:10:52 2010
@@ -27,6 +27,7 @@
 import dep_check
 import numpy
 import platform
+from textwrap import wrap
 from version import version
 
 
@@ -113,6 +114,54 @@
 
         # Return the new string.
         return string
+
+
+    def intro_text(self):
+        """Create the introductory string for STDOUT printing.
+
+        This text is word-wrapped to a fixed width of 100 characters (or 80 
on MS Windows).
+
+
+        @return:    The introductory string.
+        @rtype:     str
+        """
+
+        # The width of the printout.
+        if platform.uname()[0] in ['Windows', 'Microsoft']:
+            width = 80
+        else:
+            width = 100
+
+        # Some new lines.
+        intro_string = '\n\n\n'
+
+        # Program name and version.
+        intro_string = intro_string + self.centre(self.title + ' ' + 
self.version, width) + '\n\n'
+
+        # Program description.
+        intro_string = intro_string + self.centre(self.desc, width) + '\n\n'
+
+        # Copyright printout.
+        for i in range(len(self.copyright)):
+            intro_string = intro_string + self.centre(self.copyright[i], 
width) + '\n'
+        intro_string = intro_string + '\n'
+
+        # Program licence and help (wrapped).
+        for line in wrap(self.licence, width):
+            intro_string = intro_string + line + '\n'
+        intro_string = intro_string + '\n'
+ 
+        # Help message.
+        help = "Assistance in using the relax prompt and scripting interface 
can be accessed by typing 'help' within the prompt."
+        for line in wrap(help, width):
+            intro_string = intro_string + line + '\n'
+
+        # ImportErrors, if any.
+        for i in range(len(self.errors)):
+            intro_string = intro_string + '\n' + self.errors[i] + '\n'
+
+        # Return the formatted text.
+        return intro_string
 
 
     def print_sys_info(self):

Modified: 1.3/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/interpreter.py?rev=10826&r1=10825&r2=10826&view=diff
==============================================================================
--- 1.3/prompt/interpreter.py (original)
+++ 1.3/prompt/interpreter.py Mon Feb 22 18:10:52 2010
@@ -33,7 +33,6 @@
 if dep_check.readline_module:
     import readline
 import sys
-from textwrap import wrap
 
 # Python modules accessible on the command prompt.
 from math import pi
@@ -117,7 +116,8 @@
         self.__raise_relax_error = raise_relax_error
 
         # Build the intro string.
-        self.__intro_string = self._build_intro_text()
+        info = Info_box()
+        self.__intro_string = info.intro_text()
 
         # Initialise the execution information container (info that can 
change during execution).
         self.exec_info = Exec_info
@@ -132,55 +132,6 @@
 
         # Set up the interpreter objects.
         self._locals = self._setup()
-
-
-    def _build_intro_text(self):
-        """Create the introductory string to print out.
-
-        @return:    The introductory string.
-        @rtype:     str
-        """
-
-        # The width of the printout.
-        if platform.uname()[0] in ['Windows', 'Microsoft']:
-            width = 80
-        else:
-            width = 100
-
-        # Initialise the string and the relax information box.
-        string = ''
-        info = Info_box()
-
-        # Some new lines.
-        intro_string = '\n\n\n'
-
-        # Program name and version.
-        intro_string = intro_string + info.centre(info.title + ' ' + 
info.version, width) + '\n\n'
-
-        # Program description.
-        intro_string = intro_string + info.centre(info.desc, width) + '\n\n'
-
-        # Copyright printout.
-        for i in range(len(info.copyright)):
-            intro_string = intro_string + info.centre(info.copyright[i], 
width) + '\n'
-        intro_string = intro_string + '\n'
-
-        # Program licence and help (wrapped).
-        for line in wrap(info.licence, width):
-            intro_string = intro_string + line + '\n'
-        intro_string = intro_string + '\n'
- 
-        # Help message.
-        help = "Assistance in using the relax prompt and scripting interface 
can be accessed by typing 'help' within the prompt."
-        for line in wrap(help, width):
-            intro_string = intro_string + line + '\n'
-
-        # ImportErrors, if any.
-        for i in range(len(info.errors)):
-            intro_string = intro_string + '\n' + info.errors[i] + '\n'
-
-        # Return the formatted text.
-        return intro_string
 
 
     def _setup(self):




Related Messages


Powered by MHonArc, Updated Mon Feb 22 18:20:02 2010