Make Region.click() arguments optional

Bug #795498 reported by anatoly techtonik
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
Critical
RaiMan

Bug Description

Region.click() should click at its center. It will make code more clean (and perhaps faster), e.g. from:

for f in findAll(findobjs):
  area = Region(f.nearby(100))
  f.click(area)

to:

for f in findAll(findobjs):
  area = Region(f.nearby(100))
  area.click()

Tags: fkt-click
Revision history for this message
RaiMan (raimund-hocke) wrote :

But this means some exception to the general API concept, which means with a Region.click(PSMRL) to restrict the find operation with PS to the given Region.
When using click(MRL) it is not necessary to specify a Region, since the argument denotes an absolute click point.

so the above example could be written:

for f in findAll(findobjs):
  area = Region(f.nearby(100))
  click(area)

So with your approach you have to write an additional dot ;-)
And this does not have any impact on performance.

But if it is accepted by the developers, I would like to generalize this request:

a click() (no arguments given) should click:

Match.click() --- the defined target clickpoint
Region.click() --- the center
click() --- center of SCREEN
Location.click() --- the given point

same goes for rightClick(), doubleClick().

Revision history for this message
Tsung-Hsiang Chang (vgod) wrote :

I incline to support only one way to specify the target of an action, i.e. click(target).
A problem with click() is that it's unreadable and hard to understand what happens if someone just write click() without a region. and arguments.
(It doesn't make sense if click() does click at the center of SCREEN. It may make sense if it clicks at the current location of the cursor, but it would be inconsistent with region.click().)

Revision history for this message
RaiMan (raimund-hocke) wrote :

I fully agree with Sean.
So lets set it "won't fix"

Revision history for this message
RaiMan (raimund-hocke) wrote :

in X-1.0

click()

will click the last match of the region if any, otherwise it will click the center (or targetOffset if region is a Match)

Changed in sikuli:
status: New → Won't Fix
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → x1.0
status: Won't Fix → Fix Committed
RaiMan (raimund-hocke)
tags: added: fkt-click
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Undecided → Critical
RaiMan (raimund-hocke)
Changed in sikuli:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.