remap keys in axis (solved)

More
12 Apr 2020 22:14 #163813 by strahlensauger
I would like to use a button on my Xbox Controller to hide the pyVCP panel in axis. The keys for that on the keyboard are
ctrl e. The Controller can only assign a single key to a button, so I would like to hide the panel just by hitting a single key, e.g."e" on the keyboard.
That requires to change the key mapping of axis.
The threads I found here were pretty old and the links were broken quite often.
Any advice would be appreciated.

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

More
13 Apr 2020 03:56 - 13 Apr 2020 04:00 #163840 by phillc54
Replied by phillc54 on topic remap keys in axis
try the following in ~/.axisrc
root_window.bind("<e>", commands.toggle_show_pyvcppanel)
Last edit: 13 Apr 2020 04:00 by phillc54. Reason: I forgot the dot
The following user(s) said Thank You: strahlensauger

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

More
13 Apr 2020 11:27 - 13 Apr 2020 11:32 #163867 by strahlensauger
Replied by strahlensauger on topic remap keys in axis
Thank you for your quick answer.
I put the code in .axisrc, but it is still ctrl e that controls the visibility
I'm using linuxcnc 2.8.
my .axisrc looks like (couldn't attach without changing the extension...):

#root_window.tk.call("wm","geometry",".","1024x768")
root_window.attributes("-fullscreen",1)
root_window.bind("<e>", commands.toggle_show_pyvcppanel)

def my_error_task(self):
error = e.poll()
while error:
kind, text = error
if kind in (linuxcnc.NML_ERROR, linuxcnc.OPERATOR_ERROR):
icon = "error"
else:
icon = "info"
notifications.add(icon, text)
ucomp["error"]=True
error = e.poll()
self.error_after = self.win.after(200, self.error_task)

def my_remove(self, widgets):
self.widgets.remove(widgets)
if len(self.cache) < 10:
widgets[0].pack_forget()
self.cache.append(widgets)
else:
widgets[0].destroy()
if len(self.widgets) == 0:
ucomp["error"]=False
self.place_forget()

LivePlotter.error_task = my_error_task
Notification.remove = my_remove

if hal_present == 1 :
ucomp = hal.component("probe.user")
ucomp.newpin("error",hal.HAL_BIT,hal.HAL_IN)
ucomp.ready()
Attachments:
Last edit: 13 Apr 2020 11:32 by strahlensauger.

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

More
13 Apr 2020 11:35 #163870 by phillc54
Replied by phillc54 on topic remap keys in axis
It worked here in 2.8 but that was the only code in .axisrc

From memory it still worked with Control + E as well.

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

More
13 Apr 2020 14:11 - 13 Apr 2020 17:47 #163874 by strahlensauger
Problem solved.
The .axisrc did not execute because I had a User_Command_File specified in my ini-File.
This stopped the .axisrc from loading and executed the file specified.

Thanks again.
Last edit: 13 Apr 2020 17:47 by strahlensauger.
The following user(s) said Thank You: phillc54

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

Time to create page: 0.090 seconds
Powered by Kunena Forum