From 968d04fb6ee620d8427d72226ae907962a13bde5 Mon Sep 17 00:00:00 2001 From: glitchassassin Date: Tue, 1 Nov 2016 07:32:00 -0400 Subject: [PATCH 1/3] Patch for wait() default time --- lackey/RegionMatching.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lackey/RegionMatching.py b/lackey/RegionMatching.py index 8552c31..1197615 100644 --- a/lackey/RegionMatching.py +++ b/lackey/RegionMatching.py @@ -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() From a4b803aad9b3e7653d717f922b274594e202b943 Mon Sep 17 00:00:00 2001 From: glitchassassin Date: Thu, 10 Nov 2016 08:49:20 -0500 Subject: [PATCH 2/3] Hotfixes for issues #25 and #26 Updated documentation and fixed Region's __repr__ method --- README.md | 20 ++++++++++++++++++++ lackey/RegionMatching.py | 18 ++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cd18de7..12841d0 100644 --- a/README.md +++ b/README.md @@ -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 them 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! diff --git a/lackey/RegionMatching.py b/lackey/RegionMatching.py index 1197615..5fb2ba1 100644 --- a/lackey/RegionMatching.py +++ b/lackey/RegionMatching.py @@ -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 @@ -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. From 167bbc2471098037b9bbf7264252921fe3350960 Mon Sep 17 00:00:00 2001 From: glitchassassin Date: Thu, 10 Nov 2016 08:50:13 -0500 Subject: [PATCH 3/3] Updated wording --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 12841d0..f62d63e 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ 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 them in brackets: ``{@}`` +To enter these characters (including parentheses) as literals, enclose each character in brackets: ``{@}`` Otherwise, this should function identically to Sikuli's type() method.