module timelinelib.canvas.drawing.drawers.ballondrawer

timelinelib.canvas.drawing.drawers.ballondrawer.BALLOON_RADIUS = 12
timelinelib.canvas.drawing.drawers.ballondrawer.ARROW_OFFSET = 37
timelinelib.canvas.drawing.drawers.ballondrawer.MIN_TEXT_WIDTH = 200
timelinelib.canvas.drawing.drawers.ballondrawer.SLIDER_WIDTH = 20
class timelinelib.canvas.drawing.drawers.ballondrawer.BallonDrawer[source]

Bases: object

__init__(dc, scene, appearance, event)[source]

Initialize self. See help(type(self)) for accurate signature.

draw(event_rect, sticky)[source]

Draw one ballon on a selected event that has ‘description’ data.

get_icon_size()[source]
max_text_width(event_rect, icon_width)[source]
get_description_lines(max_text_width, iw)[source]
calc_inner_rect(lines, w, h, max_text_width)[source]
draw_balloon_bg(inner_size, tip_pos, above, sticky)[source]

Draw the balloon background leaving inner_size for content.

tip_pos determines where the tip of the ballon should be.

above determines if the balloon should be above the tip (True) or below (False). This is not currently implemented.

W

|----------------|

______________ _

/ | R = Corner Radius

| | AA = Left Arrow-leg angle
W_ARROW | | H MARGIN = Text margin
|--| | | * = Starting point ____ ______/ _ / / | /_/ | H_ARROW * -

|----| ARROW_OFFSET

Calculation of points starts at the tip of the arrow and continues clockwise around the ballon.

Return (bounding_rect, x, y) where x and y is at top of inner region.

draw_icon(x, y)[source]
draw_description(lines, x, y)[source]
adjust_text_x_pos_when_icon_is_present(x)[source]
draw_lines(lines, x, y)[source]
timelinelib.canvas.drawing.drawers.ballondrawer.break_text(text, dc, max_width_in_px)[source]

Break the text into lines so that they fits within the given width.

timelinelib.canvas.drawing.drawers.ballondrawer.break_sentence(dc, lines, sentence, max_width_in_px)[source]

Break a sentence into lines.

timelinelib.canvas.drawing.drawers.ballondrawer.break_line(dc, sentence, max_word_len_in_ch)[source]

Break a sentence into words.

timelinelib.canvas.drawing.drawers.ballondrawer.break_word(dc, word, max_word_len_in_ch)[source]

Break words if they are too long.

If a single word is too long to fit we have to break it. If not we just return the word given.

timelinelib.canvas.drawing.drawers.ballondrawer.get_max_word_length(dc, max_width_in_px)[source]