← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #688883]: onAppear handler will be called again

 

Question #688883 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/688883

larryli posted a new comment:
for this issue, I have try it  the following modification, it can control observe.
it can fix the issue, I have one propsal, whether it can provide API to set observe name, because, as the code, it can use name to add and remove. just check master branch code, it seems not have.

if it already have, sorry for my less check.

def handler1(event):
     event.stopObserver()
     event.getRegion().getObserver().removeObserver(event.getName())
     print "handler1 is ready"
     global process
     process = false

openApp("application path")
global process
process = True
onAppear("image1", hander1)
observe(FOREVER)

while True:
       wait(2)
      if process == False: break

def handler2(event):
     event.stopObserver()
     event.getRegion().getObserver().removeObserver(event.getName())
     print "handler2is ready"

openApp("app2 path")
onAppear("image2", hander2)
observe(FOREVER)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.