Gscreen - a GTK / Glade / Python based screen

More
04 Feb 2014 21:42 #43539 by andypugh

The shop supervisor noticed something on this build that the up, down arrow keys do not work while in edit mode, making it a little interesting trying to make multiple edits to a long program.
Any Ideas?


It sounds like the arrows are being captured as jog commands by the GUI rather than being passed on to the system.

At a guess it is something in git.linuxcnc.org/gitweb?p=linuxcnc.git;a...33d76c802143;hb=HEAD
but possibly the generic GladeVCP key-forwarder: git.linuxcnc.org/gitweb?p=linuxcnc.git;a...f9fb95c95731;hb=HEAD

Please Log in or Create an account to join the conversation.

More
13 Feb 2014 23:08 #43829 by LAIR82
So if I went into this file,

[linuxcnc.git] / src / emc / usr_intf / gscreen / keybindings.py

and modified

45 self.Up = 'YPOS'
46 self.Down = 'YNEG'
47 self.Left = 'XPOS'
48 self.Right = 'XNEG'

to something along the lines of

45 self.Up = 'cursor up'

Would that change the outcome and make the cursor move up, down, left, and right?

Or am I out in left field? ( left field in a different ball diamond probably)

Rick

Please Log in or Create an account to join the conversation.

More
14 Feb 2014 12:32 #43842 by cmorley

So if I went into this file,

[linuxcnc.git] / src / emc / usr_intf / gscreen / keybindings.py

and modified

45 self.Up = 'YPOS'
46 self.Down = 'YNEG'
47 self.Left = 'XPOS'
48 self.Right = 'XNEG'

to something along the lines of

45 self.Up = 'cursor up'

Would that change the outcome and make the cursor move up, down, left, and right?

Or am I out in left field? ( left field in a different ball diamond probably)

Rick


No.
The self.Up = "YPOS" sets 'Up' (that's the key - the cursor up key) to a binding called YPOS and YPOS calls 'on_keycall_YPOS'
which is a function to move the Y axis in the positive direction.

It's not clear to me what you are trying to do. You want to move a cursor with the cursor keys ? Do you mean the mouse pointer?

Chris M

Please Log in or Create an account to join the conversation.

More
14 Feb 2014 12:47 - 14 Feb 2014 12:48 #43844 by cmorley
Sorry I missed the posts above your question.

Andy is right keyboard jogging is stealing the cursor keys.

in Gscreen look for
def on_key_event(self,widget, event,state):
        CNTRL = SHIFT = ALT = 0
        keyname = gtk.gdk.keyval_name(event.keyval)
        print("Key %s (%d) was pressed state: %d last: %s" % (keyname, event.keyval,state, self.data.key_event_last))
        if event.state & gtk.gdk.CONTROL_MASK:
            CNTRL = 1
            self.verbosely_print("Control was being held down")
        if event.state & gtk.gdk.MOD1_MASK:
            ALT = 1
            self.verbosely_print("Alt was being held down")
        if event.state & gtk.gdk.SHIFT_MASK:
            SHIFT = 1
            self.verbosely_print("Shift was being held down")
        if keyname in( "Shift_L","Shift_R"): return True # ignore shift key press
        if self.data.key_event_last[0] == keyname and self.data.key_event_last[1] == state : return True
        self.data.key_event_last = keyname,state
        try:
            method = self.keylookup.convert(keyname)
            if method:
                try:
                    self.handler_instance[method](state,SHIFT,CNTRL,ALT)
                    return True
                except:
                    self[method](state,SHIFT,CNTRL,ALT) 
                    return True                             
        except:
            self.show_try_errors()

Remove the 'True' after the 'return' (all of them) and test.
Do you use any of the keyboard controls?

Chris M
Last edit: 14 Feb 2014 12:48 by cmorley.

Please Log in or Create an account to join the conversation.

More
14 Feb 2014 20:41 #43854 by LAIR82
Since I use a RIP config, do I need to re-compile after I make those changes? I found that section, made the changes and had no effect.

We don't really use the keyboard for anything other than program editing and changing tool "wear" offsets, lots and lots of tool "wear" offset changes.

But, now that I'm in this deep with it, and have seen these internals, if I change the labeling around for those arrow keys in relation to which axis they jog, in the keybindings.py file will it change which axis jogs? Reason I ask is, I have told the operators of the lathes that the keyboard jog doesn't correlate like it should with the z axis using pg up and pg dwn.

Its always something with me,

Thanks

Rick

Please Log in or Create an account to join the conversation.

More
14 Feb 2014 20:50 #43856 by andypugh

Since I use a RIP config, do I need to re-compile after I make those changes?

No, as Python is interpreted not compiled.
However, you have to make sure that you edited the correct file, you probably have an installed file in /usr/ and a rip file in ~/linuxcnc-dev/
The following user(s) said Thank You: LAIR82

Please Log in or Create an account to join the conversation.

More
14 Feb 2014 21:04 #43860 by LAIR82
I made the changes to files in the linuxcnc-dev folder.

I will try again and see if maybe I goofed up somewhere,

Do I need to open the file thru the terminal window using sudo?


Rick

Please Log in or Create an account to join the conversation.

More
15 Feb 2014 00:46 #43864 by cmorley
You need to re make so the file is copied over to usr/bin.

Yes changing those entries around will change the key binding.

Please let me know how they want it for a lathe and I'll fix it properly layer.
The following user(s) said Thank You: LAIR82

Please Log in or Create an account to join the conversation.

More
15 Feb 2014 02:28 #43867 by LAIR82
Works like a champ now in edit mode, Thank You

I have it set now as follows to correlate with a back tool slant bed lathe.

arrow left: Z negative
arrow right: Z positive
arrow up: X positive
arrow down: X negative

Thank You guys again for all of the help

Rick

Please Log in or Create an account to join the conversation.

More
21 Feb 2014 14:54 #44033 by cmorley
Just a heads up - I pushed code to have Gscreen check the preference file for key binding info.
By editing the preference file on can change the the bindings of the default key calls to any other key.

jogging, increments, power and estop are defined.
Not as handy as on screen selection but I'm pressed for time right now.

Lair82: If you update linuxcnc again this is the way to reset your keybindings. The last hack i had you use won't work after that.
You'll recognize the names and they are under the heading [KEYCODES]
They are case sensitive - type them exactly.

Chris M

Please Log in or Create an account to join the conversation.

Time to create page: 0.152 seconds
Powered by Kunena Forum