← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #225697]: Sikuli wrapper

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
I guess, since you selectively overwrite some methods and find() returns
a Match object, that internally inherits from org.sikuli.script.Region
(and not from your overwriting class defined on the Python level), you
have to cast Match objects to Region objects on the Python level:

in your wrapper the return statements with find and exists:

    def find(self, target):
        try:
            return Region(SikuliRegion.find(self, target))
        except FindFailed, e:
            self.log.html_img("Find Failed", common.cfgImageLibrary + '/' + getFilename(target))
            self.log.screenshot(msg="Region", region=(self.getX(), self.getY(), self.getW(), self.getH()))
            raise e

    def exists(self, target, timeout=1):
        img = getFilename(target)
        reg = (self.getX(), self.getY(), self.getW(), self.getH())
        addFoundImage(img, reg)
        return Region(SikuliRegion.exists(self, target, timeout))

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