Components#

class Components(design: QDesign)[source]#

This is a user interface for the design._components dict.

The keys are unique integers, however, this interface allows user to treat the keys as strings.

Set up variables and logger which are used to emulate a dict which is referencing design._components.

Parameters:

design (QDesign) – Need to have a Qdesign class so this class can reference design._components.

Methods

__getitem__(name: str, quiet: bool = False) None | QComponent[source]#

Get the QComponent based on string name vs the unique id of QComponent.

Parameters:
  • name (str) – Name of component.

  • quiet (bool) – Allow warning messages to be generated.

Returns:

Class which describes the component. None if name not found in design._components.

Return type:

QComponent

Raises:

AttributeError – The given name is a magic method not in the dictionary

__len__() int[source]#

Give number of components in design.

Returns:

Total number of components registered within the design.

Return type:

int

find_id(name: str, quiet: bool = False) int[source]#

Find id of component. The id is the key for a dict which holds all of the components within design.

Parameters:
  • name (str) – Text name of component. The name is assumed to be unique.

  • quiet (bool) – Allow warning messages to be generated.

Returns:

Key to use in _components. If 0 is returned it means the name is not in dict.

Return type:

int

Raises:

AttributeError – The given name is a magic method not in the dictionary

get_list_ints(component_names: List[str]) List[int][source]#

Provide corresponding ints to be used as keys for dict: design._components, when list of names is provided.

Parameters:

component_names (List[str]) – Names of components which user wants to know the int to be used as a key.

Returns:

Corresponding ints that user can use as keys into design._components

Return type:

List[int]

items() list[source]#

Get a list of all the items.

Returns:

List of (key, value) pairs.

Return type:

list

keys() list[source]#

Get the list of all the keys.

Returns:

List of just the keys.

Return type:

list

values() list[source]#

Get the list of all the values.

Returns:

List of just the values.

Return type:

list