Skip to content

Commit

Permalink
Merge pull request #27 from glitchassassin/develop
Browse files Browse the repository at this point in the history
v0.4.1a1
  • Loading branch information
glitchassassin authored Nov 10, 2016
2 parents 99c640d + 167bbc2 commit 2c84bfa
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ Be aware that **some Sikuli-script methods actually overwrite Python-native func

username = _input("Enter your username: ")

### Differences ###

Lackey's implementation of `type()` varies slightly from Sikuli in that it expects a SendKeys-like format.

The following special characters are available as modifiers:

* ``^`` - Ctrl
* ``+`` - Shift
* ``%`` - Alt
* ``@`` - Win/Meta/Cmd
* ``~`` - Enter/Return

They can be used to modify a single following character. ``^c`` will type Ctrl+C.
If you need to modify multiple characters, use parentheses: ``+(abc)`` will hold down
Shift and type "ABC".

To enter these characters (including parentheses) as literals, enclose each character in brackets: ``{@}``

Otherwise, this should function identically to Sikuli's type() method.

## Structure ##

Each platform (Windows/OSX/Linux) needs its own PlatformManager (see documentation above) to abstract OS-level functionality, like simulating mouse clicks or key presses. Ideally, these should be implemented with as few 3rd-party library dependencies as possible. If you'd like to contribute a PlatformManager for your OS, feel free to submit a pull request!
Expand Down
20 changes: 17 additions & 3 deletions lackey/RegionMatching.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def findAll(self, pattern):
self._lastMatchTime = (time.time() - find_time) * 1000 # Capture find time in milliseconds
return self._lastMatches

def wait(self, pattern, seconds=None):
def wait(self, pattern, seconds=3):
""" Searches for an image pattern in the given region, given a specified timeout period
Functionally identical to find()
Expand Down Expand Up @@ -670,7 +670,21 @@ def type(self, *args):
""" Usage: type([PSMRL], text, [modifiers])
If a pattern is specified, the pattern is clicked first. Doesn't support text paths.
``modifiers`` may be a typeKeys() compatible string. The specified keys will be held during the drag-drop operation.
This implementation varies slightly from Sikuli by allowing a SendKeys variant format.
The following special characters are available as modifiers:
* ``^`` - Ctrl
* ``+`` - Shift
* ``%`` - Alt
* ``@`` - Win/Meta/Cmd
* ``~`` - Enter/Return
They can be used to modify a single following character. ``^c`` will type Ctrl+C.
If you need to modify multiple characters, use parentheses: ``+(abc)`` will hold down
Shift and type "ABC".
To enter these characters as literals, enclose them in brackets: ``{@}``
"""
pattern = None
text = None
Expand Down Expand Up @@ -976,7 +990,7 @@ def getTarget(self):
return self.getCenter().offset(self._target.x, self._target.y)

def __repr__(self):
return "Match[{},{} {}x{}] score={.2f}, target={}".format(self.x, self.y, self.w, self.h, self._score, self.target.getTuple())
return "Match[{},{} {}x{}] score={.2f}, target={}".format(self.x, self.y, self.w, self.h, self._score, self._target.getTuple())

class Screen(Region):
""" Individual screen objects can be created for each monitor in a multi-monitor system.
Expand Down

0 comments on commit 2c84bfa

Please sign in to comment.