[sikuli] 136/385: starting to fix image path handling on scripting level (import support)
Gilles Filippini
pini at moszumanska.debian.org
Sun Jun 29 19:26:00 UTC 2014
This is an automated email from the git hooks/post-receive script.
pini pushed a commit to tag upstream/1.1.0_beta1
in repository sikuli.
commit 4e7d9fd777574c80f16ca76029451c228fd0711e
Author: Raimund Hocke <rmhdevelop at me.com>
Date: Tue Jan 7 18:38:43 2014 +0100
starting to fix image path handling on scripting level (import support)
---
API/src/main/java/org/sikuli/script/ImagePath.java | 7 +++++--
Basics/src/main/resources/Lib/sikuli/Sikuli.py | 8 ++++----
.../src/main/resources/Lib/sikuli/SikuliImporter.py | 20 +++++++++++++-------
3 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/API/src/main/java/org/sikuli/script/ImagePath.java b/API/src/main/java/org/sikuli/script/ImagePath.java
index be458ae..fc2b5c8 100644
--- a/API/src/main/java/org/sikuli/script/ImagePath.java
+++ b/API/src/main/java/org/sikuli/script/ImagePath.java
@@ -264,8 +264,11 @@ public class ImagePath {
* @return true on success, false otherwise
*/
public static boolean resetBundlePath(String bundlePath) {
- reset();
- return setBundlePath(bundlePath);
+ if (!FileManager.pathEquals(imagePaths.get(0).pathGiven, bundlePath)) {
+ reset();
+ return setBundlePath(bundlePath);
+ }
+ return true;
}
/**
diff --git a/Basics/src/main/resources/Lib/sikuli/Sikuli.py b/Basics/src/main/resources/Lib/sikuli/Sikuli.py
index 0cefb4a..ead3fd5 100755
--- a/Basics/src/main/resources/Lib/sikuli/Sikuli.py
+++ b/Basics/src/main/resources/Lib/sikuli/Sikuli.py
@@ -135,25 +135,25 @@ def addImportPath(path):
# append the given path image path list if not yet contained
#
def addImagePath(path):
- ImagePath.addImagePath(path)
+ ImagePath.add(path)
##
# return the current image path list
#
def getImagePath():
- return [e for e in ImagePath.getImagePath() if e]
+ return [e.pathGiven for e in ImagePath.getPaths() if e]
##
# remove the given path from the image path
#
def removeImagePath(path):
- ImagePath.removeImagePath(path)
+ ImagePath.remove(path)
##
# reset the image path, so it only contains the bundlepath
#
def resetImagePath(path):
- ImagePath.resetImagePath(path)
+ ImagePath.reset(path)
##
# Sets the path for searching images in all Sikuli Script methods. <br/>
diff --git a/Basics/src/main/resources/Lib/sikuli/SikuliImporter.py b/Basics/src/main/resources/Lib/sikuli/SikuliImporter.py
index 600c7a7..aa2495a 100755
--- a/Basics/src/main/resources/Lib/sikuli/SikuliImporter.py
+++ b/Basics/src/main/resources/Lib/sikuli/SikuliImporter.py
@@ -7,7 +7,7 @@ import sys
import Sikuli
from org.sikuli.basics import Debug
-from org.sikuli.script import ImageLocator
+from org.sikuli.script import ImagePath
import os
def _stripPackagePrefix(module_name):
@@ -17,7 +17,7 @@ def _stripPackagePrefix(module_name):
return module_name
def _debug():
- if Debug.getDebugLevel() > 3:
+ if Debug.getDebugLevel() > 2:
return True
else:
return False;
@@ -50,10 +50,12 @@ class SikuliImporter:
def load_module(self, module_name):
if _debug(): print "SikuliLoader.load_module", module_name, self.path
module_name = _stripPackagePrefix(module_name)
- p = ImageLocator.addImagePath(self.path)
- #if _debug(): print "SikuliLoader.load_module: ImageLocator returned path:", p
- if not p: return None
- Sikuli.addModPath(p)
+ if ImagePath.add(self.path):
+ if _debug(): print "SikuliLoader.load_module: ImagePath add:", self.path
+ else:
+ if _debug(): print "SikuliLoader.load_module: ImagePath not added:", self.path
+ return None
+ Sikuli.addModPath(self.path)
return self._load_module(module_name)
def _find_module(self, module_name, fullpath):
@@ -64,7 +66,6 @@ class SikuliImporter:
return None
def find_module(self, module_name, package_path):
- if _debug(): print "SikuliImporter.find_module", module_name, package_path
module_name = _stripPackagePrefix(module_name)
if module_name[0:1] == "*":
return None
@@ -72,6 +73,11 @@ class SikuliImporter:
paths = package_path
else:
paths = sys.path
+ if _debug():
+ print "SikuliImporter.find_module", module_name
+ for e in paths:
+ print e
+ print "SikuliImporter.find_module --- end ---"
for path in paths:
mod = self._find_module(module_name, path)
if mod:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/sikuli.git
More information about the pkg-java-commits
mailing list