Public bug reported:

Currently the click() method accepts key modifiers as optional arguments. We 
have created a wrapper function on the click to ensure a little extra stability 
with the click method and have it available across all scripts.
ex:

def myClickFun(region, image, modifier=None):
    # Do some things for stability
    region.click(image, modifier)

We ran into an issue when we needed to introduce the key modifier
argument. If we provide the modifier it works as expected, however this
breaks all other instances where no modifier is provided giving the
following error:

TypeError: click(): 2nd arg can't be coerced to int

I was expecting the None to be ignored since that is usually the default
behavior of an optional argument. Then I remembered that you can supply
an integer with the click() method (A quick test revealed that no
integer and a value of 60 timed out at about the same time). It seems
that the click method could accept keyword arguments (and ignore none as
a modifier) to allow for greater flexibility in the method call. Maybe
just a single keyword for the modifier in case an integer is not
supplied?

I realize the great chance that I'm doing something wrong here... if so
please let me know.

** Affects: sikuli
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1450805

Title:
  Allow click() to accept and ignore 'None' as a modifier

Status in Sikuli:
  New

Bug description:
  Currently the click() method accepts key modifiers as optional arguments. We 
have created a wrapper function on the click to ensure a little extra stability 
with the click method and have it available across all scripts.
  ex:

  def myClickFun(region, image, modifier=None):
      # Do some things for stability
      region.click(image, modifier)

  We ran into an issue when we needed to introduce the key modifier
  argument. If we provide the modifier it works as expected, however
  this breaks all other instances where no modifier is provided giving
  the following error:

  TypeError: click(): 2nd arg can't be coerced to int

  I was expecting the None to be ignored since that is usually the
  default behavior of an optional argument. Then I remembered that you
  can supply an integer with the click() method (A quick test revealed
  that no integer and a value of 60 timed out at about the same time).
  It seems that the click method could accept keyword arguments (and
  ignore none as a modifier) to allow for greater flexibility in the
  method call. Maybe just a single keyword for the modifier in case an
  integer is not supplied?

  I realize the great chance that I'm doing something wrong here... if
  so please let me know.

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1450805/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to