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 = 0.05

time interval between mouse down and up in a click

click_delay = 0.1

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

delay_after_drag = 0.5

timeout before drag operation

delay_before_drop = 0.5

timeout before drop operation

delay_before_keys = 0.2

timeout before key press operation

delay_between_keys = 0.1

time interval between two consecutively typed keys

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 = 'pyautogui'

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

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