GimpUi.Preview

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned GimpUi.Preview GimpUi.Preview Gtk.Box Gtk.Box Gtk.Box->GimpUi.Preview Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Box Gtk.Orientable->Gtk.Box Gtk.Widget->Gtk.Container

Subclasses:

GimpUi.AspectPreview, GimpUi.ScrolledPreview

Methods

Inherited:

Gtk.Box (14), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Orientable (2)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

draw ()

draw_buffer (buffer, rowstride)

get_area ()

get_bounds ()

get_controls ()

get_default_cursor ()

get_frame ()

get_grid ()

get_offsets ()

get_position ()

get_size ()

get_update ()

invalidate ()

set_bounds (xmin, ymin, xmax, ymax)

set_default_cursor (cursor)

set_offsets (xoff, yoff)

set_size (width, height)

set_update (update)

transform (src_x, src_y)

untransform (src_x, src_y)

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

do_draw ()

do_draw_buffer (buffer, rowstride)

do_draw_thumb (area, width, height)

do_invalidated ()

do_set_cursor ()

do_transform (src_x, src_y)

do_untransform (src_x, src_y)

Properties

Inherited:

Gtk.Box (3), Gtk.Container (3), Gtk.Widget (39), Gtk.Orientable (1)

Name

Type

Flags

Short Description

update

bool

r/w/c

Whether the preview should update automatically

Child Properties

Inherited:

Gtk.Box (5)

Style Properties

Inherited:

Gtk.Widget (17)

Name

Type

Default

Flags

Short Description

size

int

200

r

The preview’s size

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Short Description

invalidated

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Type

Access

Description

parent_instance

Gtk.Box

r

Class Details

class GimpUi.Preview(*args, **kwargs)
Bases:

Gtk.Box

Abstract:

Yes

Structure:

GimpUi.PreviewClass

A widget providing a GimpUi.PreviewArea plus framework to update the preview.

draw()

Calls the GimpUi.Preview ::draw method. GimpUi.Preview itself doesn’t implement a default draw method so the behavior is determined by the derived class implementing this method.

GimpUi.DrawablePreview implements GimpUi.Preview.draw() by drawing the original, unmodified drawable to the self.

New in version 2.2.

draw_buffer(buffer, rowstride)
Parameters:
  • buffer (bytes) – a pixel buffer the size of the preview

  • rowstride (int) – the buffer's rowstride

Calls the GimpPreview::draw_buffer method. GimpUi.Preview itself doesn’t implement this method so the behavior is determined by the derived class implementing this method.

New in version 2.2.

get_area()
Returns:

a pointer to the GimpUi.PreviewArea used in the self.

Return type:

GimpUi.PreviewArea

In most cases, you shouldn’t need to access the GimpUi.PreviewArea that is being used in the self. Sometimes however, you need to. For example if you want to receive mouse events from the area. In such cases, use GimpUi.Preview.get_area().

New in version 2.4.

get_bounds()
Returns:

xmin:

Lower bound for x

ymin:

Lower bound for y

xmax:

Higher bound for x

ymax:

Higher bound for y

Return type:

(xmin: int, ymin: int, xmax: int, ymax: int)

get_controls()
Returns:

the horizontal Gtk.Box at the bottom of the preview.

Return type:

Gtk.Box

Gives access to the horizontal Gtk.Box at the bottom of the preview that contains the update toggle. Derived widgets can use this function if they need to add controls to this area.

New in version 2.4.

get_default_cursor()
Returns:

The self's default Gdk.Cursor.

Return type:

Gdk.Cursor

See GimpUi.Preview.set_default_cursor():

New in version 3.0.

get_frame()
Returns:

a pointer to the Gtk.AspectFrame used in the self.

Return type:

Gtk.AspectFrame

New in version 3.0.

get_grid()
Returns:

a pointer to the Gtk.Grid used in the self.

Return type:

Gtk.Grid

New in version 3.0.

get_offsets()
Returns:

xoff:

X offset

yoff:

Y offset

Return type:

(xoff: int, yoff: int)

get_position()
Returns:

x:

return location for the horizontal offset

y:

return location for the vertical offset

Return type:

(x: int, y: int)

New in version 2.2.

get_size()
Returns:

width:

return location for the preview area width

height:

return location for the preview area height

Return type:

(width: int, height: int)

New in version 2.2.

get_update()
Returns:

the state of the “Preview” check button.

Return type:

bool

New in version 2.2.

invalidate()

This function starts or renews a short low-priority timeout. When the timeout expires, the GimpUi.Preview ::invalidated signal is emitted which will usually cause the self to be updated.

This function does nothing unless the “Preview” button is checked.

During the emission of the signal a busy cursor is set on the toplevel window containing the self and on the preview area itself.

New in version 2.2.

set_bounds(xmin, ymin, xmax, ymax)
Parameters:
  • xmin (int) – the minimum X value

  • ymin (int) – the minimum Y value

  • xmax (int) – the maximum X value

  • ymax (int) – the maximum Y value

Sets the lower and upper limits for the previewed area. The difference between the upper and lower value is used to set the maximum size of the GimpUi.PreviewArea used in the self.

New in version 2.2.

set_default_cursor(cursor)
Parameters:

cursor (Gdk.Cursor) – a Gdk.Cursor or None

Sets the default mouse cursor for the preview. Note that this will be overridden by a Gdk.CursorType.FLEUR if the preview has scrollbars, or by a Gdk.CursorType.WATCH when the preview is invalidated.

New in version 2.2.

set_offsets(xoff, yoff)
Parameters:
  • xoff (int) –

  • yoff (int) –

set_size(width, height)
Parameters:
  • width (int) –

  • height (int) –

set_update(update)
Parameters:

update (bool) – True if the preview should invalidate itself when being scrolled or when GimpUi.Preview.invalidate() is being called

Sets the state of the “Preview” check button.

New in version 2.2.

transform(src_x, src_y)
Parameters:
  • src_x (int) – horizontal position on the previewed image

  • src_y (int) – vertical position on the previewed image

Returns:

dest_x:

returns the transformed horizontal position

dest_y:

returns the transformed vertical position

Return type:

(dest_x: int, dest_y: int)

Transforms from image to widget coordinates.

New in version 2.4.

untransform(src_x, src_y)
Parameters:
  • src_x (int) – horizontal position relative to the preview area’s origin

  • src_y (int) – vertical position relative to preview area’s origin

Returns:

dest_x:

returns the untransformed horizontal position

dest_y:

returns the untransformed vertical position

Return type:

(dest_x: int, dest_y: int)

Transforms from widget to image coordinates.

New in version 2.4.

do_draw() virtual

Calls the GimpUi.Preview ::draw method. GimpUi.Preview itself doesn’t implement a default draw method so the behavior is determined by the derived class implementing this method.

GimpUi.DrawablePreview implements GimpUi.Preview.draw() by drawing the original, unmodified drawable to the preview.

New in version 2.2.

do_draw_buffer(buffer, rowstride) virtual
Parameters:
  • buffer (bytes) – a pixel buffer the size of the preview

  • rowstride (int) – the buffer's rowstride

Calls the GimpPreview::draw_buffer method. GimpUi.Preview itself doesn’t implement this method so the behavior is determined by the derived class implementing this method.

New in version 2.2.

do_draw_thumb(area, width, height) virtual
Parameters:
do_invalidated() virtual
do_set_cursor() virtual
do_transform(src_x, src_y) virtual
Parameters:
  • src_x (int) – horizontal position on the previewed image

  • src_y (int) – vertical position on the previewed image

Returns:

dest_x:

returns the transformed horizontal position

dest_y:

returns the transformed vertical position

Return type:

(dest_x: int, dest_y: int)

Transforms from image to widget coordinates.

New in version 2.4.

do_untransform(src_x, src_y) virtual
Parameters:
  • src_x (int) – horizontal position relative to the preview area’s origin

  • src_y (int) – vertical position relative to preview area’s origin

Returns:

dest_x:

returns the untransformed horizontal position

dest_y:

returns the untransformed vertical position

Return type:

(dest_x: int, dest_y: int)

Transforms from widget to image coordinates.

New in version 2.4.

Signal Details

GimpUi.Preview.signals.invalidated(preview)
Signal Name:

invalidated

Flags:

RUN_FIRST

Parameters:

preview (GimpUi.Preview) – The object which received the signal

Property Details

GimpUi.Preview.props.update
Name:

update

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT

Whether the preview should update automatically