[sikuli] 302/385: minor changes with debugging
Gilles Filippini
pini at moszumanska.debian.org
Sun Jun 29 19:26:26 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 4279caa7b329b7455b19036be95c92a07081416c
Author: Raimund Hocke <rmhdevelop at me.com>
Date: Wed Feb 26 19:19:21 2014 +0100
minor changes with debugging
---
API/src/main/java/org/sikuli/script/App.java | 8 ++++----
API/src/main/java/org/sikuli/script/Image.java | 4 ++--
API/src/main/java/org/sikuli/script/Mouse.java | 2 +-
API/src/main/java/org/sikuli/script/Screen.java | 17 ++++++++++++-----
Basics/src/main/java/org/sikuli/basics/Debug.java | 15 +++++++++++++--
5 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/API/src/main/java/org/sikuli/script/App.java b/API/src/main/java/org/sikuli/script/App.java
index 7988caf..bcab5a1 100755
--- a/API/src/main/java/org/sikuli/script/App.java
+++ b/API/src/main/java/org/sikuli/script/App.java
@@ -132,7 +132,7 @@ public class App {
* @return the App instance or null on failure
*/
public App focus(int num) {
- Debug.history("App.focus " + this.toString() + " #" + num);
+ Debug.action("App.focus " + this.toString() + " #" + num);
if (_pid != 0) {
if (_osUtil.switchApp(_pid, num) == 0) {
Debug.error("App.focus failed: " + _appName
@@ -167,13 +167,13 @@ public class App {
if (Settings.isWindows() || Settings.isLinux()) {
int pid = _osUtil.openApp(_appName);
_pid = pid;
- Debug.history("App.open " + this.toString());
+ Debug.action("App.open " + this.toString());
if (pid == 0) {
Debug.error("App.open failed: " + _appName + " not found");
return null;
}
} else {
- Debug.history("App.open " + this.toString());
+ Debug.action("App.open " + this.toString());
if (_osUtil.openApp(_appName) < 0) {
Debug.error("App.open failed: " + _appName + " not found");
return null;
@@ -187,7 +187,7 @@ public class App {
* @return this or null on failure
*/
public int close() {
- Debug.history("App.close " + this.toString());
+ Debug.action("App.close " + this.toString());
if (_pid != 0) {
int ret = _osUtil.closeApp(_pid);
if (ret >= 0) {
diff --git a/API/src/main/java/org/sikuli/script/Image.java b/API/src/main/java/org/sikuli/script/Image.java
index d8f9208..7b2a02d 100644
--- a/API/src/main/java/org/sikuli/script/Image.java
+++ b/API/src/main/java/org/sikuli/script/Image.java
@@ -582,9 +582,9 @@ public class Image {
public BufferedImage get() {
if (bimg != null) {
if (!filepath.equals(isBImg)) {
- log(lvl, "getImage from cache: %s\n%s", imageName, (fileURL == null ? filepath : fileURL));
+ log(lvl + 1, "getImage from cache: %s\n%s", imageName, (fileURL == null ? filepath : fileURL));
} else {
- log(lvl, "getImage inMemory: %s", imageName);
+ log(lvl + 1, "getImage inMemory: %s", imageName);
}
return bimg;
} else {
diff --git a/API/src/main/java/org/sikuli/script/Mouse.java b/API/src/main/java/org/sikuli/script/Mouse.java
index 7d1df26..065e23f 100644
--- a/API/src/main/java/org/sikuli/script/Mouse.java
+++ b/API/src/main/java/org/sikuli/script/Mouse.java
@@ -341,7 +341,7 @@ public class Mouse {
return 0;
}
get().use(region);
- Debug.history(getClickMsg(loc, buttons, modifiers, dblClick));
+ Debug.action(getClickMsg(loc, buttons, modifiers, dblClick));
r.smoothMove(loc);
r.clickStarts();
r.pressModifiers(modifiers);
diff --git a/API/src/main/java/org/sikuli/script/Screen.java b/API/src/main/java/org/sikuli/script/Screen.java
index ae9ee54..c65282b 100755
--- a/API/src/main/java/org/sikuli/script/Screen.java
+++ b/API/src/main/java/org/sikuli/script/Screen.java
@@ -26,6 +26,13 @@ import java.awt.Rectangle;
*/
public class Screen extends Region implements EventObserver, IScreen {
+ private static String me = "Screen";
+ private static int lvl = 3;
+
+ private static void log(int level, String message, Object... args) {
+ Debug.logx(level, "", me + ": " + message, args);
+ }
+
protected static GraphicsEnvironment genv = null;
protected static GraphicsDevice[] gdevs;
protected static Screen[] screens;
@@ -85,12 +92,12 @@ public class Screen extends Region implements EventObserver, IScreen {
}
primaryScreen = 0;
if (!reset) {
- Debug.log(2, "Screen: initScreens: basic initialization (%d Screen(s) found)", gdevs.length);
- Debug.log(3, "*** monitor configuration (primary: %d) ***", primaryScreen);
+ log(lvl - 1, "initScreens: basic initialization (%d Screen(s) found)", gdevs.length);
+ log(lvl, "*** monitor configuration (primary: %d) ***", primaryScreen);
for (int i = 0; i < gdevs.length; i++) {
- Debug.log(3, "Screen %d: %s", i, screens[i].toStringShort());
+ log(lvl, "%d: %s", i, screens[i].toStringShort());
}
- Debug.log(3, "*** end monitor configuration ***");
+ log(lvl, "*** end monitor configuration ***");
}
}
@@ -398,7 +405,7 @@ public class Screen extends Region implements EventObserver, IScreen {
*/
@Override
public ScreenImage capture(Rectangle rect) {
- Debug.log(3, "Screen.capture: (%d,%d) %dx%d", rect.x, rect.y, rect.width, rect.height);
+ log(lvl + 1, "Screen.capture: (%d,%d) %dx%d", rect.x, rect.y, rect.width, rect.height);
ScreenImage simg = robot.captureScreen(rect);
lastScreenImage = simg;
return simg;
diff --git a/Basics/src/main/java/org/sikuli/basics/Debug.java b/Basics/src/main/java/org/sikuli/basics/Debug.java
index 75cfb12..4b831dd 100644
--- a/Basics/src/main/java/org/sikuli/basics/Debug.java
+++ b/Basics/src/main/java/org/sikuli/basics/Debug.java
@@ -183,12 +183,23 @@ public class Debug {
* @param message (String or format string)
* @param args to use with format string
*/
- public static void history(String message, Object... args) {
+ public static void action(String message, Object... args) {
if (Settings.ActionLogs) {
log(-1, "log", message, args);
}
}
-
+
+ /**
+ * use Debug.action() instead
+ * @param message
+ * @param args
+ * @deprecated
+ */
+ @Deprecated
+ public static void history(String message, Object... args) {
+ action(message, args);
+ }
+
/**
* informative Sikuli messages <br> switch on/off: Settings.InfoLogs
*
--
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