ConsoleUser

Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com

This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.

All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.

class System.System(config)

I am the public interface to the remote system being controlled by this ConsoleUser. I use the Bridge Pattern to choose the correct type of system interface to actually interact with the remote system.

Parameters:

  • config: a :doc:UserConfig object

activate_icon(icon, enter=False)

Given an icon activate it. This will, for coordinate type systems, involve finding it and clicking on it. Some will require hitting Enter as well, though some do not.

Parameters:

  • icon: the <no title> that we are to activate

  • enter: whether or not to hit ENTER after selecting the icon

click_mouse(button)

Click the given mouse button once.

Parameters:

  • button: which mouse button should be clicked

click_region(region)

Locate the given region, then click a spot within it (the spot can be any spot in the region, so this may not be suitable for every caller!).

Parameters:

  • region: a <no title> to locate on the screen then click

Return: True if the region was found and clicked, False otherwise

click_within(bounds)

Given the bounds, click somewhere within them.

get_screen()

Get the screen of the remote system as an Region object. The screen is, of course, the largest possible region that could be matched.

Return: a Region object which represents the entire screen

key_down(key)

Hold down a given key. It will be released later by a call to key_up (or some type_str which will also release it).

Parameters:

  • key: the key to hold. This can be any printable character or a special string which indicates one of the meta keys (e.g. SHIFT). Except when the string is a meta key string this should be exactly 1 character long

key_up(key)

Release a given key. It will probably have been held down by a previous call to key_down.

Parameters:

  • key: the key to release. This can be any printable character or a special string which indicates one of the meta keys (e.g. SHIFT). Except when the string is a meta key string this should be exactly 1 character long

mouse_down(button)

Press one button on the mouse and do not release it until a later call.

Parameters:

  • button: which button to press

mouse_up(button)

Release a mouse button which had been pressed (as from a call to mouse_down) earlier.

Parameters:

  • button: which button to release

move_mouse(x, y)

Move the mouse cursor to the given x, y location. Depending on the Mouse Strategy being used the end coordinates may or may not exactly match the given ones.

Parameters:

  • x: the x coordinate the mouse should end in

  • y: the y coordinate the mouse shoudl end in

type_and_verify_str(msg, start_x, start_y, font)

Type the message on the remote system, translating any meta keys in the message, and verify that each character shows up as expected.

Parameters:

  • msg: the formatted string to type

  • start_x: the X coordinate at which the first char will appear

  • start_y: the Y coordinate at which the first char will appear

  • font: the <no title> in which the characters will be rendered

type_str(msg)

Type the given message on the remote system, translating any special keys (e.g., alt or control). Depending on the keyboard strategy employeed the resulting string may or may not exactly match the passed in string.

Parameters:

  • msg: the string to type

up_all_mod_keys()

Send an “up” to all the modifier keys, just in case any were still down from a previous action.