GooCanvas.CanvasItemSimple

g GObject.GInterface GObject.GInterface GooCanvas.CanvasItem GooCanvas.CanvasItem GObject.GInterface->GooCanvas.CanvasItem GObject.Object GObject.Object GooCanvas.CanvasItemSimple GooCanvas.CanvasItemSimple GObject.Object->GooCanvas.CanvasItemSimple GooCanvas.CanvasItem->GooCanvas.CanvasItemSimple

Subclasses:

GooCanvas.CanvasEllipse, GooCanvas.CanvasGrid, GooCanvas.CanvasGroup, GooCanvas.CanvasImage, GooCanvas.CanvasPath, GooCanvas.CanvasPolyline, GooCanvas.CanvasRect, GooCanvas.CanvasText, GooCanvas.CanvasWidget

Methods

Inherited:

GObject.Object (37), GooCanvas.CanvasItem (48)

Structs:

GObject.ObjectClass (5)

changed (recompute_bounds)

check_in_path (x, y, cr, pointer_events)

check_style ()

get_line_width ()

get_path_bounds (cr, bounds)

paint_path (cr)

set_model (model)

user_bounds_to_device (cr, bounds)

user_bounds_to_parent (cr, bounds)

Virtual Methods

Inherited:

GObject.Object (7), GooCanvas.CanvasItem (44)

do_simple_create_path (cr)

do_simple_is_item_at (x, y, cr, is_pointer_event)

do_simple_paint (cr, bounds)

do_simple_update (cr)

Properties

Inherited:

GooCanvas.CanvasItem (9)

Name

Type

Flags

Short Description

antialias

GooCanvas.CairoAntialias

r/w

The antialiasing mode to use

clip-fill-rule

GooCanvas.CairoFillRule

r/w

The fill rule used to determine which parts of the item are clipped

clip-path

str

w

The sequence of path commands specifying the clip path

fill-color

str

w

The color to use to paint the interior of the item. To disable painting set the ‘fill-pattern’ property to None

fill-color-gdk-rgba

Gdk.RGBA

r/w

The color to use to paint the interior of the item, specified as a Gdk.RGBA. To disable painting set the ‘fill-pattern’ property to None

fill-color-rgba

int

r/w

The color to use to paint the interior of the item, specified as a 32-bit integer value. To disable painting set the ‘fill-pattern’ property to None

fill-pattern

r/w

The pattern to use to paint the interior of the item, or None to disable painting

fill-pixbuf

GdkPixbuf.Pixbuf

w

The pixbuf to use to paint the interior of the item. To disable painting set the ‘fill-pattern’ property to None

fill-rule

GooCanvas.CairoFillRule

r/w

The fill rule used to determine which parts of the item are filled

font

str

r/w

The base font to use for the text

font-desc

Pango.FontDescription

r/w

The attributes specifying which font to use

hint-metrics

GooCanvas.CairoHintMetrics

r/w

The hinting to be used for font metrics

line-cap

GooCanvas.CairoLineCap

r/w

The line cap style to use

line-dash

GooCanvas.CanvasLineDash

r/w

The dash pattern to use

line-join

GooCanvas.CairoLineJoin

r/w

The line join style to use

line-join-miter-limit

float

r/w

The smallest angle to use with miter joins, in degrees. Bevel joins will be used below this limit

line-width

float

r/w

The line width to use for the item’s perimeter

operator

GooCanvas.CairoOperator

r/w

The compositing operator to use

stroke-color

str

w

The color to use for the item’s perimeter. To disable painting set the ‘stroke-pattern’ property to None

stroke-color-gdk-rgba

Gdk.RGBA

r/w

The color to use for the item’s perimeter, specified as a Gdk.RGBA. To disable painting set the ‘stroke-pattern’ property to None

stroke-color-rgba

int

r/w

The color to use for the item’s perimeter, specified as a 32-bit integer value. To disable painting set the ‘stroke-pattern’ property to None

stroke-pattern

r/w

The pattern to use to paint the perimeter of the item, or None disable painting

stroke-pixbuf

GdkPixbuf.Pixbuf

w

The pixbuf to use to draw the item’s perimeter. To disable painting set the ‘stroke-pattern’ property to None

Signals

Inherited:

GObject.Object (1), GooCanvas.CanvasItem (14)

Fields

Inherited:

GObject.Object (1), GooCanvas.CanvasItem (14)

Name

Type

Access

Description

bounds

GooCanvas.CanvasBounds

r

the bounds of the item, in device space.

canvas

GooCanvas.Canvas

r

the canvas.

model

GooCanvas.CanvasItemModelSimple

r

the item’s model, if it has one.

need_entire_subtree_update

int

r

if all descendants need to be updated.

need_update

int

r

if the item needs to recompute its bounds and redraw.

parent

GooCanvas.CanvasItem

r

the parent item.

parent_object

GObject.Object

r

priv

object

r

simple_data

GooCanvas.CanvasItemSimpleData

r

data that is common to both the model and view classes. If the canvas item has a model, this will point to the model’s GooCanvas.CanvasItemSimpleData, otherwise the canvas item will have its own GooCanvas.CanvasItemSimpleData.

Class Details

class GooCanvas.CanvasItemSimple(**kwargs)
Bases:

GObject.Object, GooCanvas.CanvasItem

Abstract:

No

Structure:

GooCanvas.CanvasItemSimpleClass

GooCanvas.CanvasItemSimple is used as a base class for all of the standard canvas items. It can also be used as the base class for new custom canvas items.

It provides default implementations for many of the GooCanvas.CanvasItem methods.

For very GooCanvas.simple items, all that is needed is to implement the create_path() method. (GooCanvas.CanvasEllipse, GooCanvas.CanvasRect and GooCanvas.CanvasPath do this.)

More complicated items need to implement the update(), paint() and is_item_at() methods instead. (GooCanvas.CanvasImage, GooCanvas.CanvasPolyline, GooCanvas.CanvasText and GooCanvas.CanvasWidget do this.) They may also need to override some of the other GooCanvas.CanvasItem methods such as set_canvas(), set_parent() or allocate_area() if special code is needed. (GooCanvas.CanvasWidget does this to make sure the Gtk.Widget is embedded in the GooCanvas.Canvas widget correctly.)

changed(recompute_bounds)
Parameters:

recompute_bounds (bool) – if the item’s bounds need to be recomputed.

This function is intended to be used by subclasses of GooCanvas.CanvasItemSimple.

It is used as a callback for the “changed” signal of the item models. It requests an update or redraw of the item as appropriate.

check_in_path(x, y, cr, pointer_events)
Parameters:
Returns:

True if the given point is in the current path.

Return type:

bool

This function is intended to be used by subclasses of GooCanvas.CanvasItemSimple.

It checks if the given point is in the current path, using the item’s style settings.

check_style()

This function is intended to be used by subclasses of GooCanvas.CanvasItemSimple, typically in their update() or get_requested_area() methods.

It ensures that the item’s style is setup correctly. If the item has its own GooCanvas.CanvasStyle it makes sure the parent is set correctly. If it doesn’t have its own style it uses the parent item’s style.

get_line_width()
Returns:

the item’s line width.

Return type:

float

Gets the item’s line width.

get_path_bounds(cr, bounds)
Parameters:

This function is intended to be used by subclasses of GooCanvas.CanvasItemSimple, typically in their update() or get_requested_area() methods.

It calculates the bounds of the current path, using the item’s style settings, and stores the results in the given GooCanvas.CanvasBounds struct.

The returned bounds contains the bounding box of the path in device space, converted to user space coordinates. To calculate the bounds completely in user space, use cairo.Context.identity_matrix() to temporarily reset the current transformation matrix to the identity matrix.

paint_path(cr)
Parameters:

cr (cairo.Context) – a cairo context.

This function is intended to be used by subclasses of GooCanvas.CanvasItemSimple.

It paints the current path, using the item’s style settings.

set_model(model)
Parameters:

model (GooCanvas.CanvasItemModel) – the model that self will view.

This function should be called by subclasses of GooCanvas.CanvasItemSimple in their set_model() method.

user_bounds_to_device(cr, bounds)
Parameters:

This function is intended to be used by subclasses of GooCanvas.CanvasItemSimple, typically in their update() or get_requested_area() methods.

It converts the item’s bounds to a bounding box in the canvas (device) coordinate space.

user_bounds_to_parent(cr, bounds)
Parameters:

This function is intended to be used by subclasses of GooCanvas.CanvasItemSimple, typically in their get_requested_area() method.

It converts the item’s bounds to a bounding box in its parent’s coordinate space. If the item has no transformation matrix set then no conversion is needed.

do_simple_create_path(cr) virtual
Parameters:

cr (cairo.Context) –

do_simple_is_item_at(x, y, cr, is_pointer_event) virtual
Parameters:
Return type:

bool

do_simple_paint(cr, bounds) virtual
Parameters:
do_simple_update(cr) virtual
Parameters:

cr (cairo.Context) –

Property Details

GooCanvas.CanvasItemSimple.props.antialias
Name:

antialias

Type:

GooCanvas.CairoAntialias

Default Value:

GooCanvas.CairoAntialias.GRAY

Flags:

READABLE, WRITABLE

The antialiasing mode to use

GooCanvas.CanvasItemSimple.props.clip_fill_rule
Name:

clip-fill-rule

Type:

GooCanvas.CairoFillRule

Default Value:

GooCanvas.CairoFillRule.WINDING

Flags:

READABLE, WRITABLE

The fill rule used to determine which parts of the item are clipped

GooCanvas.CanvasItemSimple.props.clip_path
Name:

clip-path

Type:

str

Default Value:

None

Flags:

WRITABLE

The sequence of commands describing the clip path of the item, specified as a string using the same syntax as in the Scalable Vector Graphics (SVG) path element.

GooCanvas.CanvasItemSimple.props.fill_color
Name:

fill-color

Type:

str

Default Value:

None

Flags:

WRITABLE

The color to use to paint the interior of the item. To disable painting set the ‘fill-pattern’ property to None

GooCanvas.CanvasItemSimple.props.fill_color_gdk_rgba
Name:

fill-color-gdk-rgba

Type:

Gdk.RGBA

Default Value:

None

Flags:

READABLE, WRITABLE

The color to use to paint the interior of the item, specified as a Gdk.RGBA. To disable painting set the ‘fill-pattern’ property to None.

New in version 2.0.1.

GooCanvas.CanvasItemSimple.props.fill_color_rgba
Name:

fill-color-rgba

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

The color to use to paint the interior of the item, specified as a 32-bit integer value. To disable painting set the ‘fill-pattern’ property to None

GooCanvas.CanvasItemSimple.props.fill_pattern
Name:

fill-pattern

Type:

Default Value:

None

Flags:

READABLE, WRITABLE

The pattern to use to paint the interior of the item, or None to disable painting

GooCanvas.CanvasItemSimple.props.fill_pixbuf
Name:

fill-pixbuf

Type:

GdkPixbuf.Pixbuf

Default Value:

None

Flags:

WRITABLE

The pixbuf to use to paint the interior of the item. To disable painting set the ‘fill-pattern’ property to None

GooCanvas.CanvasItemSimple.props.fill_rule
Name:

fill-rule

Type:

GooCanvas.CairoFillRule

Default Value:

GooCanvas.CairoFillRule.WINDING

Flags:

READABLE, WRITABLE

The fill rule used to determine which parts of the item are filled

GooCanvas.CanvasItemSimple.props.font
Name:

font

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The base font to use for the text

GooCanvas.CanvasItemSimple.props.font_desc
Name:

font-desc

Type:

Pango.FontDescription

Default Value:

None

Flags:

READABLE, WRITABLE

The attributes specifying which font to use

GooCanvas.CanvasItemSimple.props.hint_metrics
Name:

hint-metrics

Type:

GooCanvas.CairoHintMetrics

Default Value:

GooCanvas.CairoHintMetrics.OFF

Flags:

READABLE, WRITABLE

The hinting to be used for font metrics

GooCanvas.CanvasItemSimple.props.line_cap
Name:

line-cap

Type:

GooCanvas.CairoLineCap

Default Value:

GooCanvas.CairoLineCap.BUTT

Flags:

READABLE, WRITABLE

The line cap style to use

GooCanvas.CanvasItemSimple.props.line_dash
Name:

line-dash

Type:

GooCanvas.CanvasLineDash

Default Value:

None

Flags:

READABLE, WRITABLE

The dash pattern to use

GooCanvas.CanvasItemSimple.props.line_join
Name:

line-join

Type:

GooCanvas.CairoLineJoin

Default Value:

GooCanvas.CairoLineJoin.MITER

Flags:

READABLE, WRITABLE

The line join style to use

GooCanvas.CanvasItemSimple.props.line_join_miter_limit
Name:

line-join-miter-limit

Type:

float

Default Value:

10.0

Flags:

READABLE, WRITABLE

The smallest angle to use with miter joins, in degrees. Bevel joins will be used below this limit

GooCanvas.CanvasItemSimple.props.line_width
Name:

line-width

Type:

float

Default Value:

2.0

Flags:

READABLE, WRITABLE

The line width to use for the item’s perimeter

GooCanvas.CanvasItemSimple.props.operator
Name:

operator

Type:

GooCanvas.CairoOperator

Default Value:

GooCanvas.CairoOperator.OVER

Flags:

READABLE, WRITABLE

The compositing operator to use

GooCanvas.CanvasItemSimple.props.stroke_color
Name:

stroke-color

Type:

str

Default Value:

None

Flags:

WRITABLE

The color to use for the item’s perimeter. To disable painting set the ‘stroke-pattern’ property to None

GooCanvas.CanvasItemSimple.props.stroke_color_gdk_rgba
Name:

stroke-color-gdk-rgba

Type:

Gdk.RGBA

Default Value:

None

Flags:

READABLE, WRITABLE

The color to use for the item’s perimeter, specified as a Gdk.RGBA. To disable painting set the ‘stroke-pattern’ property to None.

New in version 2.0.1.

GooCanvas.CanvasItemSimple.props.stroke_color_rgba
Name:

stroke-color-rgba

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

The color to use for the item’s perimeter, specified as a 32-bit integer value. To disable painting set the ‘stroke-pattern’ property to None

GooCanvas.CanvasItemSimple.props.stroke_pattern
Name:

stroke-pattern

Type:

Default Value:

None

Flags:

READABLE, WRITABLE

The pattern to use to paint the perimeter of the item, or None disable painting

GooCanvas.CanvasItemSimple.props.stroke_pixbuf
Name:

stroke-pixbuf

Type:

GdkPixbuf.Pixbuf

Default Value:

None

Flags:

WRITABLE

The pixbuf to use to draw the item’s perimeter. To disable painting set the ‘stroke-pattern’ property to None