Gnumed.timelinelib.canvas.drawing.interface.Drawer

Package Gnumed :: Package timelinelib :: Package canvas :: Package drawing :: Module interface :: Class Drawer |
[frames] | no frames]

# Class Drawer

source code

    object --+
             |
            Drawer

Draw timeline onto a device context and provide information about drawing.

Instance Methods
draw(self, dc, timeline, view_properties, config, fast_draw=False) Draw a representation of a timeline. | source code
event_is_period(self, time_period) Return True if the event time_period will make the event appear below the center line, as a period event. | source code
snap(self, time, snap_region=10) Snap time to minor strip if within snap_region pixels. | source code
snap_selection(self, period_selection) Return a tuple where the selection has been stretched to fit to minor strip. | source code
event_at(self, x, y) Return the event at pixel coordinate (x, y) or None if no event there. | source code
event_with_rect_at(self, x, y) Return the event at pixel coordinate (x, y) and its rect in a tuple (event, rect) or None if no event there. | source code
event_rect_at(self, event) Return the rect for the given event or None if no event isn't found. | source code
is_balloon_at(self, event, x, y) Return True if a balloon for event is drawn at (x, y), otherwise False. | source code
get_closest_overlapping_event(self, event_to_move, up=True) | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__init__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
Inherited from `object`: `__class__`

Method Details

### draw(self, dc, timeline, view_properties, config, fast_draw=False) | source code
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.

### snap_selection(self, period_selection) | source code
Return a tuple where the selection has been stretched to fit to minor strip. period_selection: (start, end) Return: (new_start, new_end)