/[gnue]/gnue-common/src/utils/TextUtils.py
ViewVC logotype

Diff of /gnue-common/src/utils/TextUtils.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by jcater, Sun Aug 10 03:12:55 2003 UTC revision 1.10 by jcater, Sun Aug 10 17:59:04 2003 UTC
# Line 34  ALIGN_RIGHT=1 Line 34  ALIGN_RIGHT=1
34  ALIGN_CENTER=2  ALIGN_CENTER=2
35    
36  # very simple lineWrap  # very simple lineWrap
37  def lineWrap(message,maxWidth, preserveNewlines=1, alignment=ALIGN_LEFT):  def lineWrap(message,maxWidth, preserveNewlines=1, alignment=ALIGN_LEFT, eol=1):
38    
39    text = ""    text = ""
40    
# Line 63  def lineWrap(message,maxWidth, preserveN Line 63  def lineWrap(message,maxWidth, preserveN
63        text += "%s\n" % line        text += "%s\n" % line
64        strings = strings[index:]        strings = strings[index:]
65    
66      line = strings[:index]      line = strings
67      if alignment == ALIGN_CENTER:      if alignment == ALIGN_CENTER:
68        line = ' ' * ( (maxWidth - len(line)) /2 ) + line        line = ' ' * ( (maxWidth - len(line)) /2 ) + line
69      elif alignment == ALIGN_RIGHT:      elif alignment == ALIGN_RIGHT:
70        line = ' ' * ( (maxWidth - len(line)) ) + line        line = ' ' * ( (maxWidth - len(line)) ) + line
71      text += "%s\n" % line      text += "%s\n" % line
72    
73    return text    if not eol:
74        return text[:-1]
75      else:
76        return text
77    
78    
79  def textToMeasurement(text, multiplier=1):  def textToMeasurement(text, multiplier=1):

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26