-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from glitchassassin/develop
v0.7.1
- Loading branch information
Showing
11 changed files
with
167 additions
and
15 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import sys | ||
import os.path | ||
|
||
if sys.version_info[0] == 3: | ||
from importlib.abc import MetaPathFinder | ||
from importlib.util import spec_from_file_location | ||
from importlib.machinery import SourceFileLoader | ||
|
||
class SikuliFinder(MetaPathFinder): | ||
def find_spec(self, fullname, path, target=None): | ||
if "." in fullname: | ||
name = fullname.split(".")[-1] | ||
else: | ||
name = fullname | ||
for entry in sys.path: | ||
if entry == "": | ||
entry = os.getcwd() | ||
sikuli_path = os.path.join(entry, "{}.sikuli".format(name)) | ||
filename = os.path.join(sikuli_path, "{}.py".format(name)) | ||
if not os.path.exists(filename): | ||
continue | ||
|
||
# Found what we're looking for. Add to path. | ||
sys.path.append(sikuli_path) | ||
|
||
return spec_from_file_location(fullname, filename, loader=SourceFileLoader(fullname, filename), | ||
submodule_search_locations=None) | ||
|
||
return None # we don't know how to import this | ||
sys.meta_path.append(SikuliFinder()) | ||
elif sys.version_info[0] == 2: | ||
import imp | ||
|
||
class SikuliFinder(object): | ||
def __init__(self, path): | ||
self.path = path | ||
|
||
@classmethod | ||
def find_module(cls, name, path=None): | ||
for entry in sys.path: | ||
sikuli_path = os.path.join(entry, "{}.sikuli".format(name)) | ||
filename = os.path.join(sikuli_path, "{}.py".format(name)) | ||
if not os.path.exists(filename): | ||
continue | ||
|
||
# Found what we're looking for. Add to path. | ||
sys.path.append(sikuli_path) | ||
return cls(filename) | ||
|
||
def load_module(self, name): | ||
if name in sys.modules: | ||
return sys.modules[name] | ||
with open(self.path, "r") as project: | ||
mod = imp.load_module(name, project, self.path, (".py", "r", imp.PY_SOURCE)) | ||
return mod | ||
sys.meta_path.append(SikuliFinder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
""" | ||
|
||
__version__ = "0.7.0" | ||
__version__ = "0.7.1" | ||
__sikuli_version__ = "1.1.0" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
|
||
<html> | ||
<head> | ||
<style type="text/css"> | ||
.sikuli-code { | ||
font-size: 20px; | ||
font-family: "Osaka-mono", Monospace; | ||
line-height: 1.5em; | ||
display:table-cell; | ||
white-space: pre-wrap; /* css-3 */ | ||
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ | ||
white-space: -pre-wrap; /* Opera 4-6 */ | ||
white-space: -o-pre-wrap; /* Opera 7 */ | ||
word-wrap: break-word; /* Internet Explorer 5.5+ */ | ||
width: 99%; /* remove horizontal scroll-bar when viewing in IE7 */ | ||
} | ||
.sikuli-code img { | ||
vertical-align: middle; | ||
margin: 2px; | ||
border: 1px solid #ccc; | ||
padding: 2px; | ||
-moz-border-radius: 5px; | ||
-webkit-border-radius: 5px; | ||
-moz-box-shadow: 1px 1px 1px gray; | ||
-webkit-box-shadow: 1px 1px 2px gray; | ||
} | ||
.kw { | ||
color: blue; | ||
} | ||
.skw { | ||
color: rgb(63, 127, 127); | ||
} | ||
|
||
.str { | ||
color: rgb(128, 0, 0); | ||
} | ||
|
||
.dig { | ||
color: rgb(128, 64, 0); | ||
} | ||
|
||
.cmt { | ||
color: rgb(200, 0, 200); | ||
} | ||
|
||
h2 { | ||
display: inline; | ||
font-weight: normal; | ||
} | ||
|
||
.info { | ||
border-bottom: 1px solid #ddd; | ||
padding-bottom: 5px; | ||
margin-bottom: 20px; | ||
display: none; | ||
} | ||
|
||
a { | ||
color: #9D2900; | ||
} | ||
|
||
body { | ||
font-family: "Trebuchet MS", Arial, Sans-Serif; | ||
} | ||
|
||
</style> | ||
</head> | ||
<body> | ||
<div class="info"> | ||
<h2>test.sikuli</h2> <a href="test.zip">(Download this script)</a> | ||
</div> | ||
<pre class="sikuli-code"> | ||
<span class="skw">find</span>(<img src="1514401659995.png" />) | ||
</pre> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import sys | ||
from lackey import * | ||
|
||
find("1514401659995.png") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.