[kupfer] paste: Allow sending more keys by gdk name (Return, F9 etc..)



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

    paste: Allow sending more keys by gdk name (Return, F9 etc..)

 kupfer/plugin/paste.py |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/kupfer/plugin/paste.py b/kupfer/plugin/paste.py
index 4d1e18b..7820e4c 100644
--- a/kupfer/plugin/paste.py
+++ b/kupfer/plugin/paste.py
@@ -56,22 +56,21 @@ class SendKeys (Action):
 			gtk.gdk.SUPER_MASK: "Super_L",
 			gtk.gdk.MOD1_MASK: "Alt_L",
 		}
-		mods_start = []
-		mods_end = []
+		mod_names = []
 		mods = orig_mods
 		for mod in m:
 			if mod & mods:
-				mods_start.append('keydown %s' % (m[mod], ))
-				mods_end.append('keyup %s' % (m[mod], ))
+				mod_names.append(m[mod])
 				mods &= ~mod
-		if mods != 0 or not (31 < keys < 127):
+		if mods != 0:
 			raise OperationError(_("Keys not yet implemented: %s") %
 					gtk.accelerator_get_label(keys, orig_mods))
-		key_arg = 'key %s' % (chr(keys), )
-		print mods_start, repr(key_arg), mods_end
+		key_arg = 'key %s' % (gtk.gdk.keyval_name(keys), )
+		mods_down = ['keydown ' + n for n in mod_names]
+		mods_up = ['keyup ' + n for n in reversed(mod_names)]
 
 		xte_paste_argv = ['xte', 'usleep 300000'] + \
-				mods_start + [key_arg] + list(reversed(mods_end))
+				mods_down + [key_arg] + mods_up
 		if not utils.spawn_async(xte_paste_argv):
 			raise OperationError(_("Command '%s' not found") % ("xte", ))
 	def item_types(self):



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