[kupfer] sendkeys: Clean up description and misc in the Send Keys plugin



commit ad2ac97d7275432f8e21c8e38b8be424bf4e5505
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sat Mar 19 02:20:49 2011 +0100

    sendkeys: Clean up description and misc in the Send Keys plugin

 NEWS                      |    3 +++
 kupfer/plugin/sendkeys.py |   18 ++++++++++--------
 2 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/NEWS b/NEWS
index c240824..19dbcba 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,9 @@ kupfer's hastening insanity
 * *Thunar*: Use Thunar 1.2's Copy and Move API and expose it in
   Kupfer.
 * Add *Ascii & Unicode Icon Set* for fun
+* Add *Send Keys* plugin that can send synthetic keyboard events,
+  and prominently can be used for the *Paste to Foreground Window*
+  action on text. Requires ``xautomation`` package. (:lp:`621453`)
 
 
 kupfer v204
diff --git a/kupfer/plugin/sendkeys.py b/kupfer/plugin/sendkeys.py
index 7820e4c..32cbf23 100644
--- a/kupfer/plugin/sendkeys.py
+++ b/kupfer/plugin/sendkeys.py
@@ -1,11 +1,12 @@
 
-__kupfer_name__ = _("Paste")
+__kupfer_name__ = _("Send Keys")
 __kupfer_actions__ = (
 	"CopyAndPaste",
 	"SendKeys",
 	"TypeText",
 	)
-__description__ = _("Copy to clipboard and send Ctrl+V to foreground window")
+__description__ = _("Send synthetic keyboard events using "
+                    "xautomation")
 __version__ = ""
 __author__ = ""
 
@@ -13,8 +14,8 @@ import string
 
 import gtk
 
-from kupfer.objects import Leaf, Action, Source, OperationError
-from kupfer.objects import TextLeaf
+from kupfer.objects import Leaf, Action, Source, TextLeaf
+from kupfer.objects import OperationError, CommandMissingError
 from kupfer import pretty
 from kupfer import utils
 from kupfer import interface
@@ -31,7 +32,7 @@ class CopyAndPaste (Action):
 		xte_paste_argv = ['xte', 'usleep 300000', 'keydown Control_L',
 		                  'key v', 'keyup Control_L']
 		if not utils.spawn_async(xte_paste_argv):
-			raise OperationError(_("Command '%s' not found") % ("xte", ))
+			raise CommandMissingError('xte')
 	def item_types(self):
 		yield Leaf
 	def valid_for_item(self, leaf):
@@ -40,7 +41,7 @@ class CopyAndPaste (Action):
 		except AttributeError:
 			pass
 	def get_description(self):
-		return __description__
+		return _("Copy to clipboard and send Ctrl+V to foreground window")
 	def get_icon_name(self):
 		return "edit-paste"
 
@@ -72,7 +73,7 @@ class SendKeys (Action):
 		xte_paste_argv = ['xte', 'usleep 300000'] + \
 				mods_down + [key_arg] + mods_up
 		if not utils.spawn_async(xte_paste_argv):
-			raise OperationError(_("Command '%s' not found") % ("xte", ))
+			raise CommandMissingError('xte')
 	def item_types(self):
 		yield TextLeaf
 	def valid_for_item(self, leaf):
@@ -95,7 +96,7 @@ class TypeText (Action):
 			if line.endswith("\n"):
 				xte_paste_argv.append("key Return")
 		if not utils.spawn_async(xte_paste_argv):
-			raise OperationError(_("Command '%s' not found") % ("xte", ))
+			raise CommandMissingError('xte')
 	def item_types(self):
 		yield Leaf
 	def valid_for_item(self, leaf):
@@ -105,3 +106,4 @@ class TypeText (Action):
 			pass
 	def get_description(self):
 		return _("Type the text to foreground window")
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]