Skip to content

Commit

Permalink
Merge pull request #106 from glitchassassin/develop
Browse files Browse the repository at this point in the history
v0.7.0
  • Loading branch information
glitchassassin authored Oct 24, 2017
2 parents bc6cbe0 + 692cc98 commit c853fd8
Show file tree
Hide file tree
Showing 21 changed files with 818 additions and 118 deletions.
42 changes: 42 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
matrix:
include:
- os: osx
language: generic
env: PYTHON=2.7
- os: osx
language: generic
env: PYTHON=3.5.4
- os: osx
language: generic
env: PYTHON=3.6.3

before_install: "if [ \"$TRAVIS_OS_NAME\" == \"osx\" ]; then\n brew update\n brew
install openssl readline\n\n # install pyenv\n git clone --depth 1 https://github.com/pyenv/pyenv
~/.pyenv\n PYENV_ROOT=\"$HOME/.pyenv\"\n PATH=\"$PYENV_ROOT/bin:$PATH\"\n eval
\"$(pyenv init -)\"\n\n # set up Python environment\n pyenv install $PYTHON\n
\ pyenv global $PYTHON\n \n pyenv rehash\n python -m pip install virtualenv\n
\ python -m virtualenv ~/.venv\n source ~/.venv/bin/activate\nfi\n"

install:
- python --version
- python -m pip install --disable-pip-version-check --upgrade pip
- pip install -r osx_requirements.txt
- python -m easy_install -U setuptools

script:
- python setup.py install
- python tests/appveyor_test_cases.py

after_success:
- python setup.py bdist_wheel
- python setup.py sdist
- ls dist


deploy:
provider: pypi
user: glitchassassin
password:
secure: YuUL3YmD6c+X3BBu3bgAhvkFHfE7dMK+dJzPuvSN6MNoYntzDQRHLAARLbs6SYmytHrj1M9MReA43fQOhIi3FSHvS6rOSgiMzfwdz0BUA9KQNCKn/rj56vgMoKJwq2Fp5lEz292VhHSh0qpyGl+k52dTodIpqxFMBKMXoxWBjNam2DXjRTHLKCex3aiGOF9Fm5Vhlwd0fAy+6T3YKuijr++a9B5szt8Ex7iMzlH3DJNYTsPxu5RdUrbKRoNY5SSf+7BgqlLqBvE6qCxgeMxSBgkkaQNjYTY4ZkLtIweWtfMzHFLBUlPfen0E7bMlU1w4tnLVKam/xO7qz+vEwm4LrPQQGtkt8WL5b89oNmQ/e7ocTt1Kw8OU+rCB4VIXXT92qT05dETjloAOL8c7Csl/Gl/DctZyZg3I4gsHw7mkK/wZkZDnAwb0k7pH2ECownYSY7m5QbibDVZzFZGoJwtwuweELeg1zJW89r+w4ZhXuXvRjJB1kYukLrd9POTEdAlp0Cjs0QM0PxD8S9yONjUv2skgK00DF1uJNVN7sF/zNF+ulq3nbQGvN6c8zzUQEOPFKHZoqiEW58Dt+MVAYMIjHRhjVb1rrUYTidJjmwV3+zsfMlCQhChOO4UvXcsXwmO6AIpGRbhmzmdwArylOT9BxR7AcuuI1aDqsQ35p7d+jjU=
on:
tags: true
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ In my line of work, I have a lot of tasks walking through line-of-business appli

There are some existing libraries for this purpose, like `pywinauto` and `autopy`, but they didn't work for me for one reason or another. I wasn't doing a lot of Windows GUI interaction with these particular applications, so `pywinauto`'s approach wouldn't help. I needed something that could search for and use images on screen. `autopy` was closer, but it had quite a few outstanding issues and hadn't been updated in a while.

Most of my automation is in Windows, so I've begun this library with only Windows support. However, it's designed to eventually be extended with support for Mac OS X and Linux by implementing additional "PlatformManager" classes. I'll get around to these at some point, but if you'd like to contribute one sooner, please feel free!
Most of my automation is in Windows, so I've begun this library with only Windows support. As of version 0.7.0, it also includes Mac OS X support,and it's designed to eventually be extended with support for Linux by implementing an additional "PlatformManager" class. I'll get around to this at some point, but if you'd like to contribute one sooner, please feel free!

### Sikuli Patching ###

Expand All @@ -67,11 +67,11 @@ My goal with this project is to be able to reuse my existing library of Sikuli s

Note that I *have* had to adjust some of my image search similarity settings in a couple cases. Your mileage may vary. Please report any issues that you encounter and I'll try to get them patched.

Be aware that **some Sikuli-script methods actually overwrite Python-native functions**, namely `type()` and `input()`. Where this is the case, I've remapped the native functions by prefixing them with an underscore. They can be accessed as follows:
Be aware that **some Sikuli-script methods actually overwrite Python-native functions**, namely `type()` and `input()`. Where this is the case, I've remapped the native functions by adding a trailing underscore. They can be accessed as follows:

from lackey import *

username = _input("Enter your username: ")
username = input_("Enter your username: ")

## Structure ##

Expand Down
7 changes: 5 additions & 2 deletions lackey/App.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@

from .RegionMatching import Region
from .SettingsDebug import Debug
from .PlatformManagerWindows import PlatformManagerWindows

if platform.system() == "Windows":
from .PlatformManagerWindows import PlatformManagerWindows
PlatformManager = PlatformManagerWindows() # No other input managers built yet
elif platform.system() == "Darwin":
from .PlatformManagerDarwin import PlatformManagerDarwin
PlatformManager = PlatformManagerDarwin()
else:
# Avoid throwing an error if it's just being imported for documentation purposes
if not os.environ.get('READTHEDOCS') == 'True':
raise NotImplementedError("Lackey is currently only compatible with Windows.")
raise NotImplementedError("Lackey is currently only compatible with Windows and OSX.")

# Python 3 compatibility
try:
Expand Down
1 change: 0 additions & 1 deletion lackey/Exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ class ImageMissing(Exception):
""" Exception: Unable to find the image file """
def __init__(self, event):
Exception.__init__(self, str(event))

12 changes: 8 additions & 4 deletions lackey/InputEmulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,19 @@ def __init__(self):

def move(self, loc, yoff=None):
""" Moves cursor to specified location. Accepts the following arguments:
* ``move(loc)`` - Move cursor to ``Location``
* ``move(xoff, yoff) - Move cursor to offset from current location
"""
from .Geometry import Location
self._lock.acquire()
if isinstance(loc, Location):
mouse.move(loc.x, loc.y)
elif yoff is not None:
xoff = loc
mouse.move(xoff, yoff)
else:
mouse.move(loc, yoff)
raise ValueError("Invalid argument. Expected either move(loc) or move(xoff, yoff).")
self._last_position = loc
self._lock.release()

Expand Down Expand Up @@ -143,7 +146,7 @@ def __init__(self):
"INSERT": "ins",
"DELETE": "del",
"WIN": "win",
"CMD": "win",
"CMD": "command",
"META": "win",
"NUM0": "keypad 0",
"NUM1": "keypad 1",
Expand Down Expand Up @@ -367,6 +370,7 @@ def type(self, text, delay=0.1):
# Release the rest of the keys normally
self.type(special_code)
self.type(text[i])
special_code = ""
elif in_special_code:
special_code += text[i]
elif text[i] in self._REGULAR_KEYCODES.keys():
Expand All @@ -376,6 +380,6 @@ def type(self, text, delay=0.1):
keyboard.press(self._SPECIAL_KEYCODES["SHIFT"])
keyboard.press_and_release(self._UPPERCASE_KEYCODES[text[i]])
keyboard.release(self._SPECIAL_KEYCODES["SHIFT"])
if delay:
if delay and not in_special_code:
time.sleep(delay)

2 changes: 1 addition & 1 deletion lackey/KeyCodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Key():
PRINTSCREEN = "{PRINTSCREEN}"
ALT = "{ALT}"
CMD = "{CMD}"
CONTROL = "{CTRL}"
CTRL = "{CTRL}"
META = "{META}"
SHIFT = "{SHIFT}"
WIN = "{WIN}"
Expand Down
Loading

0 comments on commit c853fd8

Please sign in to comment.