guibot.config module

SUMMARY

Global and local (per target or region instance) configuration.

INTERFACE

class guibot.config.GlobalConfig[source]

Bases: object

Handler 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.

toggle_delay = None

time interval between mouse down and up in a click

click_delay = None

time interval after a click (in a double or n-click)

delay_after_drag = None

timeout before drag operation

delay_before_drop = None

timeout before drop operation

delay_before_keys = None

timeout before key press operation

delay_between_keys = None

time interval between two consecutively typed keys

rescan_speed_on_find = None

time interval between two image matching attempts (used to reduce overhead on the CPU)

wait_for_animations = None

whether to wait for animations to complete and match only static (not moving) targets

smooth_mouse_drag = None

whether to move the mouse cursor to a location instantly or smoothly

preprocess_special_chars = None

whether to preprocess capital and special characters and handle them internally

save_needle_on_error = None

whether to perform an extra needle dump on matching error

image_logging_level = None

logging level similar to the python logging module

image_logging_step_width = None

number of digits when enumerating the image logging steps, e.g. value=3 for 001, 002, etc.

image_logging_destination = None

relative path of the image logging steps

display_control_backend = None

name of the display control backend

find_backend = None

name of the computer vision backend

contour_threshold_backend = None

name of the contour threshold backend

template_match_backend = None

name of the template matching backend

feature_detect_backend = None

name of the feature detection backend

feature_extract_backend = None

name of the feature extraction backend

feature_match_backend = None

name of the feature matching backend

text_detect_backend = None

name of the text detection backend

text_ocr_backend = None

name of the optical character recognition backend

deep_learn_backend = None

name of the deep learning backend

hybrid_match_backend = None

name of the hybrid matching backend for unconfigured one-step targets

class guibot.config.TemporaryConfig[source]

Bases: object

Proxies a GlobalConfig instance extending it to add context support, 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
__init__()[source]

Build a temporary global config.

__getattribute__(name)[source]

Return getattr(self, name).

__setattr__(name, value)[source]

Implement setattr(self, name, value).

__enter__()[source]
__exit__(*_)[source]
class guibot.config.LocalConfig(configure=True, synchronize=True)[source]

Bases: object

Container for the configuration of all display control and computer vision backends, responsible for making them behave according to the selected parameters as well as for providing information about them and the current parameters.

__init__(configure=True, synchronize=True)[source]

Build a container for the entire backend configuration.

Parameters:
  • configure (bool) – whether to also generate configuration
  • synchronize (bool) – whether to also apply configuration

Available algorithms can be seen in the algorithms attribute whose keys are the algorithm types and values are the members of these types. The algorithm types are shortened as categories.

A parameter can be accessed as follows (example):

print(self.params["control"]["vnc_hostname"])
configure_backend(backend=None, category='type', reset=False)[source]

Generate configuration dictionary for a given backend.

Parameters:
  • backend (str or None) – name of a preselected backend, see algorithms[category]
  • category (str) – category for the backend, see algorithms.keys()
  • reset (bool) – whether to (re)set all parent configurations as well
Raises:

UnsupportedBackendError if backend is not among the supported backends for the category (and is not None) or the category is not found

configure(reset=True, **kwargs)[source]

Generate configuration dictionary for all backends.

Parameters:reset (bool) – 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=None, category='type', reset=False)[source]

Synchronize a category backend with the equalizer configuration.

Parameters:
  • backend (str or None) – name of a preselected backend, see algorithms[category]
  • category (str) – category for the backend, see algorithms.keys()
  • reset (bool) – whether to (re)sync all parent backends as well
Raises:

UnsupportedBackendError if the category is not found

Raises:

UninitializedBackendError if there is no backend object that is configured with and with the required name

synchronize(*args, reset=True, **kwargs)[source]

Synchronize all backends with the current configuration dictionary.

Parameters:reset (bool) – whether to (re)sync all parent backends as well