Having issues calling ACTION.CALL_MDI() from python handler

More
11 Sep 2025 15:17 #334832 by scsmith1451
I'm trying to set the coordinate system based on the user's selection of a combobox from the on_changed handler. From the documentation only found the methods ACTION.SET_MDI_MODE() and ACTION.CALL_MDI() listed but no examples of their use. I've tried the following:

Gcode = 'G55'

ACTION.SET_MDI_MODE()
ACTION.CALL_MDI(Gcode)

Which gladevcp complains about when starting up as follows:

Traceback (most recent call last):
  File "/home/scsmith1/linuxcnc/configs/mmMill/gvcp_handler3.py", line 53, in on_changed
    ACTION.SET_MDI_MODE()
  File "/usr/lib/python3/dist-packages/gladevcp/gtk_action.py", line 143, in SET_MDI_MODE
    self.ensure_mode(linuxcnc.MODE_MDI)
  File "/usr/lib/python3/dist-packages/gladevcp/gtk_action.py", line 675, in ensure_mode
    truth, premode = STATUS.check_for_modes(modes)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/hal_glib.py", line 954, in check_for_modes
    self.stat.poll()
SystemError: <method 'poll' of 'linuxcnc.stat' objects> returned NULL without setting an exception

Does anyone have code examples of how to use these two methods in a handler?

I know documenting is not anyone's favorite activity and it take a huge amount of time to write, but it would be really helpful for newbies like myself if the ACTION, STAT and INFO library functions included code snipets to help new users implement the libraries in their projects.

Regards

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

More
11 Sep 2025 23:08 #334847 by cmorley
linuxcnc.org/docs/stable/html/gui/gladevcp-libraries.html

I don;t see anything you have done wrong.
The status library seems not to be able to poll.
Is linuxcnc running when you ran the glade panel?

This might be useful too:
linuxcnc.org/docs/stable/html/gui/gstat.html

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

More
12 Sep 2025 10:50 #334874 by scsmith1451
Ahh, no linuxcnc was not running. I was testing the handler via halcmd. Let me put it into the machine and see if it works correctly there.

Regards,

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

Time to create page: 0.058 seconds
Powered by Kunena Forum