magneticalc.Config_Group.Config_Collection

# ``magneticalc`.`Config_Group`.`Config_Collection``

class documentation

`class Config_Collection:`

Constructor: `Config_Collection(gui, prefix, types, first_without_suffix)`

View In Hierarchy

Config_Collection class.

Method | `__init__` | Initializes a config collection: A list of groups (dictionaries).
Method | `add_group` | Appends a group to the collection.
Method | `del_group` | Deletes a group from the collection.
Method | `get_all_groups` | Gets every group in the collection.
Method | `get_count` | Gets the number of groups in the collection.
Method | `get_group` | Gets a group from the collection.
Method | `set` | Sets a value for some key in a group of the collection.
Instance Variable | `first_without_suffix` | Undocumented
Instance Variable | `gui` | Undocumented
Instance Variable | `prefix` | Undocumented
Instance Variable | `types` | Undocumented
Method | `_get_suffix` | Gets the suffix for a given group index.

def __init__(self, gui: `GUI`, prefix: `str`, types: `dict`, first_without_suffix: `bool`):

Initializes a config collection: A list of groups (dictionaries).

Example for the SOMETHING collection, consisting of two groups _0 and _1, each with two keys FOO and BAR: SOMETHING_count = 2 SOMETHING_FOO_0 = "1st value in 1st group" SOMETHING_BAR_0 = "2nd value in 1st group" SOMETHING_FOO_1 = "1st value in 2nd group" SOMETHING_BAR_1 = "2nd value in 2nd group"

Parameters
gui: `GUI` | GUI
prefix: `str` | Prefix
types: `dict` | Key:Type (Dictionary)
first_without_suffix: `bool` | Enable to omit the suffix "_0" for the first group

def add_group(self, values: `dict | None`):

Appends a group to the collection.

Parameters
values: `dict | None` | Key:Value (Dictionary)

def del_group(self, group_index: `int`):

Deletes a group from the collection.

Parameters
group_index: `int` | Group index

def get_all_groups(self) -> `list[dict]`:

Gets every group in the collection.

Returns
`list[dict]` | List of groups (dictionaries)

def get_count(self) -> `int`:

Gets the number of groups in the collection.

Returns
`int` | Number of groups in the collection

def get_group(self, group_index: `int`) -> `dict`:

Gets a group from the collection.

Parameters
group_index: `int` | Group index

Returns
`dict` | Group (dictionary)

def set(self, group_index: `int`, key: `str`, value):

Sets a value for some key in a group of the collection.

Parameters
group_index: `int` | Group index
key: `str` | Key
value | Value

first_without_suffix =

Undocumented

gui =

Undocumented

prefix =

Undocumented

types =

Undocumented

def _get_suffix(self, group_index: `int`) -> `str`:

Gets the suffix for a given group index.

Parameters
group_index: `int` | Group index

Returns
`str` | String