[sikuli] 331/385: RubyScript: added hotkeys add/remove methods
Gilles Filippini
pini at moszumanska.debian.org
Sun Jun 29 19:26:32 UTC 2014
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 d74ac474020c4b83d89acf422f98230779c10381
Author: rssdev10 <rssdev10 at gmail.com>
Date: Sun Mar 30 20:12:27 2014 +0400
RubyScript: added hotkeys add/remove methods
---
Basics/src/main/resources/Lib/sikulix.rb | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/Basics/src/main/resources/Lib/sikulix.rb b/Basics/src/main/resources/Lib/sikulix.rb
index cb3ce84..8ec6dff 100755
--- a/Basics/src/main/resources/Lib/sikulix.rb
+++ b/Basics/src/main/resources/Lib/sikulix.rb
@@ -122,6 +122,37 @@ module SikuliX4Ruby
SikuliScript.shelp
end
+ #TODO: check it after Env Java-class refactoring
+ java_import org.sikuli.script.Env
+ java_import org.sikuli.basics.HotkeyListener
+
+ class Env # :nodoc: all
+ class RHotkeyListener < HotkeyListener
+ def initialize (block); super(); @block=block; end
+ def hotkeyPressed event; @block.call event; end
+ end
+ end
+
+ ##
+ # Register hotkeys
+ #
+ # Example:
+ # addHotkey( Key::F1, KeyModifier::ALT + KeyModifier::CTRL ) do
+ # popup 'hallo', 'Title'
+ # end
+ #
+ def addHotkey key, modifiers, &block
+ Env.addHotkey( key, modifiers, Env::RHotkeyListener.new(block) )
+ end
+
+ ##
+ # Unregister hotkeys
+ #
+ # Example:
+ # removeHotkey( Key::F1, KeyModifier::ALT + KeyModifier::CTRL )
+ def removeHotkey key, modifiers
+ Env.removeHotkey key, modifiers
+ end
end
# This method allow to call "undotted" methods that belong to
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/sikuli.git
More information about the pkg-java-commits
mailing list