1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 """
20 Defines the interface that drawers should adhere to.
21 """
22
23
25 """
26 Draw timeline onto a device context and provide information about drawing.
27 """
28
29 - def draw(self, dc, timeline, view_properties, config):
30 """
31 Draw a representation of a timeline.
32
33 The dc is used to do the actual drawing. The timeline is used to get
34 the events to visualize. The view properties contains information like
35 which events are selected in the view we are drawing for and what
36 period is currently displayed.
37
38 When the dc is temporarily stored in a class variable such as self.dc,
39 this class variable must be deleted before the draw method ends.
40 """
41
43 self.fast_draw = value
44
46 """
47 Return True if the event time_period will make the event appear
48 below the center line, as a period event.
49 """
50 return None
51
52 - def snap(self, time, snap_region=10):
53 """Snap time to minor strip if within snap_region pixels."""
54 return time
55
57 """
58 Return a tuple where the selection has been stretched to fit to minor
59 strip.
60
61 period_selection: (start, end)
62 Return: (new_start, new_end)
63 """
64 return period_selection
65
67 """
68 Return the event at pixel coordinate (x, y) or None if no event there.
69 """
70 return None
71
73 """
74 Return the event at pixel coordinate (x, y) and its rect in a tuple
75 (event, rect) or None if no event there.
76 """
77 return None
78
80 """
81 Return the rect for the given event or None if no event isn't found.
82 """
83 return None
84
86 """
87 Return True if a balloon for event is drawn at (x, y), otherwise False.
88 """
89
91 raise NotImplementedError()
92
93
95 """
96 An interface for strips.
97
98 The different strips are implemented in subclasses below.
99
100 The timeline is divided in major and minor strips. The minor strip might
101 for example be days, and the major strip months. Major strips are divided
102 with a solid line and minor strips with dotted lines. Typically maximum
103 three major strips should be shown and the rest will be minor strips.
104 """
105
106 - def label(self, time, major=False):
107 """
108 Return the label for this strip at the given time when used as major or
109 minor strip.
110 """
111
113 """
114 Return the start time for this strip and the given time.
115
116 For example, if the time is 2008-08-31 and the strip is month, the
117 start would be 2008-08-01.
118 """
119
121 """
122 Increment the given time so that it points to the start of the next
123 strip.
124 """
125
127 """
128 Return the preferred font for this strip
129 """
130