module timelinelib.canvas.drawing.interface¶
Defines the interface that drawers should adhere to.
-
class
timelinelib.canvas.drawing.interface.
Drawer
[source]¶ Bases:
object
Draw timeline onto a device context and provide information about drawing.
-
draw
(dc, timeline, view_properties, config, fast_draw=False)[source]¶ Draw a representation of a timeline.
The dc is used to do the actual drawing. The timeline is used to get the events to visualize. The view properties contains information like which events are selected in the view we are drawing for and what period is currently displayed.
When the dc is temporarily stored in a class variable such as self.dc, this class variable must be deleted before the draw method ends.
-
event_is_period
(time_period)[source]¶ Return True if the event time_period will make the event appear below the center line, as a period event.
-
snap_selection
(period_selection)[source]¶ Return a tuple where the selection has been stretched to fit to minor strip.
period_selection: (start, end) Return: (new_start, new_end)
-
event_with_rect_at
(x, y)[source]¶ Return the event at pixel coordinate (x, y) and its rect in a tuple (event, rect) or None if no event there.
-
-
class
timelinelib.canvas.drawing.interface.
Strip
[source]¶ Bases:
object
An interface for strips.
The different strips are implemented in subclasses below.
The timeline is divided in major and minor strips. The minor strip might for example be days, and the major strip months. Major strips are divided with a solid line and minor strips with dotted lines. Typically maximum three major strips should be shown and the rest will be minor strips.
-
label
(time, major=False)[source]¶ Return the label for this strip at the given time when used as major or minor strip.
-