Source code for qtpyvcp.actions.base_actions

import linuxcnc
from qtpyvcp.utilities import logger
from import Info
from qtpyvcp.plugins import getPlugin

STATUS = getPlugin('status')

INFO = Info()
CMD = linuxcnc.command()

# Set up logging
LOG = logger.getLogger(__name__)

[docs]def setTaskMode(new_mode): """Sets task mode, if possible Args: new_mode (int) : linuxcnc.MODE_MANUAL, linuxcnc.MODE_MDI or linuxcnc.MODE_AUTO Returns: bool : True if successful """ if isRunning(): LOG.error("Can't set mode while machine is running") return False else: CMD.mode(new_mode) return True
[docs]def isRunning(): """Returns TRUE if machine is moving due to MDI, program execution, etc.""" if STAT.state == linuxcnc.RCS_EXEC: return True else: return STAT.task_mode == linuxcnc.MODE_AUTO \ and STAT.interp_state != linuxcnc.INTERP_IDLE