X-1.0rc3: Windows: highlight() hides some kind of tooltip like visual objects

Bug #874033 reported by xianming01
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SikuliX
In Progress
Medium
RaiMan

Bug Description

*** problem
- first reported on japanese Windows XP (see below)
- confirmed on Windows 7 with this test script:

hover("some-image.png"); wait(2) # inits a tooltip
getLastMatch().highlight(2) # tooltip hidden
setROI(300,300,100,100)
wait(2) # tooltip visible again
highlight()
wait(2) # tooltip hidden
highlight()
wait(2) # tooltip visible again
setROI(Screen(0))

---------------------------------------------

If you use a ime, when you input some letters, there will be a condidate window for you to select target.
In X1.0-rc3, if I use highlight() to the condidate window, the window disappear. But when you use X1.0-rc2, if you highlight the condidate window, the window is also there.
I guess it is because the highlight() seize the focus of window.

Revision history for this message
RaiMan (raimund-hocke) wrote :

- Windows, Mac or Linux?

- not really clear, what you mean. Pls. tell step by step, what you are doing.

Revision history for this message
xianming01 (xuxianming01) wrote :

OS:windows xp
software:notepad, baidu ime(http://ime.baidu.jp/)

Steps:
1. Open a notepad window.
2. use baidu ime to input.
3. if you choose hiragana input mode, if you input "kawai" and press space, there will be a candidate list window appear.
(if you choose a word in the candidate list window and press enter key, the word will be on screen and the candidate list window disappear. If the focuse is not in the candidate list window, the selected word will be on screen and the candidate list window disappear two.)
5. When you use Sikuli X 1.0rc2 to highlight the candidate list window(you use highlight fuction to the window), the window will stay there after you use highlight function.
6. where you use Sikuli X 1.0rc3 to highlight the candidate list window, the word will on screen and the candidate list window disappear.

I guess is the highlight fuction seice the focus of the candidate window.

Revision history for this message
xianming01 (xuxianming01) wrote :

For the comment before.If you choose hiragana input mode, if you input something, there is a candidate word list window.

and for the steps in the comment befor, the picture show the different results in rc2 and rc3.

Revision history for this message
RaiMan (raimund-hocke) wrote :

Ok, well documented - understood.

Could you pls. post the Sikuli code snippet you are using to get the candidate window on the screen and then highlight it.

summary: - highlight() seize the focus of window
+ X-1.0rc3: Windows (japanese): highlight() seize the focus of window
Revision history for this message
xianming01 (xuxianming01) wrote : Re: X-1.0rc3: Windows (japanese): highlight() seize the focus of window

The code :
def checkDisplay(self, input="kyouhatennkigaiikara,sannposimasyou.", mode=None,
                     suggestion_img=None, candidate_img=None,
                     suggestion_region=None, candidate_region=None,
                     need_open=False, need_close=False,
                     run=True, need_switch=True, getFocusFunc=None,
                     ):
        """common function for dispaly check"""
        self.clearInput() #use ctrl+a and ctrl+x to clear input
        caret = ime.getTextPos() #get the position of the cursor
        type(input) #type input
        try:
            candwin_reg = ime.getCandWinRegion() #get the candidate list window's postion and size
        except:
            self.writeLog("FAIL to getCandWinRegion for mode %s after type `%s' " % (mode,input))
            #return 0
            assert False
        if mode: //if set to hiragana input mode
        # setROI(caret[0]-30, caret[1], 400, 100)
            setROI( suggestion_region.offset( Location(caret[0], caret[1])) )
            highlight()
            self.printScreen("%s suggestion h" % mode)
            highlight()
            dx = candwin_reg.x - caret[0]; dy = candwin_reg.y - caret[1]; w = candwin_reg.w; h = candwin_reg.h;

            …………the other code Omitted…………

the function checkDisplay runs well in rc2, but there is something wrong in rc3(for details, please look at the picture:problem.jpg).
If you don't use highlight() function in the code above in rc3, checkDisplay runs well too.

RaiMan (raimund-hocke)
summary: - X-1.0rc3: Windows (japanese): highlight() seize the focus of window
+ X-1.0rc3: Windows: highlight() hides some kind of tooltip like visual
+ objects
Changed in sikuli:
status: New → Confirmed
RaiMan (raimund-hocke)
description: updated
description: updated
Revision history for this message
RaiMan (raimund-hocke) wrote :

@xianming

Maybe this is clear for you, but might not be for others:

You use setROI() in a function to define the region, that should be highlighted. This works, but has the side effect, that from now on ALL subsequent unqualified (searching the primary screen) find operations will be restricted to the screen region set by setROI(). So this is ok, if you know what you are doing: work only in the restricted area or reset ROI to other settings later on (e.g. setROI(SCREEN).

So because of this side effect, setROI() is not recommended to be used only for defining the region on the screen to be highlighted.
use instead:
reg = Region(<same settings as with setROI()>)
reg.highlight()

description: updated
Revision history for this message
RaiMan (raimund-hocke) wrote :

CORRECTION: ( setROI(SCREEN) obviously does not work ;-).

So this is ok, if you know what you are doing: work only in the restricted area or reset ROI to other settings later on (e.g. setROI(Screen(0)).

description: updated
Revision history for this message
xianming01 (xuxianming01) wrote :

@RaiMan

Thank you for your advice. I really appreciate you for responding so quickly.

RaiMan (raimund-hocke)
Changed in sikuli:
status: Confirmed → In Progress
assignee: nobody → RaiMan (raimund-hocke)
RaiMan (raimund-hocke)
tags: added: fkt-highlight
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.