Class KeyValArgs
- class ooodev.events.args.key_val_args.KeyValArgs(source, key, value)[source]
Bases:
AbstractKeyValArgsKey Value Args
New in version 0.9.0.
- Parameters:
source (Any) –
key (str) –
value (Any) –
- __init__(source, key, value)
Constructor
- Parameters:
source (Any) – Event Source
key (str) – Key
(Any (value) – Value
value (Any) –
- Return type:
None
- static from_args(args)[source]
Gets a new instance from existing instance
- Parameters:
args (KeyValArgs) – Existing Instance
- Returns:
args
- Return type:
- get(key, default=<ooodev.utils.gen_util._null_obj object>)
Gets user data from event.
- Parameters:
key (str) – Key used to store data
default (Any, optional) – Default value to return if
keyis not found.
- Returns:
Data for
keyif found; Otherwise, ifdefaultis set thendefault.- Return type:
Any
New in version 0.9.0.
- has(key)
Gets if a key exist in the instance
- Parameters:
key (str) – key
- Returns:
Trueif key exist; OtherwiseFalse- Return type:
bool
New in version 0.9.0.
- remove(key)
Removes key value pair from instance
- Parameters:
key (str) – key
- Returns:
Trueif key was found and removed; Otherwise,False- Return type:
bool
New in version 0.9.0.
- set(key, value, allow_overwrite=True)
Sets a key value pair for event instance.
- Parameters:
key (str) – Key
value (Any) – Value
allow_overwrite (bool, optional) – If
Trueand akeyalready exist then itsvaluewill be over written; Otherwisevaluewill not be over written. Defaults toTrue.
- Returns:
Trueif values is written; Otherwise,False- Return type:
bool
New in version 0.9.0.
- cmd: str
Gets/Sets the dispatch cmd of the event
- default
- event_data: Any
Gets/Sets any extra data associated with the event
- 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
- key
- source: Any
Gets/Sets Event source
- value