>From 29e4e3685609e08f581228252549bab98794cec9 Mon Sep 17 00:00:00 2001 From: Alexander Guy <[email protected]> Date: Mon, 4 Jun 2012 16:47:29 -0700 Subject: [PATCH 2/2] Don't propagate keyboard events for axis movement keys.
This fixes the issue where you see jog increment combobox selection changes when the drop-down is open and the user presses the up or down keys. Signed-off-by: Alexander Guy <[email protected]> --- src/emc/usr_intf/axis/scripts/axis.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/emc/usr_intf/axis/scripts/axis.py b/src/emc/usr_intf/axis/scripts/axis.py index 570ba3b..31d1afa 100755 --- a/src/emc/usr_intf/axis/scripts/axis.py +++ b/src/emc/usr_intf/axis/scripts/axis.py @@ -2597,6 +2597,13 @@ def nomodifier(f): def kp_wrap(f,g): return nomodifier(f) +def dont_propagate(handler): + def wrapper(event): + handler(event) + return "break" + + return wrapper + root_window.bind("<Escape>", commands.task_stop) root_window.bind("l", commands.toggle_override_limits) root_window.bind("o", commands.open_file) @@ -2759,12 +2766,12 @@ def jog_off_all(): def bind_axis(a, b, 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)) + widget.bind("<KeyPress-%s>" % a, dont_propagate(kp_wrap(lambda e: jog_on(d, -get_jog_speed(d)), "KeyPress"))) + widget.bind("<KeyPress-%s>" % b, dont_propagate(kp_wrap(lambda e: jog_on(d, get_jog_speed(d)), "KeyPress"))) + widget.bind("<Shift-KeyPress-%s>" % a, dont_propagate(lambda e: jog_on(d, -get_max_jog_speed(d)))) + widget.bind("<Shift-KeyPress-%s>" % b, dont_propagate(lambda e: jog_on(d, get_max_jog_speed(d)))) + widget.bind("<KeyRelease-%s>" % a, dont_propagate(lambda e: jog_off(d))) + widget.bind("<KeyRelease-%s>" % b, dont_propagate(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
