Peas.PluginInfo

g GObject.Object GObject.Object Peas.PluginInfo Peas.PluginInfo GObject.Object->Peas.PluginInfo

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

error_quark ()

get_authors ()

get_copyright ()

get_data_dir ()

get_dependencies ()

get_description ()

get_external_data (key)

get_help_uri ()

get_icon_name ()

get_module_dir ()

get_module_name ()

get_name ()

get_resource (filename)

get_settings (schema_id)

get_version ()

get_website ()

has_dependency (module_name)

is_available ()

is_builtin ()

is_hidden ()

is_loaded ()

load_resource (filename)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

authors

[str]

r

builtin

bool

r

copyright

str

r

dependencies

[str]

r

description

str

r

help-uri

str

r

hidden

bool

r

icon-name

str

r

loaded

bool

r

module-dir

str

r

module-name

str

r

name

str

r

version

str

r

website

str

r

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Peas.PluginInfo(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Peas.PluginInfoClass

A Peas.PluginInfo contains all the information available about a plugin.

All this information comes from the related plugin info file, whose file extension is “.plugin”. Here is an example of such a plugin file, in the [struct`GLib`.KeyFile] format:

``toml [Plugin] Module=helloworld Depends=foo;bar;baz Loader=python Name=Hello World Description=Displays “Hello World” Authors=Steve Frécinaux <code@istique.net> Copyright=Copyright © 2009-10 Steve Frécinaux Website=https://wiki.gnome.org/Projects/Libpeas Help=http://library.gnome.org/devel/libpeas/stable/ Hidden=false ``

classmethod error_quark()
Return type:

int

get_authors()
Returns:

the plugin’s author list.

Return type:

[str]

Gets a None-terminated array of strings with the authors of the plugin.

The relevant key in the plugin info file is “Authors”.

Returns:

the plugin’s copyright information.

Return type:

str

Gets the copyright of the plugin.

The relevant key in the plugin info file is “Copyright”.

get_data_dir()
Returns:

the plugin’s data dir.

Return type:

str

Gets the data dir of the plugin.

The module data directory is the directory where a plugin should find its runtime data. This is not a value read from the [struct`GLib`.KeyFile], but rather a value provided by the [class`Engine`], depending on where the plugin file was found.

get_dependencies()
Returns:

the plugin’s dependencies.

Return type:

[str]

Gets the dependencies of the plugin.

The [class`Engine`] will always ensure that the dependencies of a plugin are loaded when the said plugin is loaded. It means that dependencies are loaded before the plugin, and unloaded after it. Circular dependencies of plugins lead to undefined loading order.

The relevant key in the plugin info file is “Depends”.

get_description()
Returns:

the plugin’s description.

Return type:

str

Gets the description of the plugin.

The description of the plugin should be a string presenting the purpose of the plugin. It will typically be presented in a plugin’s about box.

The relevant key in the plugin info file is “Description”.

get_external_data(key)
Parameters:

key (str) – The key to lookup.

Returns:

the external data, or None if the external data could not be found.

Return type:

str or None

Gets external data specified for the plugin.

External data is specified in the plugin info file prefixed with X-. For example, if a key/value pair X-Peas=1 is specified in the key file, you can use “Peas” for key to retrieve the value “1”.

Note: that you can omit the X- prefix when retrieving the value, but not when specifying the value in the file.

New in version 1.6.

get_help_uri()
Returns:

the plugin’s help URI.

Return type:

str

Gets the help URI of the plugin.

The Help URI of a plugin will typically be presented by the plugin manager as a “Help” button linking to the URI. It can either be a HTTP URL on some website or a ghelp: URI if a Gnome help page is available for the plugin.

The relevant key in the plugin info file is “Help”. Other platform-specific keys exist for platform-specific help files. Those are “Help-GNOME”, “Help-Windows” and “Help-MacOS-X”.

get_icon_name()
Returns:

the plugin’s icon name.

Return type:

str

Gets the icon name of the plugin.

The icon of the plugin will be presented in the plugin manager UI. If no icon is specified, the default green puzzle icon will be used.

The relevant key in the plugin info file is “Icon”.

get_module_dir()
Returns:

the module directory.

Return type:

str

Gets the module directory.

The module directory is the directory where the plugin file was found. This is not a value from the [struct`GLib`.KeyFile], but rather a value provided by the [class`Engine`].

get_module_name()
Returns:

the module name.

Return type:

str

Gets the module name.

The module name will be used to find the actual plugin. The way this value will be used depends on the loader (i.e. on the language) of the plugin. This value is also used to uniquely identify a particular plugin.

The relevant key in the plugin info file is “Module”.

get_name()
Returns:

the plugin’s name.

Return type:

str

Gets the name of the plugin.

The name of a plugin should be a nice short string to be presented in UIs.

The relevant key in the plugin info file is “Name”.

get_resource(filename)
Parameters:

filename (str or None) – The filename of the resource, or None.

Raises:

GLib.Error

Returns:

a new Gio.Resource, or None.

Return type:

Gio.Resource

Creates a new Gio.Resource for the given filename located in the module directory. If filename is None then “${module_name}.gresource” will be loaded.

get_settings(schema_id)
Parameters:

schema_id (str or None) – The schema id.

Returns:

a new Gio.Settings.

Return type:

Gio.Settings or None

Creates a new [class`Gio`.Settings] for the given schema_id and if gschemas.compiled is not in the module directory an attempt will be made to create it.

New in version 1.4.

get_version()
Returns:

the plugin’s version.

Return type:

str

Gets the version of the plugin.

The relevant key in the plugin info file is “Version”.

get_website()
Returns:

the plugin’s associated website.

Return type:

str

Gets the website of the plugin.

The relevant key in the plugin info file is “Website”.

has_dependency(module_name)
Parameters:

module_name (str) – The name of the plugin to check.

Returns:

whether the plugin depends on the plugin module_name.

Return type:

bool

Check if the plugin depends on another plugin.

is_available()
Raises:

GLib.Error

Returns:

True if the plugin is available.

Return type:

bool

Check if the plugin is available.

A plugin is marked as not available when there is no loader available to load it, or when there has been an error when trying to load it previously. If not available then error will be set.

is_builtin()
Returns:

True if the plugin is a builtin plugin, False if not.

Return type:

bool

Check if the plugin is a builtin plugin.

A builtin plugin is a plugin which cannot be enabled or disabled by the user through a plugin manager (like PeasGtkPluginManager). Loading or unloading such plugins is the responsibility of the application alone. Most applications will usually load those plugins immediately after the initialization of the Peas.Engine.

The relevant key in the plugin info file is “Builtin”.

is_hidden()
Returns:

True if the plugin is a hidden plugin, False if not.

Return type:

bool

Check if the plugin is a hidden plugin.

A hidden plugin is a plugin which cannot be seen by a user through a plugin manager (like PeasGtkPluginManager). Loading and unloading such plugins is the responsibility of the application alone or through plugins that depend on them.

The relevant key in the plugin info file is “Hidden”.

is_loaded()
Returns:

True if the plugin is loaded.

Return type:

bool

Check if the plugin is loaded.

load_resource(filename)
Parameters:

filename (str or None) – The filename of the resource, or None.

Raises:

GLib.Error

Loads the resource using Peas.PluginInfo.get_resource() and registers it. The resource’s lifetime will be automatically handled by self.

See Peas.PluginInfo.get_resource() for more information.

Property Details

Peas.PluginInfo.props.authors
Name:

authors

Type:

[str]

Default Value:

[]

Flags:

READABLE

Peas.PluginInfo.props.builtin
Name:

builtin

Type:

bool

Default Value:

False

Flags:

READABLE

Peas.PluginInfo.props.copyright
Name:

copyright

Type:

str

Default Value:

None

Flags:

READABLE

Peas.PluginInfo.props.dependencies
Name:

dependencies

Type:

[str]

Default Value:

[]

Flags:

READABLE

Peas.PluginInfo.props.description
Name:

description

Type:

str

Default Value:

None

Flags:

READABLE

Peas.PluginInfo.props.help_uri
Name:

help-uri

Type:

str

Default Value:

None

Flags:

READABLE

Peas.PluginInfo.props.hidden
Name:

hidden

Type:

bool

Default Value:

False

Flags:

READABLE

Peas.PluginInfo.props.icon_name
Name:

icon-name

Type:

str

Default Value:

None

Flags:

READABLE

Peas.PluginInfo.props.loaded
Name:

loaded

Type:

bool

Default Value:

False

Flags:

READABLE

Peas.PluginInfo.props.module_dir
Name:

module-dir

Type:

str

Default Value:

None

Flags:

READABLE

Peas.PluginInfo.props.module_name
Name:

module-name

Type:

str

Default Value:

None

Flags:

READABLE

Peas.PluginInfo.props.name
Name:

name

Type:

str

Default Value:

None

Flags:

READABLE

Peas.PluginInfo.props.version
Name:

version

Type:

str

Default Value:

None

Flags:

READABLE

Peas.PluginInfo.props.website
Name:

website

Type:

str

Default Value:

None

Flags:

READABLE