pic_scanner.gui.models.element_bases.element_key.factories
Attributes
Classes
A class to represent the key for a GUI element. |
|
A factory class to create GUIElementKey objects with predefined configurations. |
Module Contents
- class pic_scanner.gui.models.element_bases.element_key.factories.GUIElementKey(key: str, enable_prefix: bool = False, enable_suffix: bool = False, prefix: str = None, suffix: str = None, replace_spaces: bool = False, replacement_char: str = '_', part_delimiter: str = '_', all_upper: bool = True, *args, **kwargs)
Bases:
str,pic_scanner.log_engine.LoggableA class to represent the key for a GUI element.
The class is a subclass of the `str
- Properties:
- prefix_enabled (bool):
Whether the prefix is enabled.
- prefix (str):
The prefix for the key.
- suffix_enabled (bool):
Whether the suffix is enabled.
- suffix (str):
The suffix for the key.
- pre_formatted (str):
The pre-formatted key.
- replacement_char (str):
The character to replace spaces with.
- replace_spaces (bool):
Whether to replace spaces in the key.
- formatted_key (str):
The formatted key.
This property is read-only and consists of the prefix, key, and suffix.
- part_delimiter (str):
The delimiter for the key parts.
- Parameters:
key (str)
enable_prefix (bool)
enable_suffix (bool)
prefix (str)
suffix (str)
replace_spaces (bool)
replacement_char (str)
part_delimiter (str)
all_upper (bool)
- property all_upper
- Whether the key should be all upper case.
- Returns:
True if the key should be all upper case, False otherwise.
- Return type:
bool
- property part_delimiter_1
- The first part delimiter for the key.
- Returns:
The first part delimiter for the key.
- Return type:
str
- property part_delimiter_2
- The second part delimiter for the key.
- Returns:
The second part delimiter for the key.
- Return type:
str
- property prefix_enabled: bool
Whether the prefix is enabled.
- Returns:
True if the prefix is enabled, False otherwise.
- Return type:
bool
- property prefix: str
The prefix for the key.
- Returns:
The prefix for the key.
- Return type:
str
- property suffix_enabled: bool
Whether the suffix is enabled.
- Returns:
True if the suffix is enabled, False otherwise.
- Return type:
bool
- property suffix: str
The suffix for the key.
- Returns:
The suffix for the key.
- Return type:
str
- property pre_formatted: str
The pre-formatted key.
- Returns:
The pre-formatted key.
- Return type:
str
- property replacement_char: str
The character to replace spaces with.
- Returns:
The character to replace spaces with.
- Return type:
str
- property replace_spaces: bool
Whether to replace spaces in the key.
- Returns:
True if spaces should be replaced, False otherwise.
- Return type:
bool
- property formatted_key: str
The formatted key.
- Returns:
The formatted key.
- Return type:
str
- property formatted
- The formatted key with the prefix and suffix.
- Returns:
The formatted key.
- Return type:
str
- pic_scanner.gui.models.element_bases.element_key.factories.PARENT_LOGGER
- pic_scanner.gui.models.element_bases.element_key.factories.MOD_LOGGER
- class pic_scanner.gui.models.element_bases.element_key.factories.GUIElementKeyFactory(default_prefix=None, default_suffix=None, default_replacement_char='_', default_part_delimiter='_', default_all_upper=True, default_replace_spaces=True, skip_sample=True)
Bases:
pic_scanner.gui.models.element_bases.element_key.LoggableA factory class to create GUIElementKey objects with predefined configurations.
- create_key(key: str, enable_prefix: bool = False, enable_suffix: bool = False, prefix: str = None, suffix: str = None, replace_spaces: bool = None, replacement_char: str = None, part_delimiter: str = None, all_upper: bool = None) pic_scanner.gui.models.element_bases.element_key.GUIElementKey
Create a GUIElementKey with the specified parameters, falling back to factory defaults where necessary.
- Parameters:
key (str) – The base key string.
enable_prefix (bool) – Whether to enable the prefix.
enable_suffix (bool) – Whether to enable the suffix.
prefix (str) – The prefix to use. Defaults to the factory default.
suffix (str) – The suffix to use. Defaults to the factory default.
replace_spaces (bool) – Whether to replace spaces in the key.
replacement_char (str) – The character to replace spaces with. Defaults to the factory default.
part_delimiter (str) – The delimiter for the key parts. Defaults to the factory default.
all_upper (bool) – Whether to convert the key to all upper case. Defaults to the factory default.
- Returns:
` The configured GUI element key.
- Return type: