Thumb

../_images/thumb-preview.png

Widget description

A thumbnail object is used for displaying the thumbnail of an image or video. You must have compiled Elementary with Ethumb_Client support. Also, Ethumb’s DBus service must be present and auto-activated in order to have thumbnails generated. You must also have a session bus, not a system one.

Once the thumbnail object becomes visible, it will check if there is a previously generated thumbnail image for the file set on it. If not, it will start generating this thumbnail.

Different configuration settings will cause different thumbnails to be generated even on the same file.

Generated thumbnails are stored under $HOME/.thumbnails/. Check Ethumb’s documentation to change this path, and to see other configuration options.

Emitted signals

  • clicked - This is called when a user has clicked the thumbnail object without dragging it around.

  • clicked,double - This is called when a user has double-clicked the thumbnail object.

  • press - This is called when a user has pressed down over the thumbnail object.

  • generate,start - The thumbnail generation has started.

  • generate,stop - The generation process has stopped.

  • generate,error - The thumbnail generation failed.

  • load,error - The thumbnail image loading failed.

Available styles

  • default

  • noframe

Enumerations

Thumb animation mode

efl.elementary.ELM_THUMB_ANIMATION_START

Play animation once

efl.elementary.ELM_THUMB_ANIMATION_LOOP

Keep playing animation until stop is requested

efl.elementary.ELM_THUMB_ANIMATION_STOP

Stop playing the animation

Thumb FDO size

efl.elementary.ETHUMB_THUMB_NORMAL

128x128 as defined by FreeDesktop.Org standard

efl.elementary.ETHUMB_THUMB_LARGE

256x256 as defined by FreeDesktop.Org standard

Thumb format

efl.elementary.ETHUMB_THUMB_FDO

PNG as defined by FreeDesktop.Org standard

efl.elementary.ETHUMB_THUMB_JPEG

JPEGs are often smaller and faster to read/write

efl.elementary.ETHUMB_THUMB_EET

EFL’s own storage system, supports key parameter

Thumb aspect

efl.elementary.ETHUMB_THUMB_KEEP_ASPECT

keep original proportion between width and height

efl.elementary.ETHUMB_THUMB_IGNORE_ASPECT

ignore aspect and foce it to match thumbnail’s width and height

efl.elementary.ETHUMB_THUMB_CROP

keep aspect but crop (cut) the largest dimension

Thumb orientation

efl.elementary.ETHUMB_THUMB_ORIENT_NONE

keep orientation as pixel data is

efl.elementary.ETHUMB_THUMB_ROTATE_90_CW

rotate 90° clockwise

efl.elementary.ETHUMB_THUMB_ROTATE_180

rotate 180°

efl.elementary.ETHUMB_THUMB_ROTATE_90_CCW

rotate 90° counter-clockwise

efl.elementary.ETHUMB_THUMB_FLIP_HORIZONTAL

flip horizontally

efl.elementary.ETHUMB_THUMB_FLIP_VERTICAL

flip vertically

efl.elementary.ETHUMB_THUMB_FLIP_TRANSPOSE

transpose

efl.elementary.ETHUMB_THUMB_FLIP_TRANSVERSE

transverse

efl.elementary.ETHUMB_THUMB_ORIENT_ORIGINAL

use orientation from metadata (EXIF-only currently)

Inheritance diagram

Inheritance diagram of Thumb
class efl.elementary.Thumb(Object parent, *args, **kwargs)

Bases: efl.elementary.__init__.Object

This is the class that actually implements the widget.

Parameters
  • parent (efl.evas.Object) – The parent object

  • **kwargs – All the remaining keyword arguments are interpreted as properties of the instance

animate

Set the animation state for the thumb object. If its content is an animated video, you may start/stop the animation or tell it to play continuously and looping.

See also

file

Type

Thumb animation mode

aspect

The aspect for the thumb object.

Type

Ethumb_Thumb_Aspect

New in version 1.8.

callback_clicked_add(func, *args, **kwargs)

This is called when a user has clicked the thumbnail object without dragging it around.

callback_clicked_del(func)
callback_clicked_double_add(func, *args, **kwargs)

This is called when a user has double-clicked the thumbnail object.

callback_clicked_double_del(func)
callback_generate_error_add(func, *args, **kwargs)

The thumbnail generation failed.

callback_generate_error_del(func)
callback_generate_start_add(func, *args, **kwargs)

The thumbnail generation has started.

callback_generate_start_del(func)
callback_generate_stop_add(func, *args, **kwargs)

The generation process has stopped.

callback_generate_stop_del(func)
callback_load_error_add(func, *args, **kwargs)

The thumbnail image loading failed.

callback_load_error_del(func)
callback_press_add(func, *args, **kwargs)

This is called when a user has pressed down over the thumbnail object.

callback_press_del(func)
compress

Set the compression for the thumb object.

Type

int

New in version 1.8.

crop_align

Set the crop alignment for the thumb object.

Type

(float cropx, float cropy)

New in version 1.8.

editable

Make the thumbnail ‘editable’.

This means the thumbnail is a valid drag target for drag and drop, and can be cut or pasted too.

Type

bool

Raises

RuntimeError – when cannot be set as editable

Changed in version 1.8: Raises RuntimeError if cannot be set as editable

ethumb_client_connected

Get the ethumb_client connection state.

Type

bool

ethumb_client_connected_get()
ethumb_client_get()

Get the ethumb_client handle so custom configuration can be made.

This must be called before the objects are created to be sure no object is visible and no generation started.

Note

There’s only one client handle for Ethumb, so once a configuration change is done to it, any other request for thumbnails (for any thumbnail object) will use that configuration. Thus, this configuration is global.

Returns

Ethumb_Client instance or None.

Return type

Ethumb_Client

fdo_size

The FDO size for the thumb object.

Type

Ethumb_Thumb_FDO_Size

New in version 1.8.

file

The file that will be used as thumbnail source.

The file can be an image or a video (in that case, acceptable extensions are: avi, mp4, ogv, mov, mpg and wmv). To start the video animation, use the function animate().

See also

reload() animate()

Type

string or tuple(string file, optional string eet_key)

format

The format for the thumb object.

Type

Ethumb_Thumb_Format

New in version 1.8.

orientation

The orientation for the thumb object.

Type

Ethumb_Thumb_Orientation

New in version 1.8.

path

Get the path and key to the image or video thumbnail generated by ethumb.

One just needs to make sure that the thumbnail was generated before getting its path; otherwise, the path will be None. One way to do that is by asking for the path when/after the “generate,stop” smart callback is called.

See also

file

Type

(string path, string eet_key)

quality

Set the quality for the thumb object.

Type

int

New in version 1.8.

reload()

Reload thumbnail if it was generated before.

This is useful if the ethumb client configuration changed, like its size, aspect or any other property one set in the handle returned by ethumb_client_get().

If the options didn’t change, the thumbnail won’t be generated again, but the old one will still be used.

See also

file

size

The size for the thumb object.

Type

(int tw, int th)

New in version 1.8.