← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #270538]: Is there a way to remove the sikuli import feature in the nightly build?

 

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

RaiMan proposed the following answer:
ok, I think I have a solution for use cases like yours:

I have added an init method to the Java level:

public void init(Region r) {
    if (!r.isValid()) {
      return;
    }
    x = r.x;
    y = r.y;
    w = r.w;
    h = r.h;
    scr = r.getScreen();
    otherScreen =r.isOtherScreen();
    rows = 0;
    autoWaitTimeout = r.autoWaitTimeout;
    findFailedResponse = r.findFailedResponse;
    throwException = r.throwException;
    waitScanRate = r.waitScanRate;
    observeScanRate = r.observeScanRate;
    repeatWaitTime = r.repeatWaitTime;
}

- it does nothing if the Region object is not valid (has no screen or width or height is 0) (in the consequence, the Region is not valid and might produce errors/exceptions).
- with a valid Region object it copies the basic attributes from the given Region object

so in your case you have to say:

class BaseClass(Region):
    def __init__(self, region, name):
        self.init(region) 

reg = sikuli.Region(sikuli.screen())
baseClass = BaseClass(reg)

so you only in your BaseClass you have to replace the super().__init__()
call with the call  of init()

This works with tomorrows build.
I appreciate much, if you thoroughly test it.

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