mailr2556 - /1.2/relax


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

Header


Content

Posted by edward on September 10, 2006 - 14:10:
Author: bugman
Date: Sun Sep 10 14:10:11 2006
New Revision: 2556

URL: http://svn.gna.org/viewcvs/relax?rev=2556&view=rev
Log:
Changed the introduction string width to be 80 characters wide under MS 
Windows (the width of
cmd.exe).


Modified:
    1.2/relax

Modified: 1.2/relax
URL: 
http://svn.gna.org/viewcvs/relax/1.2/relax?rev=2556&r1=2555&r2=2556&view=diff
==============================================================================
--- 1.2/relax (original)
+++ 1.2/relax Sun Sep 10 14:10:11 2006
@@ -36,6 +36,7 @@
 # Python modules.
 import __builtin__
 from os import F_OK, access, getpid, putenv
+import platform
 import profile
 import pstats
 from re import match
@@ -93,6 +94,9 @@
         # Get and store the PID of this process.
         self.pid = getpid()
 
+        # Store the operating system name.
+        self.platform = platform.uname()[0]
+
         # Set up the program internal errors.
         RelaxErrors(self)
 
@@ -346,33 +350,48 @@
     def set_intro_string(self):
         """Create the program introduction."""
 
+        # The width of the printout.
+        if self.platform == 'Windows':
+            width = 80
+        else:
+            width = 100
+
         # Some new lines.
         self.intro_string = '\n\n\n'
 
         # Program name and version.
         string = "relax " + self.version
-        self.intro_string = self.intro_string + self.spacing(string) + '\n\n'
+        self.intro_string = self.intro_string + self.spacing(string, width) 
+ '\n\n'
 
         # Program description.
         string = "Protein dynamics by NMR relaxation data analysis"
-        self.intro_string = self.intro_string + self.spacing(string) + '\n\n'
+        self.intro_string = self.intro_string + self.spacing(string, width) 
+ '\n\n'
 
         # Copyright printout.
         string = "Copyright (C) 2001-2006 Edward d'Auvergne"
-        self.intro_string = self.intro_string + self.spacing(string) + '\n\n'
-
-        # Program licence and help.
-        self.intro_string = self.intro_string + "This is free software which 
you are welcome to modify and redistribute under the conditions of the\n"
-        self.intro_string = self.intro_string + "GNU General Public License 
(GPL).  This program, including all modules, is licensed under the GPL\n"
-        self.intro_string = self.intro_string + "and comes with absolutely 
no warranty.  For details type 'GPL'.  Assistance in using this program\n"
-        self.intro_string = self.intro_string + "can be accessed by typing 
'help'.\n"
-
-
-    def spacing(self, string):
+        self.intro_string = self.intro_string + self.spacing(string, width) 
+ '\n\n'
+
+        # Program licence and help (80 characters wide).
+        if width == 80:
+            self.intro_string = self.intro_string + "This is free software 
which you are welcome to modify and redistribute under\n"
+            self.intro_string = self.intro_string + "the conditions of the 
GNU General Public License (GPL).  This program,\n"
+            self.intro_string = self.intro_string + "including all modules, 
is licensed under the GPL and comes with absolutely no\n"
+            self.intro_string = self.intro_string + "warranty.  For details 
type 'GPL'.  Assistance in using this program can be\n"
+            self.intro_string = self.intro_string + "accessed by typing 
'help'.\n"
+
+        # Program licence and help (100 characters wide).
+        else:
+            self.intro_string = self.intro_string + "This is free software 
which you are welcome to modify and redistribute under the conditions of 
the\n"
+            self.intro_string = self.intro_string + "GNU General Public 
License (GPL).  This program, including all modules, is licensed under the 
GPL\n"
+            self.intro_string = self.intro_string + "and comes with 
absolutely no warranty.  For details type 'GPL'.  Assistance in using this 
program\n"
+            self.intro_string = self.intro_string + "can be accessed by 
typing 'help'.\n"
+
+
+    def spacing(self, string, width=100):
         """Function for formatting the string to be centered to 100 
spaces."""
 
         # Calculate the number of spaces needed.
-        spaces = (100 - len(string)) / 2
+        spaces = (width - len(string)) / 2
 
         # The new string.
         string = spaces * ' ' + string




Related Messages


Powered by MHonArc, Updated Wed Sep 13 13:00:06 2006