GooCanvas.CanvasItemModel¶
- Implementations:
Methods¶
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
If the item can take the keyboard focus |
||
r/w |
A description of the item for use by assistive technologies |
||
r/w |
The parent item model |
||
r/w |
Specifies when the item receives pointer events |
||
r/w |
A short context-rich description of the item for use by assistive technologies |
||
r/w |
The tooltip to display for the item |
||
r/w |
The transformation matrix of the item |
||
r/w |
When the canvas item is visible |
||
r/w |
The scale threshold at which the item becomes visible |
Signals¶
Name |
Short Description |
---|---|
Emitted when the item model animation has finished. |
|
Emitted when the item model has been changed. |
|
Emitted when a child has been added. |
|
Emitted when a child has been moved in the stacking order. |
|
Emitted for each child property that has changed. |
|
Emitted when a child has been removed. |
Fields¶
None
Class Details¶
- class GooCanvas.CanvasItemModel¶
- Bases:
- Structure:
GooCanvas.CanvasItemModel
defines the interface that models for canvas items must implement, and contains methods for operating on canvas item models.The Model/View canvas feature may be removed in a future version of
GooCanvas.Canvas
.- classmethod class_find_child_property(mclass, property_name)¶
- Parameters:
mclass (
GObject.ObjectClass
) – aGObject.ObjectClass
property_name (
str
) – the name of the child property to find
- Returns:
The
GObject.ParamSpec
of the child property orNone
if class has no child property with that name.- Return type:
This function is only intended to be used when implementing new canvas item models, specifically layout container item models such as
GooCanvas.CanvasTableModel
.It finds a child property of a canvas item class by name.
- classmethod class_install_child_property(mclass, property_id, pspec)¶
- Parameters:
mclass (
GObject.ObjectClass
) – aGObject.ObjectClass
property_id (
int
) – the id for the propertypspec (
GObject.ParamSpec
) – theGObject.ParamSpec
for the property
This function is only intended to be used when implementing new canvas item models, specifically layout container item models such as
GooCanvas.CanvasTableModel
.It installs a child property on a canvas item class.
- classmethod class_list_child_properties(mclass)¶
- Parameters:
mclass (
GObject.ObjectClass
) – aGObject.ObjectClass
- Returns:
a newly allocated array of
GObject.ParamSpec
. The array must be freed withGLib.free
().- Return type:
This function is only intended to be used when implementing new canvas item models, specifically layout container item models such as
GooCanvas.CanvasTableModel
.It returns all child properties of a canvas item class.
- add_child(child, position)¶
- Parameters:
child (
GooCanvas.CanvasItemModel
) – the child to add.position (
int
) – the position of the child, or -1 to place it last (at the top of the stacking order).
Adds a child at the given stack position.
- animate(x, y, scale, degrees, absolute, duration, step_time, type)¶
- Parameters:
x (
float
) – the final x coordinate.y (
float
) – the final y coordinate.scale (
float
) – the final scale.degrees (
float
) – the final rotation. This can be negative to rotate anticlockwise, and can also be greater than 360 to rotate a number of times.absolute (
bool
) – if the x, y, scale and degrees values are absolute, or relative to the current transform. Note that absolute animations only work if the model currently has aGooCanvas.simple
transform. If the model has a shear or some other complicated transform it may result in strange animations.duration (
int
) – the duration of the animation, in milliseconds (1/1000ths of a second).step_time (
int
) – the time between each animation step, in milliseconds.type (
GooCanvas.CanvasAnimateType
) – specifies what happens when the animation finishes.
Animates a model from its current position to the given offsets, scale and rotation.
- find_child(child)¶
- Parameters:
child (
GooCanvas.CanvasItemModel
) – the child to find.- Returns:
the position of the given child, or -1 if it isn’t found.
- Return type:
Attempts to find the given child with the container’s stack.
- get_child(child_num)¶
- Parameters:
child_num (
int
) – the position of a child in the container’s stack.- Returns:
the child at the given stack position, or
None
if child_num is out of range.- Return type:
Gets the child at the given stack position.
- get_child_property(child, property_name, value)¶
- Parameters:
child (
GooCanvas.CanvasItemModel
) – a childGooCanvas.CanvasItemModel
.property_name (
str
) – the name of the child property to get.value (
GObject.Value
) – a location to return the value.
Gets a child property of child.
- get_n_children()¶
- Returns:
the number of children.
- Return type:
Gets the number of children of the container.
- get_parent()¶
- Returns:
the parent model, or
None
if the model has no parent.- Return type:
Gets the parent of the given model.
- get_simple_transform(x, y, scale, rotation)¶
- Parameters:
- Returns:
True
if a transform is set.- Return type:
This function can be used to get the position, scale and rotation of an item model, providing that the model has a
GooCanvas.simple
transformation matrix (e.g. set withGooCanvas.CanvasItemModel.set_simple_transform
(), or using a combination ofGooCanvas.simple
translate, scale and rotate operations). If the model has a complex transformation matrix the results will be incorrect.
- get_style()¶
- Returns:
the model’s style.
- Return type:
Gets the model’s style. If the model doesn’t have its own style it will return its parent’s style.
- get_transform(transform)¶
- Parameters:
transform (
cairo.Matrix
) – the place to store the transform.- Returns:
True
if a transform is set.- Return type:
Gets the transformation matrix of an item model.
- is_container()¶
-
Tests to see if the given item model is a container.
- lower(below)¶
- Parameters:
below (
GooCanvas.CanvasItemModel
orNone
) – the item model to lower self below, orNone
to lower self to the bottom of the stack.
Lowers a model in the stacking order.
- move_child(old_position, new_position)¶
- Parameters:
Moves a child to a new stack position.
- raise_(above)¶
- Parameters:
above (
GooCanvas.CanvasItemModel
orNone
) – the item model to raise self above, orNone
to raise self to the top of the stack.
Raises a model in the stacking order.
- remove()¶
Removes a model from its parent. If the model is in a canvas it will be removed.
This would normally also result in the model being freed.
- remove_child(child_num)¶
- Parameters:
child_num (
int
) – the position of the child to remove.
Removes the child at the given position.
- rotate(degrees, cx, cy)¶
- Parameters:
Rotates the model’s coordinate system by the given amount, about the given origin.
- scale(sx, sy)¶
- Parameters:
Scales the model’s coordinate system by the given amounts.
- set_child_property(child, property_name, value)¶
- Parameters:
child (
GooCanvas.CanvasItemModel
) – a childGooCanvas.CanvasItemModel
.property_name (
str
) – the name of the child property to set.value (
GObject.Value
) – the value to set the property to.
Sets a child property of child.
- set_parent(parent)¶
- Parameters:
parent (
GooCanvas.CanvasItemModel
) – the new parent item model.
This function is only intended to be used when implementing new canvas item models (specifically container models such as
GooCanvas.CanvasGroupModel
). It sets the parent of the child model.This function cannot be used to add a model to a group or to change the parent of a model. To do that use the
GooCanvas.CanvasItemModel
:parent
property.
- set_simple_transform(x, y, scale, rotation)¶
- Parameters:
A convenience function to set the item model’s transformation matrix.
- set_style(style)¶
- Parameters:
style (
GooCanvas.CanvasStyle
) – a style.
Sets the model’s style, by copying the properties from the given style.
- set_transform(transform)¶
- Parameters:
transform (
cairo.Matrix
orNone
) – the new transformation matrix, orNone
to reset the transformation to the identity matrix.
Sets the transformation matrix of an item model.
- skew_x(degrees, cx, cy)¶
- Parameters:
Skews the model’s coordinate system along the x axis by the given amount, about the given origin.
- skew_y(degrees, cx, cy)¶
- Parameters:
Skews the model’s coordinate system along the y axis by the given amount, about the given origin.
- stop_animation()¶
Stops any current animation for the given model, leaving it at its current position.
- translate(tx, ty)¶
- Parameters:
Translates the origin of the model’s coordinate system by the given amounts.
- do_add_child(child, position) virtual¶
- Parameters:
child (
GooCanvas.CanvasItemModel
) – the child to add.position (
int
) – the position of the child, or -1 to place it last (at the top of the stacking order).
Adds a child at the given stack position.
- do_child_moved(old_child_num, new_child_num) virtual¶
- do_child_notify(pspec) virtual¶
- Parameters:
pspec (
GObject.ParamSpec
) –
- do_get_child(child_num) virtual¶
- Parameters:
child_num (
int
) – the position of a child in the container’s stack.- Returns:
the child at the given stack position, or
None
if child_num is out of range.- Return type:
Gets the child at the given stack position.
- do_get_child_property(child, property_id, value, pspec) virtual¶
- Parameters:
child (
GooCanvas.CanvasItemModel
) –property_id (
int
) –value (
GObject.Value
) –pspec (
GObject.ParamSpec
) –
- do_get_n_children() virtual¶
- Returns:
the number of children.
- Return type:
Gets the number of children of the container.
- do_get_parent() virtual¶
- Returns:
the parent model, or
None
if the model has no parent.- Return type:
Gets the parent of the given model.
- do_get_style() virtual¶
- Returns:
the model’s style.
- Return type:
Gets the model’s style. If the model doesn’t have its own style it will return its parent’s style.
- do_get_transform(transform) virtual¶
- Parameters:
transform (
cairo.Matrix
) – the place to store the transform.- Returns:
True
if a transform is set.- Return type:
Gets the transformation matrix of an item model.
- do_move_child(old_position, new_position) virtual¶
- Parameters:
Moves a child to a new stack position.
- do_remove_child(child_num) virtual¶
- Parameters:
child_num (
int
) – the position of the child to remove.
Removes the child at the given position.
- do_set_child_property(child, property_id, value, pspec) virtual¶
- Parameters:
child (
GooCanvas.CanvasItemModel
) –property_id (
int
) –value (
GObject.Value
) –pspec (
GObject.ParamSpec
) –
- do_set_parent(parent) virtual¶
- Parameters:
parent (
GooCanvas.CanvasItemModel
) – the new parent item model.
This function is only intended to be used when implementing new canvas item models (specifically container models such as
GooCanvas.CanvasGroupModel
). It sets the parent of the child model.This function cannot be used to add a model to a group or to change the parent of a model. To do that use the
GooCanvas.CanvasItemModel
:parent
property.
- do_set_style(style) virtual¶
- Parameters:
style (
GooCanvas.CanvasStyle
) – a style.
Sets the model’s style, by copying the properties from the given style.
- do_set_transform(transform) virtual¶
- Parameters:
transform (
cairo.Matrix
orNone
) – the new transformation matrix, orNone
to reset the transformation to the identity matrix.
Sets the transformation matrix of an item model.
Signal Details¶
- GooCanvas.CanvasItemModel.signals.animation_finished(canvas_item_model, stopped)¶
- Signal Name:
animation-finished
- Flags:
- Parameters:
canvas_item_model (
GooCanvas.CanvasItemModel
) – The object which received the signalstopped (
bool
) – if the animation was explicitly stopped.
Emitted when the item model animation has finished.
- GooCanvas.CanvasItemModel.signals.changed(canvas_item_model, recompute_bounds)¶
- Signal Name:
changed
- Flags:
- Parameters:
canvas_item_model (
GooCanvas.CanvasItemModel
) – The object which received the signalrecompute_bounds (
bool
) – if the bounds of the item need to be recomputed.
Emitted when the item model has been changed.
- GooCanvas.CanvasItemModel.signals.child_added(canvas_item_model, child_num)¶
- Signal Name:
child-added
- Flags:
- Parameters:
canvas_item_model (
GooCanvas.CanvasItemModel
) – The object which received the signalchild_num (
int
) – the index of the new child.
Emitted when a child has been added.
- GooCanvas.CanvasItemModel.signals.child_moved(canvas_item_model, old_child_num, new_child_num)¶
- Signal Name:
child-moved
- Flags:
- Parameters:
canvas_item_model (
GooCanvas.CanvasItemModel
) – The object which received the signalold_child_num (
int
) – the old index of the child.new_child_num (
int
) – the new index of the child.
Emitted when a child has been moved in the stacking order.
- GooCanvas.CanvasItemModel.signals.child_notify(canvas_item_model, pspec)¶
- Signal Name:
child-notify
- Flags:
- Parameters:
canvas_item_model (
GooCanvas.CanvasItemModel
) – The object which received the signalpspec (
GObject.ParamSpec
) – theGObject.ParamSpec
of the changed child property.
Emitted for each child property that has changed. The signal’s detail holds the property name.
- GooCanvas.CanvasItemModel.signals.child_removed(canvas_item_model, child_num)¶
- Signal Name:
child-removed
- Flags:
- Parameters:
canvas_item_model (
GooCanvas.CanvasItemModel
) – The object which received the signalchild_num (
int
) – the index of the child that was removed.
Emitted when a child has been removed.
Property Details¶
- GooCanvas.CanvasItemModel.props.can_focus¶
-
If the item can take the keyboard focus
- GooCanvas.CanvasItemModel.props.description¶
-
A description of the item for use by assistive technologies
- GooCanvas.CanvasItemModel.props.parent¶
- Name:
parent
- Type:
- Default Value:
- Flags:
The parent item model
- GooCanvas.CanvasItemModel.props.pointer_events¶
- Name:
pointer-events
- Type:
- Default Value:
GooCanvas.CanvasPointerEvents.VISIBLE_MASK
|GooCanvas.CanvasPointerEvents.PAINTED_MASK
|GooCanvas.CanvasPointerEvents.FILL_MASK
|GooCanvas.CanvasPointerEvents.STROKE_MASK
|GooCanvas.CanvasPointerEvents.VISIBLE_PAINTED
|GooCanvas.CanvasPointerEvents.VISIBLE_FILL
|GooCanvas.CanvasPointerEvents.VISIBLE_STROKE
|GooCanvas.CanvasPointerEvents.VISIBLE
|GooCanvas.CanvasPointerEvents.PAINTED
|GooCanvas.CanvasPointerEvents.FILL
|GooCanvas.CanvasPointerEvents.STROKE
|GooCanvas.CanvasPointerEvents.ALL
- Flags:
Specifies when the item receives pointer events
- GooCanvas.CanvasItemModel.props.title¶
-
A short context-rich description of the item for use by assistive technologies
- GooCanvas.CanvasItemModel.props.tooltip¶
-
The tooltip to display for the item
- GooCanvas.CanvasItemModel.props.transform¶
-
The transformation matrix of the item
- GooCanvas.CanvasItemModel.props.visibility¶
- Name:
visibility
- Type:
- Default Value:
- Flags:
When the canvas item is visible