GnomeDesktop.DesktopThumbnailFactory¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent |
r |
Class Details¶
- class GnomeDesktop.DesktopThumbnailFactory(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new(size)¶
- Parameters:
size (
GnomeDesktop.DesktopThumbnailSize) – The thumbnail size to use- Returns:
- Return type:
Creates a new
GnomeDesktop.DesktopThumbnailFactory.This function must be called on the main thread and is non-blocking.
New in version 2.2.
- can_thumbnail(uri, mime_type, mtime)¶
- Parameters:
- Returns:
Trueif the file can be thumbnailed.- Return type:
Returns
Trueif thisGnomeDesktop.DesktopThumbnailFactorycan (at least try) to thumbnail this file. Thumbnails or files with failed thumbnails won’t be thumbnailed.Usage of this function is threadsafe and does blocking I/O.
New in version 2.2.
- create_failed_thumbnail(uri, mtime, cancellable)¶
- Parameters:
uri (
str) – the uri of a filemtime (
int) – the modification time of the filecancellable (
Gio.CancellableorNone) – aGio.Cancellableobject, orNone
- Raises:
- Returns:
- Return type:
Creates a failed thumbnail for the file so that we don’t try to re-thumbnail the file later.
Usage of this function is threadsafe and does blocking I/O.
New in version 2.2.
- create_failed_thumbnail_async(uri, original_mtime, cancellable, callback, *user_data)¶
- Parameters:
uri (
str) – the uri of a fileoriginal_mtime (
int) – the modification time of the original filecancellable (
Gio.CancellableorNone) – a Cancellable objectcallback (
Gio.AsyncReadyCallbackorNone) – a function that will be called when the task has ended
Asynchronous version of
GnomeDesktop.DesktopThumbnailFactory.create_failed_thumbnail()New in version 43.0.
- create_failed_thumbnail_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – the result of the operation- Raises:
- Returns:
Trueif the operation was correct;Falseif there was an error- Return type:
- generate_thumbnail(uri, mime_type, cancellable)¶
- Parameters:
uri (
str) – the uri of a filemime_type (
str) – the mime type of the filecancellable (
Gio.CancellableorNone) – aGio.Cancellableobject orNone
- Raises:
- Returns:
thumbnail pixbuf if thumbnailing succeeded,
Noneotherwise and error will be set- Return type:
Tries to generate a thumbnail for the specified file. If it succeeds it returns a pixbuf that can be used as a thumbnail.
Usage of this function is threadsafe and does blocking I/O.
New in version 42.0.
- generate_thumbnail_async(uri, mime_type, cancellable, callback, *user_data)¶
- Parameters:
uri (
str) – the URI of a filemime_type (
str) – the MIME type of the filecancellable (
Gio.CancellableorNone) – a Cancellable objectcallback (
Gio.AsyncReadyCallbackorNone) – a function that will be called when the task has ended
Asynchronous version of
GnomeDesktop.DesktopThumbnailFactory.generate_thumbnail()New in version 43.0.
- generate_thumbnail_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – the result of the operation- Raises:
- Returns:
thumbnail pixbuf if thumbnailing succeeded,
Noneotherwise.- Return type:
- has_valid_failed_thumbnail(uri, mtime)¶
- Parameters:
- Returns:
Trueif there is a failed thumbnail for the file.- Return type:
Tries to locate an failed thumbnail for the file specified. Writing and looking for failed thumbnails is important to avoid to try to thumbnail e.g. broken images several times.
Usage of this function is threadsafe and does blocking I/O.
New in version 2.2.
- lookup(uri, mtime)¶
- Parameters:
- Returns:
The absolute path of the thumbnail, or
Noneif none exist.- Return type:
Tries to locate an existing thumbnail for the file specified.
Usage of this function is threadsafe and does blocking I/O.
New in version 2.2.
- save_thumbnail(thumbnail, uri, original_mtime, cancellable)¶
- Parameters:
thumbnail (
GdkPixbuf.Pixbuf) – the thumbnail as a pixbufuri (
str) – the uri of a fileoriginal_mtime (
int) – the modification time of the original filecancellable (
Gio.CancellableorNone) – aGio.Cancellableobject, orNone
- Raises:
- Returns:
- Return type:
Saves thumbnail at the right place. If the save fails a failed thumbnail is written.
Usage of this function is threadsafe and does blocking I/O.
New in version 2.2.
- save_thumbnail_async(thumbnail, uri, original_mtime, cancellable, callback, *user_data)¶
- Parameters:
thumbnail (
GdkPixbuf.Pixbuf) – the thumbnail as a pixbufuri (
str) – the uri of a fileoriginal_mtime (
int) – the modification time of the original filecancellable (
Gio.CancellableorNone) – a Cancellable objectcallback (
Gio.AsyncReadyCallbackorNone) – a function that will be called when the task has ended
Asynchronous version of
GnomeDesktop.DesktopThumbnailFactory.save_thumbnail()New in version 43.0.
- save_thumbnail_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – the result of the operation- Raises:
- Returns:
Trueif the operation was correct;Falseif there was an error- Return type: