# According to http://sikuli.org/docx/region.html#grouping-method-calls-with-region
# "All methods inside the with block that have the region omitted are redirected to the region object specified at the with statement."
# Based on this statement, I would expect the following code to only highlight the bottom three icons.
# Tested on both 64 bit Windows 7 and OSX Lion with identical results.
# Version: Sikuli X 1.0rc2 "Maltese" Released on 2011/02/10
# Expected results:
# * The script should highlight the test image, the bottom half of the test image, and the bottom three icons in the test image.
# Actual results:
# * All 6 icons are highlighted.
# Steps to reproduce:
# 1. Close all running copies of the Sikuli IDE.
# 2. Open TestImage.png in an image viewer at 1:1 zoom level. (Possibly by viewing the .html file)
# 3. Open the Sikuli IDE and load this script.
# 4. Run the script. During the first run you will see the expected behavior. It will only highlight the bottom three icons.
# 5. Run the script again. This time and any time after, it will highlight all 6 icons. This is not the expected behavior.
# According to http:// sikuli. org/docx/ region. html#grouping- method- calls-with- region
# "All methods inside the with block that have the region omitted are redirected to the region object specified at the with statement."
# Based on this statement, I would expect the following code to only highlight the bottom three icons.
# Tested on both 64 bit Windows 7 and OSX Lion with identical results.
# Version: Sikuli X 1.0rc2 "Maltese" Released on 2011/02/10
# Expected results:
# * The script should highlight the test image, the bottom half of the test image, and the bottom three icons in the test image.
# Actual results:
# * All 6 icons are highlighted.
# Steps to reproduce:
# 1. Close all running copies of the Sikuli IDE.
# 2. Open TestImage.png in an image viewer at 1:1 zoom level. (Possibly by viewing the .html file)
# 3. Open the Sikuli IDE and load this script.
# 4. Run the script. During the first run you will see the expected behavior. It will only highlight the bottom three icons.
# 5. Run the script again. This time and any time after, it will highlight all 6 icons. This is not the expected behavior.
testimage = find() highlight( 1)
testimage.
bottomhalf = Region(testimage) setY(bottomhalf .getCenter( ).y) setH(bottomhalf .getH() /2) highlight( 1)
bottomhalf.
bottomhalf.
bottomhalf.
with bottomhalf:
sorted_ icons = sorted(icons, key=lambda m:m.y)
icon. highlight( 1)
icons = findAll()
for icon in sorted_icons: