[1.1.1] - Region.observe - onAppear() handler quits when using low lvl mouse commands like mouseDown

Bug #1706334 reported by Benjamin Berg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Opinion
Undecided
RaiMan

Bug Description

My script stops the observation on the following code - see also screenshot provided:

Debug.on(3);
neueRegion = Screen(0);
Settings.OcrTextRead = True;
def testHandler(event):

    neueRegion.mouseMove("1500985545922.png");
    neueRegion.mouseMove(0,40);
    neueRegion.mouseDown(Button.Left);
    event.repeat(1);

neueRegion.onAppear("1500985537208.png", testHandler);
neueRegion.observe(30);

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

The script did not exit the observer (used repeat(1) correctly) when I left out mouseDown or mouseUp commands. Also a wait(3) or similar code stopped the observer....
A simple "neueRegion.click(1500985537208.png)" did NOT cause the observer to stop too early.

I think that is not the behavior it should have when I say ObserveEvent.repeat()

I am using SikuliX 1.1.1 on Windows 7 Professional - Version 6.1.7601 SP 1 Build 7601 - 64 bit

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

Edit: Also a region.doubleClick() stops the observer ...

Tags: fkt-observe
Revision history for this message
Benjamin Berg (neuroticnoob) wrote :
description: updated
summary: - Region.observe - onAppear() handler quits when using low lvl mouse
- commands like mouseDown
+ [1.1.1] - Region.observe - onAppear() handler quits when using low lvl
+ mouse commands like mouseDown
RaiMan (raimund-hocke)
Changed in sikuli:
status: New → Opinion
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.2
Revision history for this message
RaiMan (raimund-hocke) wrote :

I cannot reproduce this behavior:

img1 = "img1.png"
start = time.time()
bl = SCREEN.getBottomRight() # here we can click with no effect

def handler(event):
  print time.time()-start, "in handler";
  mouseMove(bl)
  mouseDown(Button.LEFT)
  mouseUp()
  event.repeat(3)

onAppear(img1, handler)
observe(10)

prints out:
0.304000139236 in handler
4.20000004768 in handler
8.10000014305 in handler

the image is visible all the time

BTW: it is not recommended, to use a mouseDown() without a following mouseUp() - might lead to unexpected results.

Revision history for this message
Benjamin Berg (neuroticnoob) wrote :

Ok thanks for looking into it anyway.
I tried your code, worked for me too, I spent some time to investigate why, and I found my mistake.
I wrote "Button.Left" but it has to be LEFT , if I write Button.Left it says:

[error] script [ Unbenannt ] stopped with error in line 1
[error] AttributeError ( type object 'org.sikuli.script.Button' has no attribute 'Left' )

but since this is inside the handler it seems that no message is provided by SikuliX (not sure if this is an issue or if it is possible to do so.). The error message can just be seen if you do the stuff outside of a handler function.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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