Class EventArgsGeneric

class ooodev.events.args.event_args_generic.EventArgsGeneric(source, event_data)[source]

Bases: Generic[_T]

Generic Event Args

__init__(source, event_data)[source]
Parameters:
  • source (Any) –

  • event_data (_T) –

Return type:

None

static from_args(args)[source]

Gets a new instance from existing instance

Parameters:

args (EventArgsGeneric) – Existing Instance

Returns:

args

Return type:

EventArgsGeneric

get(key, default=<object object>)[source]

Gets user data from event.

Parameters:
  • key (str) – Key used to store data

  • default (Any, optional) – Default value to return if key is not found.

Returns:

Data for key if found; Otherwise, if default is set then default.

Return type:

Any

has(key)[source]

Gets if a key exist in the instance

Parameters:

key (str) – key

Returns:

True if key exist; Otherwise False

Return type:

bool

remove(key)[source]

Removes key value pair from instance

Parameters:

key (str) – key

Returns:

True if key was found and removed; Otherwise, False

Return type:

bool

set(key, value, allow_overwrite=True)[source]

Sets a key value pair for event instance.

Parameters:
  • key (str) – Key

  • value (Any) – Value

  • allow_overwrite (bool, optional) – If True and a key already exist then its value will be over written; Otherwise value will not be over written. Defaults to True.

Returns:

True if values is written; Otherwise, False

Return type:

bool

event_data
property event_name: str

Gets the event name for these args

Return type:

str

property event_source: Any | None

Gets the event source for these args

Return type:

Any | None

source