1 | # This program is free software; you can redistribute it and/or modify
|
---|
2 | # it under the terms of the GNU General Public License as published by
|
---|
3 | # the Free Software Foundation; version 2 of the License.
|
---|
4 | #
|
---|
5 | # This program is distributed in the hope that it will be useful,
|
---|
6 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
7 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
8 | # GNU General Public License for more details.
|
---|
9 | #
|
---|
10 | # Author: Emanuel Fonseca
|
---|
11 | # Email: emdfonseca<at>gmail<dot>com
|
---|
12 | # Date: 25 August 2008
|
---|
13 |
|
---|
14 | class element(dict):
|
---|
15 | def __init__(self, type=None, alpha=None, colour=None, text=None, fontsize=None, values=None):
|
---|
16 | self.set_type(type)
|
---|
17 | self.set_alpha(alpha)
|
---|
18 | self.set_colour(colour)
|
---|
19 | self.set_text(text)
|
---|
20 | self.set_fontsize(fontsize)
|
---|
21 | self.set_values(values)
|
---|
22 |
|
---|
23 | def set_type(self, type):
|
---|
24 | if type:
|
---|
25 | self['type'] = type
|
---|
26 |
|
---|
27 | def set_alpha(self, alpha):
|
---|
28 | if alpha:
|
---|
29 | self['alpha'] = alpha
|
---|
30 |
|
---|
31 | def set_colour(self, colour):
|
---|
32 | if colour:
|
---|
33 | self['colour'] = colour
|
---|
34 |
|
---|
35 | def set_text(self, text):
|
---|
36 | if text:
|
---|
37 | self['text'] = text
|
---|
38 |
|
---|
39 | def set_fontsize(self, fontsize):
|
---|
40 | if fontsize:
|
---|
41 | self['font-size'] = fontsize
|
---|
42 |
|
---|
43 | def set_values(self, values):
|
---|
44 | if values:
|
---|
45 | self['values'] = values
|
---|
46 |
|
---|
47 | class Line(element):
|
---|
48 | def __init__(self, type=None, alpha=None, colour=None, text=None, fontsize=None, values=None):
|
---|
49 | element.__init__(self, 'line', alpha, colour, text, fontsize, values)
|
---|
50 |
|
---|
51 | class Bar(element):
|
---|
52 | def __init__(self, type=None, alpha=None, colour=None, text=None, fontsize=None, values=None):
|
---|
53 | element.__init__(self, 'bar', alpha, colour, text, fontsize, values)
|
---|
54 |
|
---|
55 | class BarStack(element):
|
---|
56 | def __init__(self, type=None, alpha=None, colour=None, text=None, fontsize=None, values=None):
|
---|
57 | element.__init__(self, 'bar_stack', alpha, colour, text, fontsize, values)
|
---|