qtDragon: Auto Return to Manual Mode After an MDI Command so MPG works

More
25 Feb 2026 05:05 #343442 by Paul_W
qtDragon: Automatically Return to Manual Mode After an MDI CommandThe ProblemIf you use a pendant with qtDragon, you've probably run into this annoyance: after executing an MDI command, LinuxCNC stays in MDI mode. Before your pendant will respond to jog inputs, you have to manually click a movement button (or otherwise trigger a mode switch) to get back into manual mode. On a busy machine this gets old fast.  I use a VistaCNC P4-S.The FixThe solution is a small addition to your
qtdragon_handler.py
. We connect to LinuxCNC's
interp-idle
STATUS signal, which fires whenever the interpreter finishes executing. When that signal fires and we're still in MDI mode, we automatically switch back to manual.Step 1 — Get a local copy of the handlerIf you don't already have a
qtdragon_handler.py
in your config directory, copy the system default there. LinuxCNC will automatically prefer the local copy over the system one.
cp /usr/share/qtvcp/screens/qtdragon/qtdragon_handler.py ~/linuxcnc/configs/<your-config>/
Step 2 — Edit the handlerOpen your local
qtdragon_handler.py
and make two small changes:In the
initialized__
method, add the signal connection:
def initialized__(self):
    # ... your existing code ...
    STATUS.connect('interp-idle', self._on_interp_idle)
Add the callback method somewhere in the class:
def _on_interp_idle(self, obj):
    if STATUS.is_mdi_mode():
        ACTION.SET_MANUAL_MODE()
That's it.How It Works
  • interp-idle
    fires whenever the interpreter becomes idle — MDI command finished, program finished, etc.
  • The
    STATUS.is_mdi_mode()
    guard ensures we only switch to manual when we're actually in MDI mode, so it won't interfere with the end of a normal G-code program run.
  • ACTION.SET_MANUAL_MODE()
    does exactly what it says — same as clicking the Manual button in the UI.
Notes
  • Tested on LinuxCNC 2.9.6 with qtDragon.
  • This should work on any 2.9.x build without modification.
  • If you're on 2.8, the same approach should work but
    STATUS
    and
    ACTION
    import paths may differ slightly depending on your build.
  • This does not affect program (auto) mode — when a G-code program finishes it will stay in auto mode as expected, since
    is_mdi_mode()
    will return False.
CreditFigured this out with a little help. Posting here so the next person doesn't spend 3 hours on it.Hope this helps someone!

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

Moderators: cmorley
Time to create page: 0.067 seconds
Powered by Kunena Forum