Revision: 4249
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4249&view=rev
Author:   dsdale
Date:     2007-11-13 10:10:32 -0800 (Tue, 13 Nov 2007)

Log Message:
-----------
fixed some formatting issues in tconfig

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/config/tconfig.py
    trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template

Modified: trunk/matplotlib/lib/matplotlib/config/tconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/tconfig.py   2007-11-13 16:39:12 UTC 
(rev 4248)
+++ trunk/matplotlib/lib/matplotlib/config/tconfig.py   2007-11-13 18:10:32 UTC 
(rev 4249)
@@ -76,6 +76,50 @@
 # Utility functions
 ############################################################################
 
+def get_split_ind(seq, N):
+   """seq is a list of words.  Return the index into seq such that
+   len(' '.join(seq[:ind])<=N
+   """
+
+   sLen = 0
+   # todo: use Alex's xrange pattern from the cbook for efficiency
+   for (word, ind) in zip(seq, range(len(seq))):
+      sLen += len(word) + 1  # +1 to account for the len(' ')
+      if sLen>=N: return ind
+   return len(seq)
+
+def wrap(prefix, text, cols, max_lines=6):
+    'wrap text with prefix at length cols'
+    pad = ' '*len(prefix.expandtabs())
+    available = cols - len(pad)
+
+    seq = text.split(' ')
+    Nseq = len(seq)
+    ind = 0
+    lines = []
+    while ind<Nseq:
+        lastInd = ind
+        ind += get_split_ind(seq[ind:], available)
+        lines.append(seq[lastInd:ind])
+
+    num_lines = len(lines)
+    abbr_end = max_lines // 2
+    abbr_start = max_lines - abbr_end
+    lines_skipped = False
+    for i in range(num_lines):
+        if i == 0:
+            # add the prefix to the first line, pad with spaces otherwise
+            ret = prefix + ' '.join(lines[i]) + '\n'
+        elif i < abbr_start or i > num_lines-abbr_end-1:
+            ret += pad + ' '.join(lines[i]) + '\n'
+        else:
+            if not lines_skipped:
+                lines_skipped = True
+                ret += ' <...snipped %d lines...> \n' % (num_lines-max_lines)
+#    for line in lines[1:]:
+#        ret += pad + ' '.join(line) + '\n'
+    return ret[:-1]
+
 def dedent(txt):
     """A modified version of textwrap.dedent, specialized for docstrings.
 
@@ -115,44 +159,6 @@
     return ''.join(lines)
 
 
-def short_str(txt,line_length=80,max_lines=6):
-    """Shorten a text input if necessary.
-    """
-
-    assert max_lines%2==0,"max_lines must be even"
-
-    if txt.count('\n') <= 1:
-        # Break up auto-generated text that can be *very* long but in just one
-        # line.
-        ltxt = len(txt)
-        max_len = line_length*max_lines
-        chunk = max_lines/2
-
-        if ltxt > max_len:
-            out = []
-            for n in range(chunk):
-                out.append(txt[line_length*n:line_length*(n+1)])
-
-            out.append(' <...snipped %d chars...> ' % (ltxt-max_len))
-
-            for n in range(-chunk-1,0,1):
-                # Special-casing for the last step of the loop, courtesy of
-                # Python's idiotic string slicign semantics when the second
-                # argument is 0.  Argh.
-                end = line_length*(n+1)
-                if end==0: end = None
-                out.append(txt[line_length*n:end])
-
-            txt = '\n'.join(out)
-        else:
-            nlines = ltxt/line_length
-            out = [ txt[line_length*n:line_length*(n+1)]
-                    for n in range(nlines+1)]
-            if out:
-                txt = '\n'.join(out)
-    return txt
-
-
 def configObj2Str(cobj):
     """Dump a Configobj instance to a string."""
     outstr = StringIO()
@@ -463,7 +469,7 @@
                 # Get a short version of info with lines of max. 78 chars, so
                 # that after commenting them out (with '# ') they are at most
                 # 80-chars long.
-                out.append(comment(short_str(info,78-len(indent)),indent))
+                out.append(comment(wrap('',info.replace('\n', ' 
'),78-len(indent)),indent))
             except (KeyError,AttributeError):
                 pass
             out.append(indent+('%s = %r' % (s,v)))

Modified: trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template
===================================================================
--- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template   
2007-11-13 16:39:12 UTC (rev 4248)
+++ trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template   
2007-11-13 18:10:32 UTC (rev 4249)
@@ -39,14 +39,13 @@
 maskedarray = False
 # 'numpy' or 'numeric' or 'numarray'
 numerix = 'numpy'
-# 'Africa/Abidjan' or 'Africa/Accra' or 'Africa/Addis_Ababa' or 
'Africa/Algiers'
-#  or 'Africa/Asmara' or 'Africa/Asmera' or 'Africa/Bamako' or 'Africa/Bangui' 
o
-# r 'Africa/Banjul' or 'Africa/Bissau' or 'Africa/Blantyre' or 
'Africa/Brazzavil
-#  <...snipped 10590 chars...> 
-# or 'Turkey' or 'UCT' or 'US/Alaska' or 'US/Aleutian' or 'US/Arizona' or 
'US/Ce
-# ntral' or 'US/East-Indiana' or 'US/Eastern' or 'US/Hawaii' or 
'US/Indiana-Star
-# ke' or 'US/Michigan' or 'US/Mountain' or 'US/Pacific' or 'US/Pacific-New' or 
'
-# US/Samoa' or 'UTC' or 'Universal' or 'W-SU' or 'WET' or 'Zulu' or 
'posixrules'
+# 'Africa/Abidjan' or 'Africa/Accra' or 'Africa/Addis_Ababa' or
+# 'Africa/Algiers' or 'Africa/Asmara' or 'Africa/Asmera' or 'Africa/Bamako' or
+# 'Africa/Bangui' or 'Africa/Banjul' or 'Africa/Bissau' or 'Africa/Blantyre'
+#  <...snipped 156 lines...> 
+# 'US/Michigan' or 'US/Mountain' or 'US/Pacific' or 'US/Pacific-New' or
+# 'US/Samoa' or 'UTC' or 'Universal' or 'W-SU' or 'WET' or 'Zulu' or
+# 'posixrules'
 timezone = 'UTC'
 # 'toolbar2' or None
 toolbar = 'toolbar2'
@@ -72,15 +71,15 @@
     # name like 'orange', a hex color like '#efefef', a grayscale intensity
     # like '0.5', or an RGBA tuple (1,0,0,1)
     labelcolor = 'black'
-    # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 
'medium' 
-    # or 'large' or 'x-large' or 'xx-large'
+    # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or
+    # 'medium' or 'large' or 'x-large' or 'xx-large'
     labelsize = 'medium'
     # a value of type 'float'
     linewidth = 1.0
     # one of: 0 | on | false | 1 | no | n | y | off | yes | true
     polargrid = True
-    # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 
'medium' 
-    # or 'large' or 'x-large' or 'xx-large'
+    # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or
+    # 'medium' or 'large' or 'x-large' or 'xx-large'
     titlesize = 'large'
 
     [[formatter]]
@@ -88,8 +87,8 @@
         limits = [-7.0, 7.0]
 
 [backend]
-    # one of: ps | qt4agg | fltkagg | gtkagg | agg | cairo | gtk | gtkcairo | 
wx
-    # agg | tkagg | qtagg | template | svg | cocoaagg | pdf | wx
+    # one of: ps | qt4agg | fltkagg | gtkagg | agg | cairo | gtk | gtkcairo |
+    # wxagg | tkagg | qtagg | template | svg | cocoaagg | pdf | wx
     use = 'Agg'
 
     [[cairo]]
@@ -109,10 +108,10 @@
     [[ps]]
         # 3 or 42
         fonttype = 3
-        # 'auto' or 'letter' or 'legal' or 'ledger' or 'A0' or 'A1' or 'A2' or 
'
-        # A3' or 'A4' or 'A5' or 'A6' or 'A7' or 'A8' or 'A9' or 'A10' or 'B0' 
o
-        # r 'B1' or 'B2' or 'B3' or 'B4' or 'B5' or 'B6' or 'B7' or 'B8' or 
'B9'
-        #  or 'B10'
+        # 'auto' or 'letter' or 'legal' or 'ledger' or 'A0' or 'A1' or 'A2' or
+        # 'A3' or 'A4' or 'A5' or 'A6' or 'A7' or 'A8' or 'A9' or 'A10' or
+        # 'B0' or 'B1' or 'B2' or 'B3' or 'B4' or 'B5' or 'B6' or 'B7' or 'B8'
+        # or 'B9' or 'B10'
         papersize = 'letter'
         # a value of type 'bool'
         useafm = False
@@ -189,16 +188,16 @@
     serif = ['Bitstream Vera Serif', 'New Century Schoolbook', 'Century 
Schoolbook L', 'Utopia', 'ITC Bookman', 'Bookman', 'Nimbus Roman No9 L', 'Times 
New Roman', 'Times', 'Palatino', 'Charter', 'serif']
     # a value of type 'float'
     size = 12.0
-    # 'ultra-condensed' or 'extra-condensed' or 'condensed' or 
'semi-condensed' 
-    # or 'normal' or 'semi-expanded' or 'expanded' or 'extra-expanded' or 
'ultra
-    # -expanded' or 'wider' or 'narrower'
+    # 'ultra-condensed' or 'extra-condensed' or 'condensed' or
+    # 'semi-condensed' or 'normal' or 'semi-expanded' or 'expanded' or
+    # 'extra-expanded' or 'ultra-expanded' or 'wider' or 'narrower'
     stretch = 'normal'
     # 'normal' or 'italic' or 'oblique'
     style = 'normal'
     # 'normal' or 'small-caps'
     variant = 'normal'
-    # 'normal' or 'bold' or 'bolder' or 'lighter' or 100 or 200 or 300 or 400 
or
-    #  500 or 600 or 700 or 800 or 900
+    # 'normal' or 'bold' or 'bolder' or 'lighter' or 100 or 200 or 300 or 400
+    # or 500 or 600 or 700 or 800 or 900
     weight = 'normal'
 
 [grid]
@@ -214,18 +213,18 @@
 [image]
     # a value of type 'float' or 'equal' or 'auto'
     aspect = 'equal'
-    # 'Accent' or 'Accent_r' or 'Blues' or 'Blues_r' or 'BrBG' or 'BrBG_r' or 
'B
-    # uGn' or 'BuGn_r' or 'BuPu' or 'BuPu_r' or 'Dark2' or 'Dark2_r' or 'GnBu' 
o
-    # r 'GnBu_r' or 'Greens' or 'Greens_r' or 'Greys' or 'Greys_r' or 'OrRd' 
or 
-    #  <...snipped 1010 chars...> 
-    # ist_stern' or 'gist_stern_r' or 'gist_yarg' or 'gist_yarg_r' or 'gray' 
or 
-    # 'gray_r' or 'hot' or 'hot_r' or 'hsv' or 'hsv_r' or 'jet' or 'jet_r' or 
'p
-    # ink' or 'pink_r' or 'prism' or 'prism_r' or 'spectral' or 'spectral_r' 
or 
-    # 'spring' or 'spring_r' or 'summer' or 'summer_r' or 'winter' or 
'winter_r'
+    # 'Accent' or 'Accent_r' or 'Blues' or 'Blues_r' or 'BrBG' or 'BrBG_r' or
+    # 'BuGn' or 'BuGn_r' or 'BuPu' or 'BuPu_r' or 'Dark2' or 'Dark2_r' or
+    # 'GnBu' or 'GnBu_r' or 'Greens' or 'Greens_r' or 'Greys' or 'Greys_r' or
+    #  <...snipped 16 lines...> 
+    # 'pink_r' or 'prism' or 'prism_r' or 'spectral' or 'spectral_r' or
+    # 'spring' or 'spring_r' or 'summer' or 'summer_r' or 'winter' or
+    # 'winter_r'
     cmap = 'jet'
-    # 'bilinear' or 'nearest' or 'bicubic' or 'spline16' or 'spline36' or 
'hanni
-    # ng' or 'hamming' or 'hermite' or 'kaiser' or 'quadric' or 'catrom' or 
'gau
-    # ssian' or 'bessel' or 'mitchell' or 'sinc' or 'lanczos' or 'blackman'
+    # 'bilinear' or 'nearest' or 'bicubic' or 'spline16' or 'spline36' or
+    # 'hanning' or 'hamming' or 'hermite' or 'kaiser' or 'quadric' or 'catrom'
+    # or 'gaussian' or 'bessel' or 'mitchell' or 'sinc' or 'lanczos' or
+    # 'blackman'
     interpolation = 'bilinear'
     # a value of type 'int'
     lut = 256
@@ -235,8 +234,8 @@
 [legend]
     # a value of type 'float'
     axespad = 0.02
-    # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 
'medium' 
-    # or 'large' or 'x-large' or 'xx-large'
+    # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or
+    # 'medium' or 'large' or 'x-large' or 'xx-large'
     fontsize = 'medium'
     # a value of type 'float'
     handlelen = 0.050000000000000003
@@ -246,9 +245,9 @@
     isaxes = True
     # a value of type 'float'
     labelsep = 0.01
-    # 'best' or 'upper right' or 'upper left' or 'lower left' or 'lower right' 
o
-    # r 'right' or 'center left' or 'center right' or 'lower center' or 'upper 
c
-    # enter' or 'center'
+    # 'best' or 'upper right' or 'upper left' or 'lower left' or 'lower right'
+    # or 'right' or 'center left' or 'center right' or 'lower center' or
+    # 'upper center' or 'center'
     loc = 'upper right'
     # a value of type 'float'
     markerscale = 1.0
@@ -274,9 +273,9 @@
     linestyle = '-'
     # a value of type 'float'
     linewidth = 1.0
-    # 'None' or 'o' or '.' or ',' or '^' or 'v' or '<' or '>' or 's' or '+' or 
'
-    # x' or 'D' or 'd' or '1' or '2' or '3' or '4' or 'h' or 'H' or 'p' or '|' 
o
-    # r '_'
+    # 'None' or 'o' or '.' or ',' or '^' or 'v' or '<' or '>' or 's' or '+' or
+    # 'x' or 'D' or 'd' or '1' or '2' or '3' or '4' or 'h' or 'H' or 'p' or
+    # '|' or '_'
     marker = 'None'
     # a value of type 'float'
     markeredgewidth = 0.5
@@ -288,27 +287,27 @@
     solid_joinstyle = 'miter'
 
 [mathtext]
-    # A fontconfig pattern.  See the fontconfig user manual for more 
information
-    # .
+    # A fontconfig pattern.  See the fontconfig user manual for more
+    # information.
     bf = 'serif:bold'
-    # A fontconfig pattern.  See the fontconfig user manual for more 
information
-    # .
+    # A fontconfig pattern.  See the fontconfig user manual for more
+    # information.
     cal = 'cursive'
     # a value of type 'bool'
     fallback_to_cm = True
     # 'cm' or 'stix' or 'stixsans' or 'custom'
     fontset = 'cm'
-    # A fontconfig pattern.  See the fontconfig user manual for more 
information
-    # .
+    # A fontconfig pattern.  See the fontconfig user manual for more
+    # information.
     it = 'serif:oblique'
-    # A fontconfig pattern.  See the fontconfig user manual for more 
information
-    # .
+    # A fontconfig pattern.  See the fontconfig user manual for more
+    # information.
     rm = 'serif'
-    # A fontconfig pattern.  See the fontconfig user manual for more 
information
-    # .
+    # A fontconfig pattern.  See the fontconfig user manual for more
+    # information.
     sf = 'sans'
-    # A fontconfig pattern.  See the fontconfig user manual for more 
information
-    # .
+    # A fontconfig pattern.  See the fontconfig user manual for more
+    # information.
     tt = 'monospace'
 
 [patch]
@@ -368,8 +367,8 @@
     color = 'black'
     # 'in' or 'out'
     direction = 'in'
-    # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 
'medium' 
-    # or 'large' or 'x-large' or 'xx-large'
+    # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or
+    # 'medium' or 'large' or 'x-large' or 'xx-large'
     labelsize = 'small'
 
     [[major]]
@@ -391,8 +390,8 @@
     color = 'black'
     # 'in' or 'out'
     direction = 'in'
-    # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 
'medium' 
-    # or 'large' or 'x-large' or 'xx-large'
+    # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or
+    # 'medium' or 'large' or 'x-large' or 'xx-large'
     labelsize = 'small'
 
     [[major]]


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to