Skip to content

Commit

Permalink
Add some delay after setting IDE to invisible to give it some time to…
Browse files Browse the repository at this point in the history
… vanish.

(cherry picked from commit f9b6a2a)
  • Loading branch information
balmma authored and RaiMan committed Nov 18, 2019
1 parent a52000b commit be7f1c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions IDE/src/main/java/org/sikuli/ide/ButtonCapture.java
Expand Up @@ -86,10 +86,17 @@ public void captureWithAutoDelay() {
IScreen defaultScreen = null;
ScreenImage sImgNonLocal = null;

public void capture(final int delay) {
public void capture(int delay) {
String line = "";
SikulixIDE ide = SikulixIDE.get();
ide.setVisible(false);
if (ide.isVisible()) {
// Set minimum delay if IDE is visible to give
// the IDE some time to vanish before taking the
// screenshot. IDE might already be hidden in
// in case of capture hot key.
delay = Math.max(delay, 500);
ide.setVisible(false);
}
EditorPane codePane = ide.getCurrentCodePane();
line = codePane.getLineTextAtCaret();
givenName = codePane.parseLineText("#" + line.trim());
Expand Down
2 changes: 2 additions & 0 deletions IDE/src/main/java/org/sikuli/ide/EditorRegionButton.java
Expand Up @@ -9,6 +9,7 @@
import javax.swing.*;
import org.sikuli.util.OverlayCapturePrompt;
import org.sikuli.script.support.IScreen;
import org.sikuli.script.support.RunTime;
import org.sikuli.script.Region;
import org.sikuli.script.ScreenImage;
import org.sikuli.basics.Debug;
Expand Down Expand Up @@ -38,6 +39,7 @@ public EditorRegionButton(EditorPane pane, int x, int y, int w, int h) {
public void actionPerformed(ActionEvent ae) {
SikulixIDE ide = SikulixIDE.get();
ide.setVisible(false);
RunTime.pause(0.5f);
Screen.doPrompt(SikulixIDE._I("msgCapturePrompt"), this);
}

Expand Down

0 comments on commit be7f1c1

Please sign in to comment.