Comment 4 for bug 518011

RaiMan (raimund-hocke) wrote :

looks good and really straightforward.

what I miss:

- Subregion should accept Match and capture() as input for construction e.g. s = Subregion(Match), s = Subregion(capture())

- as a convenience Subregion should have setX() .... (now: sub = sub(sub.getX()+z, sub.getY(), ...) then: sub.setX(sub.getX()+z)

- it should be possible to click a Subregion (= calculated click point)

- spatial operators with Subregion (not written down)

- that find() AND findAll() (and all the action functions) work with these spatial ops: match/subregion.inside().find()/findAll() e.g. (in the moment Subregion(x, y, w, h).inside().findAll() gives attribute error on findAll (find works))

- all objects that have a pos/dim should understand getX(), getY(), getW(), getH(), getRect() (not really clear, with Subregion now it is Subregion.x, ....)

- as a convenience all functions, that accept a Pattern as first parm (except dragDrop: possible to use it for the drag if given, use it for both wouldn't make sense normally) should accept the same methods as Pattern does: e.g. find(img).similar(1).firstN(1) should be possible. If not an image (= string) they should be silently ignored or may be a warning when run inside IDE.

additional comments:

hoverAll doesn't make sense without an additional timing parm

clickAll/repeatClickAll: whats really the difference? if I now (new API) would say: clickAll(Matches) every contained match would be clicked, I understand. Whats then the add on of repeatClickAll? In the new API I would expect a repeatWhatever to do the following: the first time, it is called it sets up itself by using findAll and makes action on the first Match and returns some ID. then if you call it again by saying repeatWhatever(ID) it acts on the next Match and so on. If no more Match is there it returns None.

dragDropAll should accept (single, multiple) what means, that single is dropped to every of multiple. if given (Matches, Matches) you have a problem, since they are not sorted in a way a user would expect (e.g. based on pos from top left to bottom right). How to match drag position an drop position? So I think, in the current implementation, where there its not possible to define the order within Matches (e.g. by saying Matches.topLeftBottomRight() or Matches.topBottomLeftRight()) dragDropAll only makes sense as
dragDropAll( Pattern/String/Match, Matches )

it should read:
sleep( seconds ) #deprecated - use wait( seconds ) instead

untilNotExist ---> waitVanish

PathToAnImage? capture( [Subregion/Match/Matches] ), capture( x, y, w, h ) should read
String capture( [Subregion/Match/Matches] ), capture( x, y, w, h ) # returns path to image

find.region and find.regions should be mentioned together with: after all actions, where a find/findAll is executed implicitly (e.g. click actions) find.region and find.regions are defined and filled accordingly