>From cea7af43d398cc9df7a8bcf586d46008bfbddcc1 Mon Sep 17 00:00:00 2001
From: Alexander Guy <[email protected]>
Date: Sun, 3 Jun 2012 17:27:06 -0700
Subject: [PATCH 1/2] Bind axis movement keypresses to the jog increment 
combobox.

This is a first-go at a fix for bug #3531758:

    Uncontrolled continuous Z-axis jog with pull-down open.

This change binds keypresses to both the root window and
the jog increment combobox.  This avoids the situation
where KeyRelease events are being missed when the combobox
is open.

Signed-off-by: Alexander Guy <[email protected]>
---
 src/emc/usr_intf/axis/scripts/axis.py |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/emc/usr_intf/axis/scripts/axis.py 
b/src/emc/usr_intf/axis/scripts/axis.py
index d893b93..570ba3b 100755
--- a/src/emc/usr_intf/axis/scripts/axis.py
+++ b/src/emc/usr_intf/axis/scripts/axis.py
@@ -2758,12 +2758,13 @@ def jog_off_all():
             jog_off_actual(i)
 
 def bind_axis(a, b, d):
-    root_window.bind("<KeyPress-%s>" % a, kp_wrap(lambda e: jog_on(d, 
-get_jog_speed(d)), "KeyPress"))
-    root_window.bind("<KeyPress-%s>" % b, kp_wrap(lambda e: jog_on(d, 
get_jog_speed(d)), "KeyPress"))
-    root_window.bind("<Shift-KeyPress-%s>" % a, lambda e: jog_on(d, 
-get_max_jog_speed(d)))
-    root_window.bind("<Shift-KeyPress-%s>" % b, lambda e: jog_on(d, 
get_max_jog_speed(d)))
-    root_window.bind("<KeyRelease-%s>" % a, lambda e: jog_off(d))
-    root_window.bind("<KeyRelease-%s>" % b, lambda e: jog_off(d))
+    for widget in (root_window, widgets.jogincr):
+        widget.bind("<KeyPress-%s>" % a, kp_wrap(lambda e: jog_on(d, 
-get_jog_speed(d)), "KeyPress"))
+        widget.bind("<KeyPress-%s>" % b, kp_wrap(lambda e: jog_on(d, 
get_jog_speed(d)), "KeyPress"))
+        widget.bind("<Shift-KeyPress-%s>" % a, lambda e: jog_on(d, 
-get_max_jog_speed(d)))
+        widget.bind("<Shift-KeyPress-%s>" % b, lambda e: jog_on(d, 
get_max_jog_speed(d)))
+        widget.bind("<KeyRelease-%s>" % a, lambda e: jog_off(d))
+        widget.bind("<KeyRelease-%s>" % b, lambda e: jog_off(d))
 
 root_window.bind("<FocusOut>", lambda e: str(e.widget) == "." and 
jog_off_all())
 
-- 
1.7.10


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to