Region.type() conflict with builtin type() function --- workaround

Bug #794880 reported by anatoly techtonik
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
SikuliX
New
Undecided
Unassigned

Bug Description

*** workaround

the builtin type function can be called using __builtin__.type().
(You would also need to import __builtin__)

... and you could use isinstance()

----------------------------------------------------------------

I've just realized that Region.type() is imported in global scope and shadows builtin type() function, which makes debugging harder.

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

Yes, that is really an API design mistake.

I would suggest to deprecate type() and implement a new typing feature that eliminates the keyboard layout and special character problems of type().

Revision history for this message
anatoly techtonik (techtonik) wrote :

Region.input() ?

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

nice try ;-)

already in use as input dialog feature :-(

what about keyStroke() or keyPress() or typeKeys() .....

Revision history for this message
anatoly techtonik (techtonik) wrote :

Something with 'key' in its name assumes that the argument is some key identifier, something like scan code that is obviously different from text or char. Perhaps it is better to decide on the arguments first. It may happen that the action will be called enterText() or keySequence() depending on the arguments.

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

good idea --- fully agreed.

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

btw, the builtin type function can be called using __builtin__.type().
(You would also need to import __builtin__)

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

thanks for the reminder ;-)

I had some "feeling", that you mentioned a workaround already.

I only took the chance to talk about the need to revise and develop the type/paste stuff as such ;-)

summary: - Region.type() conflict with builtin type() function
+ Region.type() conflict with builtin type() function --- workaround
description: updated
Revision history for this message
anatoly techtonik (techtonik) wrote :

I used another workaround for type check - through isinstance()

Revision history for this message
anatoly techtonik (techtonik) wrote :

BTW, the "paste" stuff seems a lot like a solution.

paste("text') - creates some kind of buffer with 'text' inside and then pastes it into control.

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

paste simply simulates a ctrl-v internally. the buffer is the clipboard, which gets corrupted this way.
 ... and after the first time you use paste(), Env.getClipboard no longer works.

so, still some things to improve ;-)

description: updated
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.