1 # -*- coding: utf-8 -*-
3 # Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com)
5 # Jockey is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 2, or (at your option) any
10 # Jockey is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 from pychart.pychart_types import *
23 oldstdout = sys.stdout
24 if os.path.exists("/dev/null"):
25 sys.stdout = open("/dev/null", "w")
30 sys.stdout = oldstdout
34 if type(val) == ModuleType:
36 for name in val.__dict__.keys():
37 v = val.__dict__[name]
39 values.append((v, mod + "." + name))
40 if type(v) == type and issubclass(v, chart_object.T):
44 def stringify_type(t):
49 return "(xoff,yoff,fill)"
50 elif re.search("NumType", s):
52 elif re.search("UnitType", s):
53 return "length in points (\\\\xref{unit})"
54 elif re.search("CoordType", s):
56 elif re.search("CoordSystemType", s):
57 return "['linear'|'log'|'category']"
58 elif re.search("CoordOrNoneType", s):
59 return "(x,y) or None"
60 elif re.search("TextAlignType", s):
61 return "['R'|'L'|'C'|None]"
62 elif re.search("FormatType", s):
63 return "printf format string"
64 elif re.search("IntervalType", s):
65 return "Number or function"
67 mo = re.match("<type '([^']+)'>", s)
70 mo = re.match("<class 'pychart\.([^']+)'>", s)
73 mo = re.match("<class '([^']+)'>", s)
76 mo = re.match("pychart\\.(.*)", s)
81 def stringify_value(val):
84 return '"' + val + '"'
89 if t in (IntType, LongType, FloatType):
93 if type(val) == ListType:
94 return map(stringify_value, val)
100 def break_string(name):
102 if len(name) < max_len:
105 name = re.sub("(\\d\\d)([^\\d])", "\\1-\n\\2", name)
106 name = re.sub("black(.)", "black-\n\\1", name)
108 elems = string.split(name, "\n")
111 for i in range(len(elems)):
113 if len(elem) < max_len:
116 elem1 = elem[0:len(elem)/2]
117 elem2 = elem[len(elem)/2:]
118 elems[i:i+1] = [elem1, elem2]
122 name = "\n".join(elems)