goocanvas.ItemView

goocanvas.ItemView — The interface for views of canvas items.

Synopsis

class goocanvas.ItemView(gobject.GInterface):
    def ensure_updated()
def find_child(child)
def get_bounds(bounds)
def get_canvas_view()
def get_child(child_num)
def get_combined_transform(result)
def get_item()
def get_item_view_at(x, y, cr, is_pointer_event, parent_is_visible)
def get_n_children()
def get_parent_view()
def get_transform()
def is_container()
def is_visible()
def paint(cr, bounds, scale)
def request_update()
def set_parent_view(parent_view)
def set_transform(matrix)
def update(entire_tree, cr, bounds)

Ancestry

+-- gobject.GInterface
    +-- goocanvas.ItemView

goocanvas.ItemView Properties

"can-focus"Read / WriteIf the item can take the keyboard focus. Default value: False

goocanvas.ItemView Signal Prototypes

"button-press-event" def callback(view, target_view, event, user_param, ...)
"button-release-event" def callback(view, target_view, event, user_param, ...)
"enter-notify-event" def callback(view, target_view, event, user_param, ...)
"focus-in-event" def callback(view, target_view, event, user_param, ...)
"focus-out-event" def callback(view, target_view, event, user_param, ...)
"grab-broken-event" def callback(view, target_view, event, user_param, ...)
"key-press-event" def callback(view, target_view, event, user_param, ...)
"key-release-event" def callback(view, target_view, event, user_param, ...)
"leave-notify-event" def callback(view, target_view, event, user_param, ...)
"motion-notify-event" def callback(view, target_view, event, user_param, ...)

Known Implementation

goocanvas.ItemView is implementated by goocanvas.RectView goocanvas.EllipseView goocanvas.PathView goocanvas.PolylineView goocanvas.TextView goocanvas.ImageView goocanvas.GroupView goocanvas.ItemViewSimple

Description

goocanvas.ItemView defines the interface that item views must implement, and contains methods for operating on item views.

Methods

goocanvas.ItemView.ensure_updated

    def ensure_updated()

Updates the canvas immediately, if an update is scheduled. This ensures that all item bounds are up-to-date.

goocanvas.ItemView.find_child

    def find_child(child)
child:A child view.
Returns: The index of the given child item view.

Gets the index of the child item view, counting from 0.

goocanvas.ItemView.get_bounds

    def get_bounds(bounds)
bounds:A GooCanvasBounds to return the bounds in.

Gets the bounds of the item view. Note that the bounds includes the entire fill and stroke extents of the item view, whether they are painted or not.

goocanvas.ItemView.get_canvas_view

    def get_canvas_view()
Returns: The GooCanvasView.

Returns the GooCanvasView containing the given GooCanvasItemView.

goocanvas.ItemView.get_child

    def get_child(child_num)
child_num:The index of the child within the view, counting from 0.
Returns: The child at the given index.

Returns the child view at the given index, or NULL if the item has no children or the index is out of range.

goocanvas.ItemView.get_combined_transform

    def get_combined_transform(result)
result:the matrix to store the resulting transform in.
Returns: True if there is a transformation.

Gets the total transformation matrix of an item view, which is a combination of the item's transformation and the item view's transformation.

goocanvas.ItemView.get_item

    def get_item()
Returns: The GooCanvasItem that the view is displaying.

Returns the item the view is displaying.

goocanvas.ItemView.get_item_view_at

    def get_item_view_at(x, y, cr, is_pointer_event, parent_is_visible)
x:the x coordinate of the point.
y:the y coordinate of the point.
cr:a cairo contect.
is_pointer_event:True if the "pointer-events" properties of items should be used to determine which parts of the item are tested.
parent_is_visible:True if the parent item view is visible (which implies that all ancestors are also visible).
Returns: The item view found at the given point, or NULL if no item view was found.

Gets the item view at the given point.

goocanvas.ItemView.get_n_children

    def get_n_children()
Returns: The number of children of the GooCanvasItemView, or 0 if the view is not a container.

Returns the number of children of the given GooCanvasItemView.

goocanvas.ItemView.get_parent_view

    def get_parent_view()
Returns: The parent view of the item.

Returns the parent view of the given GooCanvasItemView.

goocanvas.ItemView.get_transform

    def get_transform()
Returns: The item view's transformation matrix.

Gets the transformation matrix of an item view.

goocanvas.ItemView.is_container

    def is_container()
Returns: True if the item view is a container.

Returns True if the given GooCanvasItemView is a container, i.e. it may contain children;

goocanvas.ItemView.is_visible

    def is_visible()
Returns: True if the item is visible.

Checks if the item is visible. This entails checking the item's own visibility setting, as well as those of its ancestors. Note that this the item may be scrolled off the screen and so may not be actually visible to the user.

goocanvas.ItemView.paint

    def paint(cr, bounds, scale)
cr:a cairo context.
bounds:the bounds that need to be repainted.
scale:the scale to use to determine whether an item should be painted. See GooCanvasItem

Paints the item view and all children if they intersect the given bounds. Note that the scale argument may be different to the current scale in the GooCanvasView, e.g. when the canvas is being printed.

goocanvas.ItemView.request_update

    def request_update()

Requests that an update of the item is scheduled. It will be performed as soon as the application is idle, and before the canvas is redrawn.

goocanvas.ItemView.set_parent_view

    def set_parent_view(parent_view)
parent_view:the parent view.

Sets the parent view of the given GooCanvasItemView

goocanvas.ItemView.set_transform

    def set_transform(matrix)
matrix:the new transformation matrix, or NULL to reset the transformation to the identity matrix.

Sets the transformation matrix of an item view.

goocanvas.ItemView.update

    def update(entire_tree, cr, bounds)
entire_tree:if the entire subtree should be updated.
cr:a cairo context.
bounds:a GooCanvasBounds to return the new bounds in.

Updates the item view, if needed, and any children.

Signals

The "button-press-event" goocanvas.ItemView Signal

    def callback(view, target_view, event, user_param, ...)
view:the item view that received the signal.
target_view:the target of the event.
event:the event data, with coordinates translated to canvas coordinates.
user_param:the first user parameter (if any) specified with the connect() method
...:additional user parameters (if any)
Returns: True to stop the signal emission, or False to let it continue.

The 'button-press-event" signal is emitted when a mouse button is pressed in an item view.

The "button-release-event" goocanvas.ItemView Signal

    def callback(view, target_view, event, user_param, ...)
view:the item view that received the signal.
target_view:the target of the event.
event:the event data, with coordinates translated to canvas coordinates.
user_param:the first user parameter (if any) specified with the connect() method
...:additional user parameters (if any)
Returns: True to stop the signal emission, or False to let it continue.

The 'button-release-event" signal is emitted when a mouse button is released in an item view.

The "enter-notify-event" goocanvas.ItemView Signal

    def callback(view, target_view, event, user_param, ...)
view:the item view that received the signal.
target_view:the target of the event.
event:the event data, with coordinates translated to canvas coordinates.
user_param:the first user parameter (if any) specified with the connect() method
...:additional user parameters (if any)
Returns: True to stop the signal emission, or False to let it continue.

The 'enter-notify-event" signal is emitted when the mouse enters an item view.

The "focus-in-event" goocanvas.ItemView Signal

    def callback(view, target_view, event, user_param, ...)
view:the item view that received the signal.
target_view:the target of the event.
event:the event data.
user_param:the first user parameter (if any) specified with the connect() method
...:additional user parameters (if any)
Returns: True to stop the signal emission, or False to let it continue.

The 'focus-in-event" signal is emitted when the item receives the keyboard focus.

The "focus-out-event" goocanvas.ItemView Signal

    def callback(view, target_view, event, user_param, ...)
view:the item view that received the signal.
target_view:the target of the event.
event:the event data.
user_param:the first user parameter (if any) specified with the connect() method
...:additional user parameters (if any)
Returns: True to stop the signal emission, or False to let it continue.

The 'focus-out-event" signal is emitted when the item loses the keyboard focus.

The "grab-broken-event" goocanvas.ItemView Signal

    def callback(view, target_view, event, user_param, ...)
view:the item view that received the signal.
target_view:the target of the event.
event:the event data.
user_param:the first user parameter (if any) specified with the connect() method
...:additional user parameters (if any)
Returns: True to stop the signal emission, or False to let it continue.

The 'grab-broken-event" signal is emitted when the item view's keyboard or pointer grab was lost unexpectedly.

The "key-press-event" goocanvas.ItemView Signal

    def callback(view, target_view, event, user_param, ...)
view:the item view that received the signal.
target_view:the target of the event.
event:the event data.
user_param:the first user parameter (if any) specified with the connect() method
...:additional user parameters (if any)
Returns: True to stop the signal emission, or False to let it continue.

The 'key-press-event" signal is emitted when a key is pressed and the item view has the keyboard focus.

The "key-release-event" goocanvas.ItemView Signal

    def callback(view, target_view, event, user_param, ...)
view:the item view that received the signal.
target_view:the target of the event.
event:the event data.
user_param:the first user parameter (if any) specified with the connect() method
...:additional user parameters (if any)
Returns: True to stop the signal emission, or False to let it continue.

The 'key-release-event" signal is emitted when a key is released and the item view has the keyboard focus.

The "leave-notify-event" goocanvas.ItemView Signal

    def callback(view, target_view, event, user_param, ...)
view:the item view that received the signal.
target_view:the target of the event.
event:the event data, with coordinates translated to canvas coordinates.
user_param:the first user parameter (if any) specified with the connect() method
...:additional user parameters (if any)
Returns: True to stop the signal emission, or False to let it continue.

The 'leave-notify-event" signal is emitted when the mouse leaves an item view.

The "motion-notify-event" goocanvas.ItemView Signal

    def callback(view, target_view, event, user_param, ...)
view:the item view that received the signal.
target_view:the target of the event.
event:the event data, with coordinates translated to canvas coordinates.
user_param:the first user parameter (if any) specified with the connect() method
...:additional user parameters (if any)
Returns: True to stop the signal emission, or False to let it continue.

The 'motion-notify-event" signal is emitted when the mouse moves within an item view.