Wp.StateMetadata

g GObject.Object GObject.Object Wp.Object Wp.Object GObject.Object->Wp.Object Wp.StateMetadata Wp.StateMetadata Wp.Object->Wp.StateMetadata

Subclasses:

None

Methods

Inherited:

Wp.Object (12), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (core, name)

clear ()

get (key)

get_location ()

get_name ()

set (key, value)

Virtual Methods

Inherited:

Wp.Object (4), GObject.Object (7)

Properties

Inherited:

Wp.Object (4)

Name

Type

Flags

Short Description

name

str

r/w/co

The file name where the state metadata will be stored

timeout

int

r/w

The timeout in milliseconds to save the state metadata

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Wp.StateMetadata(**kwargs)
Bases:

Wp.Object

Abstract:

No

Structure:

Wp.StateMetadataClass

The Wp.StateMetadata class saves and loads properties from a file and reflects the state in a metadata object.

classmethod new(core, name)
Parameters:
  • core (Wp.Core) – the core associated with the state metadata

  • name (str) – the state metadata name

Returns:

the new Wp.StateMetadata

Return type:

Wp.StateMetadata

Constructs a new state metadata object.

clear()

Clears the state metadata and removes its file.

If the state metadata has not been loaded, this won’t do anything.

get(key)
Parameters:

key (str) – the key of the value

Returns:

the value from the state metadata, or None if not found.

Return type:

str

Gets a value from the state metadata.

If the state metadata has not been loaded, this won’t do anything.

get_location()
Returns:

the location of this state metadata

Return type:

str

Gets the location of a state metadata object.

get_name()
Returns:

the name of this state metadata

Return type:

str

Gets the name of a state metadata object.

set(key, value)
Parameters:
  • key (str) – the key to set.

  • value (str or None) – the value to set, or None to unset the given key

Sets a value into the state metadata.

If value is None, it will unset the given key. Note that this will also save the state after the timeout has elapsed. If the state metadata has not been loaded, this won’t do anything.

Property Details

Wp.StateMetadata.props.name
Name:

name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The file name where the state metadata will be stored

Wp.StateMetadata.props.timeout
Name:

timeout

Type:

int

Default Value:

1000

Flags:

READABLE, WRITABLE

The timeout in milliseconds to save the state metadata