Class IImageTool
- Known Subclasses:
-
IImageTool is an interface that defines how ImageView interacts
with objects that acts as tools. ImageView delegates many of its
most important tasks (such as drawing) to its tool which carries
out all the hard work. The PyGtkImageView package comes with two
tools; ImageToolDragger and ImageToolSelector, but by
implementing your own tool it is possible to extend ImageView to
do stuff its author (thats me) didn't imagine.
GtkImageView uses ImageToolDragger by default, as that tool is
he most generally useful one. However, it is trivial to make it
use another tool.
view = gtkimageview.ImageView()
tool = gtkimageview.ImageToolSelector(view)
view.set_tool(tool)
Using the above code makes the view use the selector tool instead
of the default dragger tool.
|
button_press(self,
ev_button) |
|
|
|
button_release(self,
ev_button) |
|
|
|
motion_notify(self,
ev_motion) |
|
|
|
pixbuf_changed(self,
reset_fit,
rect)
Indicate to the tool that either a part of, or the whole
pixbuf that the image view shows has changed. |
|
|
|
paint_image(self,
draw_settings,
drawable)
Called whenever the image view decides that any part of the
image it shows needs to be redrawn. |
|
|
|
cursor_at_point(self,
x,
y)
Get the cursor to display when the mouse pointer is over the
widget coordinate (x , y ). |
|
|
pixbuf_changed(self,
reset_fit,
rect)
|
|
Indicate to the tool that either a part of, or the whole
pixbuf that the image view shows has changed. This method is
called by the view whenever its pixbuf or its tool changes.
That is, when any of the following method are used:
If the reset_fit parameter is True, it means that a new
pixbuf has been loaded into the view. rect is a rectangle in
image space coordinates that indicates which region of the
pixbufs pixels that is modified. rect can be None which
means that all image data in the pixbuf has been changed.
- Parameters:
reset_fit - whether the view is resetting its fit mode
or not
rect - a gtk.gdk.Rectangle containing the changed
area or None
|
paint_image(self,
draw_settings,
drawable)
|
|
Called whenever the image view decides that any part of the
image it shows needs to be redrawn.
- Parameters:
draw_settings - a set of draw settings to use for this
draw
drawable - a gtk.gdk.Drawable to draw the image data
on
|
cursor_at_point(self,
x,
y)
|
|
Get the cursor to display when the mouse pointer is over the
widget coordinate (x , y ).
- Parameters:
x - the mouse pointers x-coordinate
y - the mouse pointers y-coordinate
- Returns:
- an appropriate gtk.gdk.Cursor
|