summaryrefslogtreecommitdiffstats
path: root/viz/format.py
diff options
context:
space:
mode:
authorGary Bressler <garybressler@nc.rr.com>2010-03-01 23:46:44 -0500
committerGary Bressler <garybressler@nc.rr.com>2010-03-01 23:46:44 -0500
commit44a8ade3ed5dc4810fd95c41dbe8ec3aa2fb0cf7 (patch)
tree4275bbcb03ec58412c3703e4df68f43fb1c10089 /viz/format.py
Reorganized tree, along with the visualizer
Diffstat (limited to 'viz/format.py')
-rw-r--r--viz/format.py92
1 files changed, 92 insertions, 0 deletions
diff --git a/viz/format.py b/viz/format.py
new file mode 100644
index 0000000..fed39f0
--- /dev/null
+++ b/viz/format.py
@@ -0,0 +1,92 @@
1"""Various formatting parameters intended to be accessible by the client."""
2
3class FontOptions(object):
4 """Class for combining assorted simple font options."""
5 def __init__(self, name, size, color):
6 self.name = name
7 self.size = size
8 self.color = color
9
10class AlignMode(object):
11 """Type that specifies the way something (probably text)
12 should be aligned, horizontally and/or vertically."""
13 LEFT = 0
14 CENTER = 1
15 RIGHT = 2
16
17 BOTTOM = 3
18 TOP = 4
19
20class GraphFormat(object):
21 """Container class for a bunch of optional and non-optional attributes to configure the appearance of the graph
22 (because it would be annoying to just have these all as raw arguments to the Graph constructor, and many people
23 probably don't care about most of them anyway)."""
24
25 GRID_COLOR = (0.7, 0.7, 0.7)
26 HIGHLIGHT_COLOR = (0.8, 0.0, 0.0)
27 BORDER_COLOR = (0.0, 0.0, 0.0)
28 LITE_BORDER_COLOR = (0.4, 0.4, 0.4)
29
30 BORDER_THICKNESS = 1
31 GRID_THICKNESS = 1
32 AXIS_THICKNESS = 1
33
34 X_AXIS_MEASURE_OFS = 30
35 X_AXIS_LABEL_GAP = 10
36 Y_AXIS_ITEM_GAP = 10
37 MAJ_TICK_SIZE = 20
38 MIN_TICK_SIZE = 12
39
40 BIG_ARROWHEAD_FACTOR = 0.2
41 SMALL_ARROWHEAD_FACTOR = 0.3
42 TEE_FACTOR = 0.3
43
44 DEF_FOPTS_LABEL = FontOptions("Times", 16, (0.0, 0.0, 0.0))
45 DEF_FOPTS_LABEL_SSCRIPT = FontOptions("Times", 8, (0.0, 0.0, 0.0))
46 DEF_FOPTS_MAJ = FontOptions("Times", 14, (0.1, 0.1, 0.1))
47 DEF_FOPTS_MIN = FontOptions("Times", 9, (0.1, 0.1, 0.1))
48 DEF_FOPTS_ITEM = FontOptions("Times", 20, (0.0, 0.5, 0.1))
49 DEF_FOPTS_BAR = FontOptions("Times", 14, (0.0, 0.0, 0.0))
50 DEF_FOPTS_BAR_SSCRIPT = FontOptions("Times", 7, (0.0, 0.0, 0.0))
51 DEF_FOPTS_MINI_BAR = FontOptions("Times", 11, (0.0, 0.0, 0.0))
52 DEF_FOPTS_MINI_BAR_SSCRIPT = FontOptions("Times", 7, (0.0, 0.0, 0.0))
53 DEF_FOPTS_ARROW = FontOptions("Times", 12, (0.0, 0.0, 0.0))
54 DEF_FOPTS_ARROW_SSCRIPT = FontOptions("Times", 7, (0.0, 0.0, 0.0))
55
56 LEFT_SIDE_PAD = 30
57 WIDTH_PAD = 50
58 HEIGHT_PAD = 150
59 Y_ITEM_PAD_FACTOR = 0.5
60
61 DEF_TIME_PER_MAJ = 10
62 DEF_MAJ_SEP = 200
63 DEF_MIN_PER_MAJ = 5
64 DEF_Y_ITEM_SIZE = 50
65
66 AXIS_LABEL_VERT_OFS = 30
67 BAR_SIZE_FACTOR = 0.4
68 MINI_BAR_SIZE_FACTOR = 0.2
69 BAR_MINI_BAR_GAP_FACTOR = 0.1
70
71 BAR_LABEL_OFS = 2
72 MINI_BAR_LABEL_OFS = 1
73 ARROW_LABEL_OFS = 2
74
75 BLOCK_TRIANGLE_FACTOR = 0.7
76 BIG_ARROW_FACTOR = 1.6
77 SMALL_ARROW_FACTOR = 0.6
78 COMPLETION_MARKER_FACTOR = 1.6
79
80 def __init__(self, time_per_maj=DEF_TIME_PER_MAJ, maj_sep=DEF_MAJ_SEP, \
81 min_per_maj=DEF_MIN_PER_MAJ, y_item_size=DEF_Y_ITEM_SIZE, bar_fopts=DEF_FOPTS_BAR, \
82 item_fopts=DEF_FOPTS_ITEM, show_min=False, majfopts=DEF_FOPTS_MAJ, \
83 minfopts=DEF_FOPTS_MIN):
84 self.time_per_maj = time_per_maj
85 self.maj_sep = maj_sep
86 self.min_per_maj = min_per_maj
87 self.y_item_size = y_item_size
88 self.item_fopts = item_fopts
89 self.bar_fopts = bar_fopts
90 self.show_min = show_min
91 self.majfopts = majfopts
92 self.minfopts = minfopts