Gimp.Resource

g GObject.GInterface GObject.GInterface Gimp.ConfigInterface Gimp.ConfigInterface GObject.GInterface->Gimp.ConfigInterface GObject.Object GObject.Object Gimp.Resource Gimp.Resource GObject.Object->Gimp.Resource Gimp.ConfigInterface->Gimp.Resource

Subclasses:

Gimp.Brush, Gimp.Font, Gimp.Gradient, Gimp.Palette, Gimp.Pattern

Methods

Inherited:

GObject.Object (37), Gimp.ConfigInterface (14)

Structs:

GObject.ObjectClass (5)

class

get_by_id (resource_id)

class

get_by_name (resource_type, resource_name)

class

id_is_brush (resource_id)

class

id_is_font (resource_id)

class

id_is_gradient (resource_id)

class

id_is_palette (resource_id)

class

id_is_pattern (resource_id)

class

id_is_valid (resource_id)

delete ()

duplicate ()

get_id ()

get_name ()

is_brush ()

is_editable ()

is_font ()

is_gradient ()

is_palette ()

is_pattern ()

is_valid ()

rename (new_name)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

id

int

r/w/co

The id for internal use

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Gimp.Resource(**kwargs)
Bases:

GObject.Object, Gimp.ConfigInterface

Abstract:

Yes

Structure:

Gimp.ResourceClass

Functions to manipulate resources.

classmethod get_by_id(resource_id)
Parameters:

resource_id (int) – The resource id.

Returns:

a Gimp.Resource for resource_id or None if resource_id does not represent a valid resource. The object belongs to libgimp and you must not modify or unref it.

Return type:

Gimp.Resource or None

Returns a Gimp.Resource representing resource_id. Since Gimp.Resource is an abstract class, the real object type will actually be the proper subclass.

Note: in most use cases, you should not need to retrieve a Gimp.Resource by its ID, which is mostly internal data and not reusable across sessions. Use the appropriate functions for your use case instead.

New in version 3.0.

classmethod get_by_name(resource_type, resource_name)
Parameters:
Returns:

The resource.

Return type:

Gimp.Resource or None

Returns the resource with the given resource_type and resource_name.

New in version 3.0.

classmethod id_is_brush(resource_id)
Parameters:

resource_id (int) – The resource ID.

Returns:

True if the resource ID is a brush, False otherwise.

Return type:

bool

Returns whether the resource ID is a brush.

This procedure returns True if the specified resource ID is a brush.

New in version 3.0.

classmethod id_is_font(resource_id)
Parameters:

resource_id (int) – The resource ID.

Returns:

True if the resource ID is a font, False otherwise.

Return type:

bool

Returns whether the resource ID is a font.

This procedure returns True if the specified resource ID is a font.

New in version 3.0.

classmethod id_is_gradient(resource_id)
Parameters:

resource_id (int) – The resource ID.

Returns:

True if the resource ID is a gradient, False otherwise.

Return type:

bool

Returns whether the resource ID is a gradient.

This procedure returns True if the specified resource ID is a gradient.

New in version 3.0.

classmethod id_is_palette(resource_id)
Parameters:

resource_id (int) – The resource ID.

Returns:

True if the resource ID is a palette, False otherwise.

Return type:

bool

Returns whether the resource ID is a palette.

This procedure returns True if the specified resource ID is a palette.

New in version 3.0.

classmethod id_is_pattern(resource_id)
Parameters:

resource_id (int) – The resource ID.

Returns:

True if the resource ID is a pattern, False otherwise.

Return type:

bool

Returns whether the resource ID is a pattern.

This procedure returns True if the specified resource ID is a pattern.

New in version 3.0.

classmethod id_is_valid(resource_id)
Parameters:

resource_id (int) – The resource ID to check.

Returns:

Whether the resource ID is valid.

Return type:

bool

Returns True if the resource ID is valid.

This procedure checks if the given resource ID is valid and refers to an existing resource.

*Note*: in most use cases, you should not use this function. If you got a [class`Gimp`.Resource] from the API, you should trust it is valid. This function is mostly for internal usage.

New in version 3.0.

delete()
Returns:

True on success.

Return type:

bool

Deletes a resource.

Deletes a resource. Returns an error if the resource is not deletable. Deletes the resource’s data. You should not use the resource afterwards.

New in version 3.0.

duplicate()
Returns:

A copy of the resource.

Return type:

Gimp.Resource

Duplicates a resource.

Returns a copy having a different, unique ID.

New in version 3.0.

get_id()
Returns:

the resource ID.

Return type:

int

Note: in most use cases, you should not need a resource’s ID which is mostly internal data and not reusable across sessions.

New in version 3.0.

get_name()
Returns:

The resource’s name. The returned value must be freed with GLib.free().

Return type:

str

Returns the resource’s name.

This procedure returns the resource’s name.

New in version 3.0.

is_brush()
Returns:

True if the resource is a brush, False otherwise.

Return type:

bool

Returns whether the resource is a brush.

This procedure returns True if the specified resource is a brush.

New in version 3.0.

is_editable()
Returns:

True if the resource can be edited.

Return type:

bool

Whether the resource can be edited.

Returns True if you have permission to change the resource.

New in version 3.0.

is_font()
Returns:

True if the resource is a font, False otherwise.

Return type:

bool

Returns whether the resource is a font.

This procedure returns True if the specified resource is a font.

New in version 3.0.

is_gradient()
Returns:

True if the resource is a gradient, False otherwise.

Return type:

bool

Returns whether the resource is a gradient.

This procedure returns True if the specified resource is a gradient.

New in version 3.0.

is_palette()
Returns:

True if the resource is a palette, False otherwise.

Return type:

bool

Returns whether the resource is a palette.

This procedure returns True if the specified resource is a palette.

New in version 3.0.

is_pattern()
Returns:

True if the resource is a pattern, False otherwise.

Return type:

bool

Returns whether the resource is a pattern.

This procedure returns True if the specified resource is a pattern.

New in version 3.0.

is_valid()
Returns:

Whether the resource is valid.

Return type:

bool

Returns True if the resource is valid.

This procedure checks if the given resource is valid and refers to an existing resource.

New in version 3.0.

rename(new_name)
Parameters:

new_name (str) – The proposed new name of the resource.

Returns:

True on success.

Return type:

bool

Renames a resource. When the name is in use, renames to a unique name.

Renames a resource. When the proposed name is already used, GIMP generates a unique name.

New in version 3.0.

Property Details

Gimp.Resource.props.id
Name:

id

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The id for internal use