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_types import *
25 "width" : (UnitType, theme.default_line_width, "Width of the line, in points."),
26 "color": (color.T, color.default, "The color of the line."),
27 "dash" : (TupleType, None,
29 of None will draw a solid line. Otherwise, this
30 attribute specifies the style of dashed lines.
31 The 2N'th value specifies the length of the line (in points),
32 and 2N+1'th value specifies the length of the blank.
34 For example, the dash style of (3,2,4,1) draws a dashed line that
35 looks like @samp{---__----_---__----_...}.
37 "cap_style": (IntType, 0,
38 """Defines the style of the tip of the line segment.
39 0: butt cap (square cutoff, with no projection beyond),
40 1: round cap (arc), 2: projecting square cap
41 (square cutoff, but the line extends half the line width).
42 See also Postscript/PDF reference manual."""),
43 "join_style": (IntType, 0,
44 """Join style. 0: Miter join (sharp, pointed corners),
45 1: round join (rounded corners),
46 2: bevel join (flattened corners).
47 See also Postscript/PDF reference manual.""")
50 class T(chart_object.T):
51 __doc__ = line_style_doc.doc
53 ##AUTOMATICALLY GENERATED
55 ##END AUTOMATICALLY GENERATED
57 s = name_table().lookup(self)
60 return "<linestyle: width=%s, color=%s, dash=%s, cap=%d, join=%d>" \
61 % (self.width, self.color, self.dash, self.cap_style, self.join_style)
63 default = T(color=color.default)
65 dash1 = 1.5,1.5 # - - - -
66 dash2 = 5,2,5,2 # -- -- -- --
69 black = T(color=color.black)
70 black_dash1 = T(color=color.black, dash=dash1)
71 black_dash2 = T(color=color.black, dash=dash2)
72 black_dash3 = T(color=color.black, dash=dash3)
74 gray70 = T(color=color.gray70)
75 gray70_dash1 = T(color=color.gray70, dash=dash1)
76 gray70_dash2 = T(color=color.gray70, dash=dash2)
77 gray70_dash3 = T(color=color.gray70, dash=dash3)
79 gray10 = T(color=color.gray10)
80 gray10_dash1 = T(color=color.gray10, dash=dash1)
81 gray10_dash2 = T(color=color.gray10, dash=dash2)
82 gray10_dash3 = T(color=color.gray10, dash=dash3)
84 gray50 = T(color=color.gray50)
85 gray50_dash1 = T(color=color.gray50, dash=dash1)
86 gray50_dash2 = T(color=color.gray50, dash=dash2)
87 gray50_dash3 = T(color=color.gray50, dash=dash3)
89 gray60 = T(color=color.gray60)
90 gray60_dash1 = T(color=color.gray60, dash=dash1)
91 gray60_dash2 = T(color=color.gray60, dash=dash2)
92 gray60_dash3 = T(color=color.gray60, dash=dash3)
94 gray90 = T(color=color.gray90)
95 gray90_dash1 = T(color=color.gray90, dash=dash1)
96 gray90_dash2 = T(color=color.gray90, dash=dash2)
97 gray90_dash3 = T(color=color.gray90, dash=dash3)
99 gray30 = T(color=color.gray30)
100 gray30_dash1 = T(color=color.gray30, dash=dash1)
101 gray30_dash2 = T(color=color.gray30, dash=dash2)
102 gray30_dash3 = T(color=color.gray30, dash=dash3)
104 white = T(color=color.white)
107 red = T(color=color.red)
108 darkblue = T(color=color.darkblue)
109 darkseagreen = T(color=color.darkseagreen)
110 darkkhaki = T(color = color.darkkhaki)
112 blue = T(color=color.blue)
113 green = T(color=color.green)
115 red_dash1 = T(color=color.red, dash=dash1)
116 darkblue_dash1 = T(color=color.darkblue, dash=dash1)
117 darkseagreen_dash1 = T(color=color.darkseagreen, dash=dash1)
118 darkkhaki_dash1 = T(color=color.darkkhaki, dash=dash1)
120 red_dash2 = T(color=color.red, dash=dash2)
121 darkblue_dash2 = T(color=color.darkblue, dash=dash2)
122 darkseagreen_dash2 = T(color=color.darkseagreen, dash=dash2)
123 darkkhaki_dash2 = T(color=color.darkkhaki, dash=dash2)
129 global standards, _name_table
130 standards = object_set.T()
133 standards.add(black, red, darkblue, gray70, darkseagreen,
135 black_dash1, red_dash1, darkblue_dash1, gray70_dash1,
136 darkseagreen_dash1, darkkhaki_dash1, gray30_dash1,
137 black_dash2, red_dash2, darkblue_dash2, gray70_dash2,
138 darkseagreen_dash2, darkkhaki_dash2, gray30_dash2)
140 standards.add(black, black_dash1, black_dash2,
141 gray70, gray70_dash1, gray70_dash2,
142 gray10, gray10_dash1, gray10_dash2,
143 gray50, gray50_dash1, gray50_dash2,
144 gray90, gray90_dash1, gray90_dash2,
145 gray30, gray30_dash1, gray30_dash2,
147 gray70_dash3, gray10_dash3, gray50_dash3, gray90_dash3)
148 for style in standards.list():
149 style.width = theme.default_line_width
155 _name_table = pychart_util.symbol_lookup_table(globals(), standards)
159 theme.add_reinitialization_hook(init)