APISonar


org.sikuli.basics.Debug.log

> org > sikuli > basics > Debug > log
org APIs sikuli APIs basics APIs Debug APIs log APIs

Example 1
public void actionPerformed(ActionEvent e) {
    Debug.log(3, "ButtonCapture: capture!");
    captureWithAutoDelay();
  }
Example 2
public void read(Reader in, Document doc, int pos)
					throws IOException, BadLocationException {
		Debug.log(3, "SikuliEditorKit.read");
		super.read(in, doc, pos);
	}
Example 3
public ButtonView(Element elem) {
    super(elem);
    Debug.log(6,"ViewCreate: Button");
  }
Example 4
private void logRobot(String msg, int maxElapsed) {
    long elapsed = new Date().getTime() - start;
    if (elapsed > maxElapsed) {
      Debug.log(0, msg, elapsed);
      setAutoDelay(stdAutoDelay);
      setAutoWaitForIdle(false);
    }
  }
Example 5
private void logRobot(int delay, String msg) {
    start = new Date().getTime();
    int theDelay = getAutoDelay();
    if (theDelay > 0 && theDelay > delay) {
      Debug.log(0, msg, isAutoWaitForIdle(), theDelay);
    }
  }
Example 6
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
         str = str.replaceAll("\t", "  ");
         super.insertString(offs, str, a);
         Debug.log(5, "insertString: " + str);
      }
Example 7
private static void logCommandSysout(String commandstring, ByteArrayOutputStream outputStream) {
    //try to create some useful error output
    if (outputStream.size() > 0) {
      Debug.log(4, "command '" + commandstring + "' output:\n" + outputStream.toString());
    }
  }
Example 8
public boolean setTargetOffset(Location offset) {
		Debug.log(3, "ThumbButtonLabel: setTargetOffset: " + offset.toStringShort());
		if (!_offset.equals(offset)) {
			_offset = offset;
      setButtonText();
			return true;
		}
		return false;
	}
Example 9
public void mousePressed(MouseEvent me) {
		Location tar = convertViewToScreen(me.getPoint());
		Debug.log(4, "click: " + me.getPoint() + " -> " + tar.toStringShort());
		if (_match != null) {
			Location center = _match.getCenter();
			setTarget(tar.x - center.x, tar.y - center.y);
		} else {
			setTarget(tar.x, tar.y);
		}
	}
Example 10
private void txtHotkeyKeyPressed(KeyEvent e) {
    int code = e.getKeyCode();
    int mod = e.getModifiers();
    Debug.log(2, "HotKey: " + code + " " + mod);
    setTxtHotkey(code, mod);
    _txtHotkey.setEditable(false);
  }
Example 11
public void showTarget(Location loc, float secs) {
    final int w = TARGET_SIZE, h = TARGET_SIZE;
    int x = loc.x - w / 2, y = loc.y - w / 2;
    _lastTarget = loc;
    Debug.log(2, "showTarget " + x + " " + y + " " + w + " " + h);
    showWindow(x, y, w, h, secs);
  }
Example 12
public List<Match> findAnyList(List<Object> pList) {
    Debug.log(lvl, "findAny: enter");
    if (pList == null || pList.size() == 0) {
      return new ArrayList<Match>();
    }
    List<Match> mList = findAnyCollect(pList);
    return mList;
  }
Example 13
public Region selectRegion(final String message) {
    Debug.log(3, "TRACE: Screen: selectRegion");
    ScreenImage sim = userCapture(message);
    if (sim == null) {
      return null;
    }
    Rectangle r = sim.getROI();
    return Region.create((int) r.getX(), (int) r.getY(),
            (int) r.getWidth(), (int) r.getHeight());
  }
Example 14
private void init(Region region) {
    if (region != null) {
      targetRegion = region;
    } else {
      Debug.log(2, "SikuliGuideRectangle: targetRegion is given as null");
      targetRegion = Region.create(0, 0, 2*stroke, 2*stroke);
    }
    setColor(Color.RED);
  }
Example 15
public void actionPerformed(ActionEvent e) {
		Debug.log(3, "ThumbButtonLabel: open Pattern Settings");
		_pane.saveCaretPosition();
		if (pwin == null) {
			_offsetSaved = new Location(_offset);
			_similaritySaved = _similarity;
      _exactSaved = _similarity >= 0.99f;
			_imgFilenameSaved = _imgFilename.substring(0);
			pwin = new PatternWindow(this, _exactSaved, _similarity, _numMatches);
			pwin.setTargetOffset(_offset);
		}
		pwin.requestFocus();
	}
Example 16
public boolean removeHotkey(String givenKey) {
    if (Keys.isNotNull(hotkeyProvider) && !hotkeys.isEmpty()) {
      hotkeyProvider.reset();
      hotkeys.remove(givenKey.trim());
      Debug.log(3,"removeHotkey: %s", givenKey);
      if (!hotkeys.isEmpty()) {
        for (String keys : hotkeys.keySet()) {
          Debug.log(3,"installHotkey again: %s", keys);
          HotKeyListenerWrapper callback = hotkeys.get(keys);
          hotkeyProvider.register(KeyStroke.getKeyStroke(keys), callback);
        }
      }
    }
    return true;
  }
Example 17
public void typeChar(char character, KeyMode mode) {
    Debug.log(4, "Robot: doType: %s ( %d )",
            KeyEvent.getKeyText(Key.toJavaKeyCode(character)[0]).toString(),
            Key.toJavaKeyCode(character)[0]);
    doType(mode, Key.toJavaKeyCode(character));
  }
Example 18
public ScreenImage captureScreen(Rectangle screenRect) {
    Debug.log(3, "FakeRobot: captureScreen: should not be used: returning null");
    return null;
  }
Example 19
public Visual image(Object img) {
    Visual gc = null;
    if (img instanceof String) {
      gc = new SxImage((String) img);
    } else if (img instanceof BufferedImage) {
      gc = new SxImage((BufferedImage) img);
    }
    if (gc != null) {
      gc.setGuide(this);
      addToFront(gc);
    } else {
      Debug.log(2, "Guide.image: invalid argument");
    }
    return gc;
  }
Example 20
public String getFilename() {
		File img = new File(_imgFilename);
		String oldBundle = img.getParent();
		String newBundle = _pane.getSrcBundle();
		Debug.log(4, "ImageButton.getFilename: old: " + oldBundle + "\nnew: " + newBundle);
		if (FileManager.pathEquals(newBundle, oldBundle)) {
			return _imgFilename;
		}
		setFilename(new File(newBundle, img.getName()).getAbsolutePath());
		return _imgFilename;
	}
Example 21
public ScreenImage captureScreen(Rectangle rect) {
//    Rectangle s = scr.getBounds();
    Rectangle cRect = new Rectangle(rect);
//    cRect.translate(-s.x, -s.y);
    BufferedImage img = createScreenCapture(rect);
    Debug.log(4, "RobotDesktop: captureScreen: [%d,%d, %dx%d]",
            rect.x, rect.y, rect.width, rect.height);
    return new ScreenImage(rect, img);
  }
Example 22
public void keyDown(String keys) {
    if (keys != null && !"".equals(keys)) {
      for (int i = 0; i < keys.length(); i++) {
        if (heldKeys.indexOf(keys.charAt(i)) == -1) {
          Debug.log(4, "press: " + keys.charAt(i));
          typeChar(keys.charAt(i), IRobot.KeyMode.PRESS_ONLY);
          heldKeys += keys.charAt(i);
        }
      }
    }
  }
Example 23
public String addHotkey(HotkeyCallback callback, String... hotkeys) {
    initProvider();
    String finalKey = installHotkey(callback, hotkeys);
    if (Keys.isNotSet(finalKey)) {
      String hotkey = "";
      for (String key : hotkeys) {
        hotkey += key + " ";
      }
      Debug.log(-1,"HotkeyController: addHotkey: invalid arguments: %s %s", hotkey,
              (Keys.isNull(callback) ? "(no callback)" : ""));
    }
    return finalKey;
  }
Example 24
public void addObserver(EventObserver obs) {
    Debug.log(3, "TRACE: OverlayCapturePrompt: addObserver: %s", obs != null);
    captureObserver = obs;
  }
Example 25
protected static void wheel(int direction, int steps, Region region, int stepDelay) {
    if (get().device.isSuspended()) {
      return;
    }
    IRobot r = Screen.getRobot(region);
    get().device.use(region);
    Debug.log(3, "Region: wheel: %s steps: %d",
            (direction == WHEEL_UP ? "WHEEL_UP" : "WHEEL_DOWN"), steps);
    for (int i = 0; i < steps; i++) {
      r.mouseWheel(direction);
      r.delay(stepDelay);
    }
    get().device.let(region);
  }