sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #14147
[Bug 905435] Re: X-1.0rc3: Region.onChange(handler, Integer) should give an error, instead of silently ignoring the Integer
** Changed in: sikuli
Status: New => Fix Committed
** Changed in: sikuli
Assignee: (unassigned) => RaiMan (raimund-hocke)
** Changed in: sikuli
Milestone: None => x1.0
--
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/905435
Title:
X-1.0rc3: Region.onChange(handler, Integer) should give an error,
instead of silently ignoring the Integer
Status in Sikuli:
Fix Committed
Bug description:
***** problem
using onChange(handler, integer) seems to work, but it is a wrong
usage according to the API docs. In fact the second parameter is
simply ignored in this case.
This usage should give an error.
---------------------------------------
The other observations here are due to the fact, that in some cases, a
Match object does not work like a Region, which is a known problem.
*** workaround
cast the Match to a Region:
matchRegion = Region(some_match)
------------------------------------------
Problem: The Match.onChange() method does not reflect the same
behavior as Region.onChange()
--
from sikuli.Sikuli import Match
def test(event):
print event
region = Match(100,100,200,200, 2.5)
region.onChange(test, 50)
region.observe()
####
Traceback (most recent call last):
File "C:\work\killpy\test.py", line 7, in <module>
region.onChange(test, 50)
TypeError: onChange(): 1st arg can't be coerced to int
---
Swapping, onChange arguments as follows:
region.onChange(50, test)
####
Traceback (most recent call last):
File "C:\work\killpy\test.py", line 7, in <module>
region.onChange(50, test)
TypeError: onChange(): 2nd arg can't be coerced to org.sikuli.script.SikuliEventObserver
--
However, the following code does work:
--
from sikuli.Sikuli import Region
def test(event):
print event
region = Region(100,100,200,200)
region.onChange(test, 50)
region.observe()
####
ChangeEvent on Region[100,100 200x200]@Screen(0) E:Y, T:3.0 | 1 changes
ChangeEvent on Region[100,100 200x200]@Screen(0) E:Y, T:3.0 | 1 changes
---
However this does not reflect the documentation which states the
minChangedSize as the 1st argument and the handler as the 2nd
argument. In reality it is flipped around.
http://sikuli.org/docx/region.html?highlight=onchange#Region.onChange
To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/905435/+subscriptions
References