← Back to team overview

sikuli-driver team mailing list archive

[Bug 1815299] [NEW] [1.1.4] Region().highlight() doesn't accept values lower than 1.0 --- fixed 2019-02-09 build #192

 

Public bug reported:

Script:
=====
import os, sys, time
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/sikulixapi.jar')

from org.sikuli.script import App
from org.sikuli.script import Screen
from org.sikuli.basics import Settings
from org.sikuli.script import Mouse
from org.sikuli.script import Location

class Sikuli:

    def __init__(self):        
        Mouse.setMouseMovedAction(0) # 0 - Disable User Mouse Interaction
        Settings.MoveMouseDelay = 0.1 # Doesn't work if Settings.setShowActions(False) is executed afterwards
        # Settings.Highlight = False # True - Fires two Times per Action
        # Settings.setShowActions(False) # False - does disable the Settings.MoveMouseDelay Setting
        # Mouse.setMouseMovedHighlight(True) # Doesn't show any Effect
        Settings.MinSimilarity = 0.95
        Settings.DebugLogs = False
        self.screen = Screen()
        self.highlight = True
        self.mouse_move_away_method = 'Offset' # Origin, Offset

    def app(self, app):
        try:
            self.app = App(app)
        except:
            pass
        finally:
            self.app = App(app)

    def app_open(self):
        self.app.open()
    
    def app_close(self):
        self.app.close()

    def move_offset(self, x, y):
        Mouse.move(x, y)

    def move(self, x, y):
        loc = Location(x, y)
        Mouse.move(loc)

    def click_image(self, image, timeout=5):
        if self.mouse_move_away_method == 'Origin':
            self.move(0, 0)
        if self.mouse_move_away_method == 'Offset':
            self.move_offset(-50, -50)
        reg = self.screen.wait(image, timeout)
        if self.highlight:
            reg.highlight(0.9) # Float Values lower than 1.0 not possible; reg.highlight() disable the Click Action; Clicks doesn't come trough; Use reg.highlight(<int>) instead
        self.screen.click(image)


Versions:
========
Jython 2.7.0
SikuliXApi.jar Version 1.1.4
Windows 10

Question:
========
The reg.highlight(0.9) throw an Exception:

PS E:\Audio\Audio Installer\Jython\Test> jython .\Script.py
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.python.core.PySystemState (file:/C:/jython2.7.0/jython.jar) to method java.io.Console.encoding()
WARNING: Please consider reporting this to the maintainers of org.python.core.PySystemState
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[log] highlight M[1027,680 74x22]On(0) S 10000 for 0.9 secs
Traceback (most recent call last):
  File ".\Ableton.py", line 11, in <module>
    sik.click_image(r'..\..\Images\test_next.png')
  File "..\sikulix.py", line 52, in click_image
    reg.highlight(0.9) # Float Values like 0.1 not possible; reg.highlight() disable the Click Action; Clicks doesn't come trough; Use reg.highlight(<int>) instead
        at java.base/java.lang.Thread.sleep(Native Method)
        at org.sikuli.util.ScreenHighlighter.closeAfter(ScreenHighlighter.java:144)
        at org.sikuli.util.ScreenHighlighter.highlight(ScreenHighlighter.java:214)
        at org.sikuli.script.Region.highlight(Region.java:2164)
        at org.sikuli.script.Region.highlight(Region.java:2142)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)

java.lang.IllegalArgumentException: java.lang.IllegalArgumentException:
timeout value is negative

** Affects: sikuli
     Importance: Critical
     Assignee: RaiMan (raimund-hocke)
         Status: Fix Committed

** Changed in: sikuli
       Status: New => Fix Committed

** Changed in: sikuli
   Importance: Undecided => Critical

** Changed in: sikuli
     Assignee: (unassigned) => RaiMan (raimund-hocke)

** Changed in: sikuli
    Milestone: None => 1.1.4

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

Title:
  [1.1.4] Region().highlight() doesn't accept values lower than 1.0 ---
  fixed 2019-02-09 build #192

Status in Sikuli:
  Fix Committed

Bug description:
  Script:
  =====
  import os, sys, time
  sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/sikulixapi.jar')

  from org.sikuli.script import App
  from org.sikuli.script import Screen
  from org.sikuli.basics import Settings
  from org.sikuli.script import Mouse
  from org.sikuli.script import Location

  class Sikuli:

      def __init__(self):        
          Mouse.setMouseMovedAction(0) # 0 - Disable User Mouse Interaction
          Settings.MoveMouseDelay = 0.1 # Doesn't work if Settings.setShowActions(False) is executed afterwards
          # Settings.Highlight = False # True - Fires two Times per Action
          # Settings.setShowActions(False) # False - does disable the Settings.MoveMouseDelay Setting
          # Mouse.setMouseMovedHighlight(True) # Doesn't show any Effect
          Settings.MinSimilarity = 0.95
          Settings.DebugLogs = False
          self.screen = Screen()
          self.highlight = True
          self.mouse_move_away_method = 'Offset' # Origin, Offset

      def app(self, app):
          try:
              self.app = App(app)
          except:
              pass
          finally:
              self.app = App(app)

      def app_open(self):
          self.app.open()
      
      def app_close(self):
          self.app.close()

      def move_offset(self, x, y):
          Mouse.move(x, y)

      def move(self, x, y):
          loc = Location(x, y)
          Mouse.move(loc)

      def click_image(self, image, timeout=5):
          if self.mouse_move_away_method == 'Origin':
              self.move(0, 0)
          if self.mouse_move_away_method == 'Offset':
              self.move_offset(-50, -50)
          reg = self.screen.wait(image, timeout)
          if self.highlight:
              reg.highlight(0.9) # Float Values lower than 1.0 not possible; reg.highlight() disable the Click Action; Clicks doesn't come trough; Use reg.highlight(<int>) instead
          self.screen.click(image)

  
  Versions:
  ========
  Jython 2.7.0
  SikuliXApi.jar Version 1.1.4
  Windows 10

  Question:
  ========
  The reg.highlight(0.9) throw an Exception:

  PS E:\Audio\Audio Installer\Jython\Test> jython .\Script.py
  WARNING: An illegal reflective access operation has occurred
  WARNING: Illegal reflective access by org.python.core.PySystemState (file:/C:/jython2.7.0/jython.jar) to method java.io.Console.encoding()
  WARNING: Please consider reporting this to the maintainers of org.python.core.PySystemState
  WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
  WARNING: All illegal access operations will be denied in a future release
  [log] highlight M[1027,680 74x22]On(0) S 10000 for 0.9 secs
  Traceback (most recent call last):
    File ".\Ableton.py", line 11, in <module>
      sik.click_image(r'..\..\Images\test_next.png')
    File "..\sikulix.py", line 52, in click_image
      reg.highlight(0.9) # Float Values like 0.1 not possible; reg.highlight() disable the Click Action; Clicks doesn't come trough; Use reg.highlight(<int>) instead
          at java.base/java.lang.Thread.sleep(Native Method)
          at org.sikuli.util.ScreenHighlighter.closeAfter(ScreenHighlighter.java:144)
          at org.sikuli.util.ScreenHighlighter.highlight(ScreenHighlighter.java:214)
          at org.sikuli.script.Region.highlight(Region.java:2164)
          at org.sikuli.script.Region.highlight(Region.java:2142)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.base/java.lang.reflect.Method.invoke(Method.java:566)

  java.lang.IllegalArgumentException:
  java.lang.IllegalArgumentException: timeout value is negative

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


Follow ups