This is an automated email from the git hooks/post-receive script. pini pushed a commit to tag upstream/1.1.0_beta1 in repository sikuli.
commit 072a1a055ba78b0494ac8d060b307cedeaf816be Author: Raimund Hocke <[email protected]> Date: Thu Feb 20 07:19:43 2014 +0100 purged Rukuli, moved sikulix.rb to Lib folder in Basics, so it is auto exported in case of sikulixapi.jar --- .../src/main/resources/Lib/sikuli}/sikulix.rb | 0 .../org/sikuli/scriptrunner/JRubyScriptRunner.java | 2 +- JRuby/src/main/resources/rukuli.rb | 10 - JRuby/src/main/resources/rukuli/app.rb | 33 --- JRuby/src/main/resources/rukuli/clickable.rb | 278 --------------------- JRuby/src/main/resources/rukuli/config.rb | 67 ----- JRuby/src/main/resources/rukuli/exception.rb | 14 -- JRuby/src/main/resources/rukuli/key_code.rb | 21 -- JRuby/src/main/resources/rukuli/platform.rb | 12 - JRuby/src/main/resources/rukuli/region.rb | 88 ------- JRuby/src/main/resources/rukuli/screen.rb | 20 -- JRuby/src/main/resources/rukuli/searchable.rb | 134 ---------- JRuby/src/main/resources/rukuli/typeable.rb | 32 --- JRuby/src/main/resources/rukuli/version.rb | 3 - 14 files changed, 1 insertion(+), 713 deletions(-) diff --git a/JRuby/src/main/resources/sikulix.rb b/Basics/src/main/resources/Lib/sikuli/sikulix.rb similarity index 100% rename from JRuby/src/main/resources/sikulix.rb rename to Basics/src/main/resources/Lib/sikuli/sikulix.rb diff --git a/JRuby/src/main/java/org/sikuli/scriptrunner/JRubyScriptRunner.java b/JRuby/src/main/java/org/sikuli/scriptrunner/JRubyScriptRunner.java index 3c791d5..957d0ea 100755 --- a/JRuby/src/main/java/org/sikuli/scriptrunner/JRubyScriptRunner.java +++ b/JRuby/src/main/java/org/sikuli/scriptrunner/JRubyScriptRunner.java @@ -62,7 +62,7 @@ public class JRubyScriptRunner implements IScriptRunner { */ private final static String SCRIPT_HEADER = "# coding: utf-8\n" - + "require 'sikulix'\n" + + "require 'Lib/sikulix'\n" + "include SikuliX4Ruby\n"; private static ArrayList<String> codeBefore = null; diff --git a/JRuby/src/main/resources/rukuli.rb b/JRuby/src/main/resources/rukuli.rb deleted file mode 100755 index e0dbf97..0000000 --- a/JRuby/src/main/resources/rukuli.rb +++ /dev/null @@ -1,10 +0,0 @@ -require "rukuli/platform" -#require Rukuli::Platform.sikulix_path -require "rukuli/version" - -require "rukuli/app" -require "rukuli/exception" -require "rukuli/region" -require "rukuli/screen" -require "rukuli/key_code" -require "rukuli/config" diff --git a/JRuby/src/main/resources/rukuli/app.rb b/JRuby/src/main/resources/rukuli/app.rb deleted file mode 100755 index d45b268..0000000 --- a/JRuby/src/main/resources/rukuli/app.rb +++ /dev/null @@ -1,33 +0,0 @@ -# An App object represents a running app on the system. -# -module Rukuli - class App - - # Public: creates a new App instance - # - # app_name - String name of the app - # - # Examples - # - # App.new("TextEdit") - # - # Returns the newly initialized App - def initialize(app_name) - @java_obj = org.sikuli.script::App.new(app_name) - end - - # Public: brings the App to focus - # - # Returns nothing - def focus - @java_obj.focus() - end - - # Public: the Region instance representing the app's window - # - # Returns the newly initialized Region - def window - Region.new(@java_obj.window()) - end - end -end diff --git a/JRuby/src/main/resources/rukuli/clickable.rb b/JRuby/src/main/resources/rukuli/clickable.rb deleted file mode 100755 index 72c7d0e..0000000 --- a/JRuby/src/main/resources/rukuli/clickable.rb +++ /dev/null @@ -1,278 +0,0 @@ -# The Clickable module defines interaction with the mouse. It is included in -# the Region class. -# -module Rukuli - module Clickable - - # Public: Performs a single click on an image match or point (x, y) - # - # args - String representing filename of image to find and click - # args - Fixnum, Fixnum representing x and y coordinates within - # a Region (0,0) is the top left - # - # Examples - # - # region.click('smile.png') - # region.click(123, 432) - # - # Returns nothing - def click(*args) - case args.length - when 1 then click_image(args[0]) - when 2 then click_point(args[0], args[1]) - else raise ArgumentError - end - end - - # Public: Performs a double click on an image match or point (x, y) - # - # args - String representing filename of image to find and click - # args - Fixnum, Fixnum representing x and y coordinates within - # a Region (0,0) is the top left - # - # Examples - # - # region.double_click('smile.png') - # region.double_click(123, 432) - # - # Returns nothing - def double_click(*args) - case args.length - when 1 then click_image(args[0], true) - when 2 then click_point(args[0], args[1], true) - else raise ArgumentError - end - end - - # Public: Performs a click and hold on an image match or point (x, y) - # - # args - String representing filename of image to find and click - # args - Fixnum, Fixnum representing x and y coordinates within - # a Region (0,0) is the top left - # seconds - Fixnum representing the number of seconds to hold down - # before releasing - # - # Examples - # - # region.click_and_hold('smile.png', 2) - # region.click_and_hold(123, 432, 2) - # - # Returns nothing - def click_and_hold(seconds = 1, *args) - case args.length - when 1 then click_image_and_hold(args[0], seconds) - when 2 then click_point_and_hold(args[0], args[1], seconds) - else raise ArgumentError - end - end - - # Public: Performs a mouse down, drag, and mouse up - # - # start_x - Fixnum representing the x of the mouse down - # start_y - Fixnum representing the y of the mouse down - # end_x - Fixnum representing the x of the mouse up - # end_y - Fixnum representing the y of the mouse up - # - # Examples - # - # region.drag_drop(20, 12, 23, 44) - # - # Returns nothing - def drag_drop(start_x, start_y, end_x, end_y) - @java_obj.dragDrop( - offset_location(start_x, start_y), - offset_location(end_x, end_y) - ) - end - - # Public: Simulates turning of the mouse wheel up - # - # steps - Fixnum representing the number of steps to turn the mouse wheel - # - # Examples - # - # region.wheel_up(10) - # - # Returns nothing - def wheel_up(steps = 1) - @java_obj.wheel(-1, steps) - end - - # Public: Simulates turning of the mouse wheel down - # - # steps - Fixnum representing the number of steps to turn the mouse wheel - # - # Examples - # - # region.wheel_down(10) - # - # Returns nothing - def wheel_down(steps = 1) - @java_obj.wheel(1, steps) - end - - # Public: Performs a hover on an image match or point (x, y) - # - # args - String representing filename of image to find and hover - # args - Fixnum, Fixnum representing x and y coordinates within - # a Region (0,0) is the top left - # - # Examples - # - # region.hover('smile.png') - # region.hover(123, 432) - # - # Returns nothing - def hover(*args) - case args.length - when 1 then hover_image(args[0]) - when 2 then hover_point(args[0], args[1]) - else raise ArgumentError - end - end - - private - - # Private: turns the mouse wheel - # - # direction - Fixnum represeting direction to turn wheel - # steps - the number of steps to turn the mouse wheel - # - # Returns nothing - def wheel(direction, steps) - @java_obj.wheel(direction, steps) - end - - # Private: clicks on a matched Region based on an image based search - # - # filename - A String representation of the filename of the region to - # match against - # seconds - The length in seconds to hold the mouse - # - # Returns nothing - # - # Throws Rukuli::FileNotFound if the file could not be found on the system - # Throws Rukuli::ImageNotMatched if no matches are found within the region - def click_image_and_hold(filename, seconds) - begin - pattern = org.sikuli.script::Pattern.new(filename).similar(0.9) - @java_obj.hover(pattern) - @java_obj.mouseDown(java.awt.event.InputEvent::BUTTON1_MASK) - sleep(seconds.to_i) - @java_obj.mouseUp(0) - rescue NativeException => e - raise_exception e, filename - end - end - - # Private: clicks on a point within the region - # - # filename - A String representation of the filename of the region to - # match against - # - # Returns nothing - # - # Throws Rukuli::FileNotFound if the file could not be found on the system - # Throws Rukuli::ImageNotMatched if no matches are found within the region - def click_point_and_hold(x, y, seconds) - begin - @java_obj.hover(location(x, y)) - @java_obj.mouseDown(java.awt.event.InputEvent::BUTTON1_MASK) - sleep(seconds.to_i) - @java_obj.mouseUp(0) - rescue NativeException => e - raise_exception e, filename - end - end - - # Private: clicks on a matched Region based on an image based search - # - # filename - A String representation of the filename of the region to - # match against - # is_double - (optional) Boolean determining if should be a double click - # - # Returns nothing - # - # Throws Rukuli::FileNotFound if the file could not be found on the system - # Throws Rukuli::ImageNotMatched if no matches are found within the region - def click_image(filename, is_double = false, and_hold = false) - begin - if is_double - @java_obj.doubleClick(filename, 0) - else - @java_obj.click(filename, 0) - end - rescue NativeException => e - raise_exception e, filename - end - end - - # Private: clicks on a point relative to a Region's top left corner - # - # x - a Fixnum representing the x component of the point to click - # y - a Fixnum representing the y component of the point to click - # is_double - (optional) Boolean determining if should be a double click - # - # Returns nothing - # - # Throws Rukuli::FileNotFound if the file could not be found on the system - # Throws Rukuli::ImageNotMatched if no matches are found within the region - def click_point(x, y, is_double = false) - if is_double - @java_obj.doubleClick(offset_location(x, y)) - else - @java_obj.click(offset_location(x, y)) - end - end - - # Private: hovers on a matched Region based on an image based search - # - # filename - A String representation of the filename of the region to - # match against - # - # Returns nothing - # - # Throws Rukuli::FileNotFound if the file could not be found on the system - # Throws Rukuli::ImageNotMatched if no matches are found within the region - def hover_image(filename) - begin - @java_obj.hover(filename) - rescue NativeException => e - raise_exception e, filename - end - end - - # Private: hovers on a point relative to a Region's top left corner - # - # x - a Fixnum representing the x component of the point to hover - # y - a Fixnum representing the y component of the point to hover - # - # Returns nothing - # - # Throws Rukuli::FileNotFound if the file could not be found on the system - # Throws Rukuli::ImageNotMatched if no matches are found within the region - def hover_point(x, y) - @java_obj.hover(offset_location(x, y)) - end - - # Private: create a new instance of Location - # - # x - a Fixnum representing the x component of the point to hover - # y - a Fixnum representing the y component of the point to hover - # - # Return location class instance - def location(x, y) - org.sikuli.script::Location.new(x, y) - end - - # Private: location with offset - # - # x - a Fixnum representing the x component of the point to hover - # y - a Fixnum representing the y component of the point to hover - # - # Return new location - def offset_location(x, y) - location(x, y).offset(x(), y()) - end - end -end diff --git a/JRuby/src/main/resources/rukuli/config.rb b/JRuby/src/main/resources/rukuli/config.rb deleted file mode 100755 index 16e6cdc..0000000 --- a/JRuby/src/main/resources/rukuli/config.rb +++ /dev/null @@ -1,67 +0,0 @@ -# Config variables for the Sikuli driver -# -module Rukuli - class Config - class << self - - # Public: the Boolean representing whether or not to perform a 1 second - # highlight when an image is matched through Searchable#find, - # Searchable#find_all. Defaults to false. - attr_accessor :highlight_on_find - - # Public: the absolute file path where Sikuli will look for images when - # a just a filename is passed to a search or click method - # - # Returns the String representation of the path - def image_path - java.lang.System.getProperty("SIKULI_IMAGE_PATH") - end - - # Public: the setter for the absolute file path where Sikuli will search - # for images with given a filename as an image - # - # Examples - # - # Rukuli::Config.image_path = "/Users/andreanastacio/rukuli/images/" - # - # Returns nothing - def image_path=(path) - java.lang.System.setProperty("SIKULI_IMAGE_PATH", path) - end - - # Public: turns stdout logging on and off for the Sikuli java classes. - # Defaults to true. - # - # Examples - # - # Rukuli::Config.logging = false - # - # Returns nothing - def logging=(boolean) - return unless [TrueClass, FalseClass].include? boolean.class - org.sikuli.basics::Settings.InfoLogs = boolean - org.sikuli.basics::Settings.ActionLogs = boolean - org.sikuli.basics::Settings.DebugLogs = boolean - end - - # Public: convienence method for grouping the setting of config - # variables - # - # Examples - # - # Rukuli::Config.run do |config| - # config.logging = true - # config.image_path = "/User/andreanastacio/images" - # config.highlight_on_find = true - # end - # - # Returns nothing - def run(*args) - if block_given? - yield self - end - end - - end - end -end diff --git a/JRuby/src/main/resources/rukuli/exception.rb b/JRuby/src/main/resources/rukuli/exception.rb deleted file mode 100755 index c6e1524..0000000 --- a/JRuby/src/main/resources/rukuli/exception.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Exception classes for Sikuli image searching and matching -# -module Rukuli - - # Thrown when Sikuli is unable to find a match within the region for the - # file given. - # - class ImageNotFound < StandardError; end - - # Thrown when a filename is given that is not found on disk in the image - # path. Image path can be configured using Rukuli::Config.image_path - # - class FileDoesNotExist < StandardError; end -end diff --git a/JRuby/src/main/resources/rukuli/key_code.rb b/JRuby/src/main/resources/rukuli/key_code.rb deleted file mode 100755 index e882ca9..0000000 --- a/JRuby/src/main/resources/rukuli/key_code.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'java' -java_import 'org.sikuli.script.Key' -java_import 'org.sikuli.script.KeyModifier' - -# -# These constants represent keyboard codes for interacting with the keyboard. -# Keyboard interaction is defined in the Rukuli::Typeable module. -# -module Rukuli - KEY_CMD = KeyModifier::META - KEY_SHIFT = KeyModifier::SHIFT - KEY_CTRL = KeyModifier::CTRL - KEY_ALT = KeyModifier::ALT - - KEY_BACKSPACE = Key::BACKSPACE - KEY_RETURN = Key::ENTER - LEFT_ARROW = Key::LEFT - RIGHT_ARROW = Key::RIGHT - UP_ARROW = Key::UP - DOWN_ARROW = Key::DOWN -end diff --git a/JRuby/src/main/resources/rukuli/platform.rb b/JRuby/src/main/resources/rukuli/platform.rb deleted file mode 100755 index 7a33055..0000000 --- a/JRuby/src/main/resources/rukuli/platform.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Rukuli - class Platform - - def self.sikulix_path - path = "#{ENV['SIKULIX_HOME']}" - if ENV['SIKULIX_HOME'].nil? - raise LoadError, "Failed to load 'sikuli-java.jar'\nMake sure SIKULIX_HOME is set!" - end - path - end - end -end diff --git a/JRuby/src/main/resources/rukuli/region.rb b/JRuby/src/main/resources/rukuli/region.rb deleted file mode 100755 index f84df94..0000000 --- a/JRuby/src/main/resources/rukuli/region.rb +++ /dev/null @@ -1,88 +0,0 @@ -# A Region represents a rectangle on screen. Regions are the main point of -# interaction for Sikuli actions. Regions can receive actions from the mouse, -# keyboard, and image search. -# -require "rukuli/clickable" -require "rukuli/typeable" -require "rukuli/searchable" - -module Rukuli - class Region - include Clickable - include Typeable - include Searchable - - # Public: creates a new Region object - # - # args - Array representing x (left bound), y (top), width, height - # 4 Fixnums left, top, width, height - # An instance of an org.sikuli.script::Region - # - # Examples - # - # Region.new([10, 10, 200, 300]) - # Region.new(10, 10, 200, 300) - # Region.new(another_region) - # - # Returns the newly initialized object - def initialize(*args) - @java_obj = org.sikuli.script::Region.new(*args) - end - - # Public: highlight the region with a ~ 5 pixel red border - # - # seconds - Fixnum length of time to show border - # - # Returns nothing - def highlight(seconds = 1) - @java_obj.java_send(:highlight, [Java::int], seconds) - end - - # Public: the x component of the top, left corner of the Region - def x - @java_obj.x() - end - - # Public: the y component of the top, left corner of the Region - def y - @java_obj.y() - end - - # Public: the width in pixels of the Region - def width - @java_obj.w() - end - - # Public: the height in pixels of the Region - def height - @java_obj.h() - end - - # Public: provide access to all region methods provided by the SikuliScript API - # See http://sikuli.org/doc/java/edu/mit/csail/uid/Region.html - def method_missing method_name, *args, &block - @java_obj.send method_name, *args, &block - end - - private - - # Private: interpret a java NativeException and raises a more descriptive - # exception - # - # exception - The original java exception thrown by the sikuli java_obj - # filename - A string representing the filename to include in the - # exception message - # - # Returns nothing - def raise_exception(exception, filename) - message = exception.message - if message.start_with? "java.lang." - raise exception.message - elsif message.start_with? "org.sikuli.script.FindFailed" - raise Rukuli::FileDoesNotExist, "The file '#{filename}' does not exist." - else - raise Rukuli::ImageNotFound, "The image '#{filename}' did not match in this region." - end - end - end -end diff --git a/JRuby/src/main/resources/rukuli/screen.rb b/JRuby/src/main/resources/rukuli/screen.rb deleted file mode 100755 index a783800..0000000 --- a/JRuby/src/main/resources/rukuli/screen.rb +++ /dev/null @@ -1,20 +0,0 @@ -# A Screen object defines a special type of Rukuli::Region that represents -# the entire screen. -# -# TODO: Test the Screen object with multiple monitors attached. -# -module Rukuli - class Screen < Region - - # Public: creates a new Screen object - # - # Examples - # - # screen = Rukuli::Screen.new - # - # Returns the newly initialized Screen object - def initialize - @java_obj = org.sikuli.script::Screen.new() - end - end -end diff --git a/JRuby/src/main/resources/rukuli/searchable.rb b/JRuby/src/main/resources/rukuli/searchable.rb deleted file mode 100755 index 11254fc..0000000 --- a/JRuby/src/main/resources/rukuli/searchable.rb +++ /dev/null @@ -1,134 +0,0 @@ -# The Rukuli::Searchable module is the heart of Sikuli. It defines the -# wrapper around Sikuli's on screen image searching and matching capability -# It is implemented by the Region class. -# -module Rukuli - module Searchable - - # Public: search for an image within a Region - # - # filename - A String representation of the filename to match against - # similarity - A Float between 0 and 1 representing the threshold for - # matching an image. Passing 1 corresponds to a 100% pixel for pixel - # match. Defaults to 0.9 (90% match) - # - # Examples - # - # region.find('needle.png') - # region.find('needle.png', 0.5) - # - # Returns an instance of Region representing the best match - # - # Throws Rukuli::FileNotFound if the file could not be found on the system - # Throws Rukuli::ImageNotMatched if no matches are found within the region - def find(filename, similarity = 0.9) - begin - pattern = build_pattern(filename, similarity) - match = Region.new(@java_obj.find(pattern)) - match.highlight if Rukuli::Config.highlight_on_find - match - rescue NativeException => e - raise_exception e, filename - end - end - - # Public: search for an image within a region (does not raise ImageNotFound exceptions) - # - # filename - A String representation of the filename to match against - # similarity - A Float between 0 and 1 representing the threshold for - # matching an image. Passing 1 corresponds to a 100% pixel for pixel - # match. Defaults to 0.9 (90% match) - # - # Examples - # - # region.find!('needle.png') - # region.find!('needle.png', 0.5) - # - # Returns the match or nil if no match is found - def find!(filename, similarity = 0.9) - begin - find(filename, similarity) - rescue Rukuli::ImageNotFound => e - nil - end - end - - # Public: search for an image within a Region and return all matches - # - # TODO: Sort return results so they are always returned in the same order - # (top left to bottom right) - # - # filename - A String representation of the filename to match against - # similarity - A Float between 0 and 1 representing the threshold for - # matching an image. Passing 1 corresponds to a 100% pixel for pixel - # match. Defaults to 0.9 (90% match) - # - # Examples - # - # region.find_all('needle.png') - # region.find_all('needle.png', 0.5) - # - # Returns an array of Region objects that match the given file and - # threshold - # - # Throws Rukuli::FileNotFound if the file could not be found on the system - # Throws Rukuli::ImageNotMatched if no matches are found within the region - def find_all(filename, similarity = 0.9) - begin - pattern = build_pattern(filename, similarity) - matches = @java_obj.findAll(pattern) - regions = matches.collect do |r| - match = Region.new(r) - match.highlight if Rukuli::Config.highlight_on_find - match - end - regions - rescue NativeException => e - raise_exception e, filename - end - end - - # Public: wait for a match to appear within a region - # - # filename - A String representation of the filename to match against - # time - A Fixnum representing the amount of time to wait defaults - # to 2 seconds - # similarity - A Float between 0 and 1 representing the threshold for - # matching an image. Passing 1 corresponds to a 100% pixel for pixel - # match. Defaults to 0.9 (90% match) - # - # Examples - # - # region.wait('needle.png') # wait for needle.png to appear for up to 1 second - # region.wait('needle.png', 10) # wait for needle.png to appear for 10 seconds - # - # Returns nothing - # - # Throws Rukuli::FileNotFound if the file could not be found on the system - # Throws Rukuli::ImageNotMatched if no matches are found within the region - def wait(filename, time = 2, similarity = 0.9) - begin - pattern = build_pattern(filename, similarity) - match = Region.new(@java_obj.wait(pattern, time)) - match.highlight if Rukuli::Config.highlight_on_find - match - rescue NativeException => e - raise_exception e, filename - end - end - - private - - # Private: builds a java Pattern to check - # - # filename - A String representation of the filename to match against - # similarity - A Float between 0 and 1 representing the threshold for - # matching an image. Passing 1 corresponds to a 100% pixel for pixel - # match. Defaults to 0.9 (90% match) - # - # Returns a org.sikuli.script::Pattern object to match against - def build_pattern(filename, similarity) - org.sikuli.script::Pattern.new(filename).similar(similarity) - end - end -end diff --git a/JRuby/src/main/resources/rukuli/typeable.rb b/JRuby/src/main/resources/rukuli/typeable.rb deleted file mode 100755 index 02b7e6e..0000000 --- a/JRuby/src/main/resources/rukuli/typeable.rb +++ /dev/null @@ -1,32 +0,0 @@ -# Defines interactions with the keyboard. Implemented in the Region class. -# -module Rukuli - module Typeable - - # Public: Types text as if it was being typed on the keyboard with an - # optional key modifier - # - # text - String representing text to be typed on keyboard - # modifier - (optional) Sikilu constant (defined in key_code.rb) - # representing key to hold while typing text - # - # Examples - # - # region.type("Hello World") - # region.type("s", Rukuli::KEY_CMD) # saves a file - # - # Returns nothing - def type(text, modifier = 0) - @java_obj.type(nil, text, modifier) - end - - # Public: Types text then presses the return/enter key on the keyboard - # - # text - String - # - # Returns nothing - def enter(text) - @java_obj.type(text + Sikuli::KEY_RETURN) - end - end -end diff --git a/JRuby/src/main/resources/rukuli/version.rb b/JRuby/src/main/resources/rukuli/version.rb deleted file mode 100755 index 17b5ca4..0000000 --- a/JRuby/src/main/resources/rukuli/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module Rukuli - VERSION = "1.0.0" -end -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/sikuli.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

