sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #08934
Re: [Question #188555]: OpenCV Error on starting event observer
Question #188555 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/188555
Status: Needs information => Open
Terence Cooper gave more information on the question:
The openCV error message appears with the 2nd call to mapSubMenu. Also
the changed area found in the 1st call to mapSubMenu is highlighted
again when the 2nd call is made, ie. targetChanged is returning the same
match for different changes in the observed region. When I run this, I
first see the TxDev menu area highlighted, then the pointer moves to
click on the *Search* menu, and then just as it begins to move again the
the stack is dumped.
Plz don't hesitate to let me know if you need more info. Thx in
advance. Terry.
static void mapSubMenu(String mainMenuLabel, String[] subMenuLabels)
throws FindFailed, InterruptedException {
monitoredR = subMenusR;
changedM = null;
getChangedAreaMatch();
// click the menu...
mainMenu.click(mainMenuLabel);
//mainThread.wait();
Thread.currentThread().sleep(2000);
Region menuR = changedM;
menuR.highlight(1);
try{
double ms = Settings.MinSimilarity;
Settings.MinSimilarity = .4;
for(String menuLabel: subMenuLabels){
menuR.highlight(1);
Match menuItemM = menuR.wait(menuLabel, 30);
menuR.h = menuR.h+menuR.y - (menuItemM.y+menuItemM.h);
menuR.y = menuItemM.y + menuItemM.h;
menuItemM.highlight(1);
MenuItem subMenuItem = new MenuItem(menuLabel, "");
subMenuItem.setMatch(menuItemM);
subMenuItem.setParent(mainMenu);
subMenuItem.setHighlighted(false);
subMenuItem.setOnDisplay(false);
mainMenu.getChild(mainMenuLabel).addChild(menuLabel, subMenuItem);
}
Settings.MinSimilarity = ms;
}
catch(FindFailed findFailedExcptn){
scrpt.popup("Failed to map "+mainMenuLabel+" menu\n - "+findFailedExcptn.getMessage());
exit(0);
}
mainMenu.click(mainMenuLabel); // close menu
}
static void getChangedAreaMatch()
throws FindFailed{
monitoredR.onChange(50, new SikuliEventObserver(){
public void targetChanged(ChangeEvent evnt) {
System.out.println("targetChanged called");
for (Match m : evnt.changes) {
changedM = m;
m.highlight(1);
break;
}
System.out.println("stopping observer");
evnt.region.stopObserver();
System.out.println("stopped observer");
//monitoredR.stopObserver(); // which one?
}
public void targetAppeared(AppearEvent e) {
scrpt.popup("targetAppeared called");
}
public void targetVanished(VanishEvent e) {
scrpt.popup("targetVanished called");
}
});
// start the observation...
monitoredR.observeInBackground(30);
}
public static void main(String[] args)
throws InterruptedException,
java.awt.AWTException,
org.sikuli.script.FindFailed{
scrpt = new SikuliScript();
scrn = new Screen();
BLAH, BLAH, BLAH
mapMainMenu();
// (doesn't use the observer and onChange event handler)
mapSubMenu("TXDev" ,txDevMenuLabels);
mapSubMenu("Search", searchMenuLabels);
BLAH, BLAH, BLAH
}
}
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.