← Back to team overview

sikuli-driver team mailing list archive

[Question #192158]: observe does not seem to wait

 

New question #192158 on Sikuli:
https://answers.launchpad.net/sikuli/+question/192158

I have the following Sikuli event handler defined in a class:

    def _waitForVSStart(self,event):
        print "\nVSStart IMAGE FOUND\n"
        self.vsStart = event.match
        event.match.highlight(10)
        event.region.stopObserver()

Also in this class is the function:

    def start(self, solution=None):
        ...
        if not self.VSApp.open():
            # add logging of failure
            self.Log.error("Unable to start Microsoft Visual Studio")
            self.Log.error("Executable: %s", self.vsEXE)
            return 0
        self.Log.debug("Waiting for screen update")

        # Wait for Visual Studio to be ready
        onAppear(Pattern("VSStartPage.png").similar(0.85), self._waitForVSStart)
        observe(400)
        if self.vsStart == None:
            ...

I then run a script that creates the class object (call it VSIDE) as a member of class test1 and invokes the start method.

This first time through the code, things appear to work correctly, but:
1. the event.match region is never highlighted
2. I never see the print message

The script then does a close on the app, creates an instance of class test2, which also creates an instance of VSIDE, and calls start.

This time through, things don't work correctly (but only apparently on this one machine; same code, different machine, no problems)
1. the observe returns in under a minute (at about the time the VS start pattern appears)
2. event.match == None

Yet, watching the screen, Visual Studio starts up just the same as it did before.

Why does this code, that worked before, and works on another machine, not work correctly now?  I added "background=False" as a precaution to the observe, but no change.

what gives?

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.