2
# Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com)
4
# Jockey is free software; you can redistribute it and/or modify it
5
# under the terms of the GNU General Public License as published by the
6
# Free Software Foundation; either version 2, or (at your option) any
9
# Jockey is distributed in the hope that it will be useful, but WITHOUT
10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20
from pychart.pychart_types import *
22
oldstdout = sys.stdout
23
if os.path.exists("/dev/null"):
24
sys.stdout = open("/dev/null", "w")
29
sys.stdout = oldstdout
33
if type(val) == ModuleType:
35
for name in val.__dict__.keys():
36
v = val.__dict__[name]
38
values.append((v, mod + "." + name))
39
if type(v) == type and issubclass(v, chart_object.T):
43
def stringify_type(t):
48
return "(xoff,yoff,fill)"
49
elif re.search("NumType", s):
51
elif re.search("UnitType", s):
52
return "length in points (\\\\xref{unit})"
53
elif re.search("CoordType", s):
55
elif re.search("CoordSystemType", s):
56
return "['linear'|'log'|'category']"
57
elif re.search("CoordOrNoneType", s):
58
return "(x,y) or None"
59
elif re.search("TextAlignType", s):
60
return "['R'|'L'|'C'|None]"
61
elif re.search("FormatType", s):
62
return "printf format string"
63
elif re.search("IntervalType", s):
64
return "Number or function"
66
mo = re.match("<type '([^']+)'>", s)
69
mo = re.match("<class 'pychart\.([^']+)'>", s)
72
mo = re.match("<class '([^']+)'>", s)
75
mo = re.match("pychart\\.(.*)", s)
80
def stringify_value(val):
83
return '"' + val + '"'
88
if t in (IntType, LongType, FloatType):
92
if type(val) == ListType:
93
return map(stringify_value, val)
99
def break_string(name):
101
if len(name) < max_len:
104
name = re.sub("(\\d\\d)([^\\d])", "\\1-\n\\2", name)
105
name = re.sub("black(.)", "black-\n\\1", name)
107
elems = string.split(name, "\n")
110
for i in range(len(elems)):
112
if len(elem) < max_len:
115
elem1 = elem[0:len(elem)/2]
116
elem2 = elem[len(elem)/2:]
117
elems[i:i+1] = [elem1, elem2]
121
name = "\n".join(elems)