```class FeedHold(_BoolAction): action_id = 10 action_text = "Feedhold" def __init__(self, widget=None, action_type='TOGGLE'): super(FeedHold, self).__init__(widget, action_type) self.widget.setEnabled(STAT.interp_state == linuxcnc.INTERP_PAUSED) self.widget.setChecked(STAT.interp_state == linuxcnc.INTERP_PAUSED) STATUS.on.connect(lambda v: self.setEnabled(v)) STATUS.feedhold.connect(lambda s: self.setState(s == linuxcnc.PAUSED)) @classmethod def ON(cls): if STAT.task_state == linuxcnc.STATE_ON: LOG.debug("Setting feedhold green") CMD.auto(linuxcnc.PAUSE) CMD.wait_complete() elif STATUS.stat.task_state == linuxcnc.STATE_ESTOP: LOG.warn("Can't turn feedhold green with machine red") @classmethod def OFF(cls): LOG.debug("Setting feedhold red") CMD.auto(linuxcnc.RESUME) CMD.wait_complete() @classmethod def TOGGLE(cls): if STAT.interp_state == linuxcnc.PAUSED: cls.OFF() else: cls.ON()```