Gscreen - Glade Slider - Need Help

29 Dec 2016 18:06 #84863 by Ivan_The_Red

Ive been working with Gscreen and have added a horizontal slider to add the ability to change the jog feed rate but I cannot seem to figure out how to assign hotkeys to the slider. I'm using Glade to build the GUI and there are "accelerator keys" available but when I choose an accelerator key , save the Glade file and start Linuxcnc it doesn't work.......I'm baffled. I can assign accelerator keys successfully to buttons just fine.Does anybody know how sliders and accelerator keys are set up?

30 Dec 2016 01:43 - 30 Dec 2016 01:50 #84889 by cmorley
I would use keybindings to run the slider:

add this to your handler file:
def on_keycall_INCREMENTS(self,state,SHIFT,CNTRL,ALT):
            if SHIFT:
                print 'jog speed up'
                print 'jog speed down'

Now pressing i or shifted i will print the text in a terminal.
change the code to increase or decrease your slider.
something like:
curent = self.widgets.widgetname.get_value( )
self.widgets.widgetname.set_value(current+1 )

This is a built in keycall definition, other keys could be chosen.
There is a small example in the manual:
the example about halmeter launching with F4 shows shows how to add arbitrary keys with arbitrary function calls.

Chris M
Last Edit: 30 Dec 2016 01:50 by cmorley.
30 Dec 2016 01:52 #84890 by cmorley
Thinking about it - gscreen may already use i and I for jog increment changes.
add in the commands I posted would override this.
Just so you know what happened (if it matters to you).

Chris M
30 Dec 2016 02:41 #84892 by Ivan_The_Red
Thanks Chris ,
I just got in from the shop and ill gibe the i and l keys a try tomorrow morning. I also found a way to do it by setting a jog increment then sending a jog-increment command but id like to be able to create hotkeys also.

Moderators: mhaberler
Time to create page: 0.103 seconds
Powered by Kunena Forum