guibot.config module¶
Global and local (per target or region instance) configuration.
SUMMARY¶
INTERFACE¶
- class guibot.config.GlobalConfig[source]¶
Bases:
objectHandler for default configuration present in all cases where no specific value is set.
The methods of this class are shared among all of its instances.
- delay_after_drag = 0.5¶
timeout before drag operation
- delay_before_drop = 0.5¶
timeout before drop operation
- rescan_speed_on_find = 0.2¶
time interval between two image matching attempts (used to reduce overhead on the CPU)
- wait_for_animations = False¶
whether to wait for animations to complete and match only static (not moving) targets
- smooth_mouse_drag = True¶
whether to move the mouse cursor to a location instantly or smoothly
- preprocess_special_chars = True¶
whether to preprocess capital and special characters and handle them internally
- save_needle_on_error = True¶
whether to perform an extra needle dump on matching error
- image_logging_level = 40¶
logging level similar to the python logging module
- image_logging_step_width = 3¶
number of digits when enumerating the image logging steps, e.g. value=3 for 001, 002, etc.
- image_logging_destination = 'imglog'¶
relative path of the image logging steps
- display_control_backend = 'autopy'¶
name of the display control backend
- find_backend = 'hybrid'¶
name of the computer vision backend
- contour_threshold_backend = 'adaptive'¶
name of the contour threshold backend
- template_match_backend = 'ccoeff_normed'¶
name of the template matching backend
- feature_detect_backend = 'ORB'¶
name of the feature detection backend
- feature_extract_backend = 'ORB'¶
name of the feature extraction backend
- feature_match_backend = 'BruteForce-Hamming'¶
name of the feature matching backend
- text_detect_backend = 'contours'¶
name of the text detection backend
- text_ocr_backend = 'pytesseract'¶
name of the optical character recognition backend
- deep_learn_backend = 'pytorch'¶
name of the deep learning backend
- hybrid_match_backend = 'template'¶
name of the hybrid matching backend for unconfigured one-step targets
- class guibot.config.TemporaryConfig[source]¶
Bases:
objectProxy a GlobalConfig instance extending it to add context support.
The context support is such that once this context ends the changes to the wrapped config object are restored.
This is useful when we have a global config instance and need to change it only for a few operations.
>>> print(GlobalConfig.delay_before_drop) 0.5 >>> with TemporaryConfig() as cfg: ... cfg.delay_before_drop = 1.3 ... print(cfg.delay_before_drop) ... print(GlobalConfig.delay_before_drop) ... 1.3 1.3 >>> print(GlobalConfig.delay_before_drop) 0.5
- class guibot.config.LocalConfig(configure: bool = True, synchronize: bool = True)[source]¶
Bases:
objectContain locally the configuration of all display control and computer vision backends.
The local container is reponsible for making them behave according to the selected parameters as well as for providing information about them and the current parameters.
- configure_backend(backend: str = None, category: str = 'type', reset: bool = False) None[source]¶
Generate configuration dictionary for a given backend.
- Parameters:
backend – name of a preselected backend, see algorithms[category]
category – category for the backend, see algorithms.keys()
reset – whether to (re)set all parent configurations as well
- Raises:
UnsupportedBackendErrorif backend is not among the supported backends for the category (and is not None) or the category is not found
- configure(reset: bool = True, **kwargs: dict[str, type]) None[source]¶
Generate configuration dictionary for all backends.
- Parameters:
reset – whether to (re)set all parent configurations as well
If multiple categories are available and just some of them are configured, the rest will be reset to defaults. To configure specific category without changing others, use
configure().
- synchronize_backend(backend: str = None, category: str = 'type', reset: bool = False) None[source]¶
Synchronize a category backend with the equalizer configuration.
- Parameters:
backend – name of a preselected backend, see algorithms[category]
category – category for the backend, see algorithms.keys()
reset – whether to (re)sync all parent backends as well
- Raises:
UnsupportedBackendErrorif the category is not found- Raises:
UninitializedBackendErrorif there is no backend object that is configured with and with the required name