Jython: How to get rid of the highlight box? (running in Netbeans)

Asked by Beth Griffin

*** a "quick and dirty" workaround:

click on the highlights and they vanish ;-)

from comment #8 (https://launchpad.net/~beth-griffin)
-----------------------------------------------------------------------

Novice error: While debugging code, I used the Region.highlight() function to show me where I was searching for a text string. I forgot to turn off the highlight before exiting the program, and now I have this rectangle drawn on my Windows desktop that I don't know how to remove (besides log out, log in?).

Is there any other way to clean this up?

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

--- you say: While debugging code
Did you do that in Sikuli IDE?

The highlight() boxes are removed during exit processing of a script. I made a test and it works.

So it might be a problem of rc2, if this does not happen for you
(I am already using rc3 pre-version.
look: http://sikuli.org/hudson/
download: http://sikuli.org/hudson/job/Sikuli-IDE-Windows/lastSuccessfulBuild/artifact/sikuli-ide/build/Sikuli-r772-win32.zip)

Revision history for this message
Beth Griffin (beth-griffin) said :
#2

raiman,

I was using the Netbeans IDE. The same thing happens in Netbeans if the script fails between the highlight enable and disable. I won't be able to try the next release until after the 24th of this month (travel, etc.)

Thanks

Revision history for this message
RaiMan (raimund-hocke) said :
#3

Ok, using the Python plugin and running on the Netbeans bundled Jython2.5.1 ???

... or using plain Java???

Revision history for this message
Beth Griffin (beth-griffin) said :
#4

Neatbeans bundled Jython2.5.1

Revision history for this message
Best RaiMan (raimund-hocke) said :
#5

You can purge all visible highlight()'s at any time using:
ScreenHighlighter.closeAll()

Place it before any script exit and you are safe for this.

For exceptions, that stop the script, the only chance is to wrap the whole script in a generic try: block and put
ScreenHighlighter.closeAll() into the except: branch.

Revision history for this message
Beth Griffin (beth-griffin) said :
#6

Thanks RaiMan, that solved my question.

Revision history for this message
RaiMan (raimund-hocke) said :
#7

I just remembered, that I read about "finalization" in Python/Jython scripts:

http://www.jython.org/docs/library/atexit.html

Revision history for this message
Beth Griffin (beth-griffin) said :
#8

Just an FYI: turns out if you click on the highlight line, it goes away.