Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _jog_axis_bindOk(axis, direction, widget):
aletter = getAxisLetter(axis)
if aletter not in INFO.AXIS_LETTER_LIST:
msg = 'Machine has no {} axis'.format(aletter.upper())
widget.setEnabled(False)
widget.setToolTip(msg)
widget.setStatusTip(msg)
return
STATUS.limit.onValueChanged(lambda: _jog_axis_ok(aletter, direction, widget))
STATUS.homed.onValueChanged(lambda: _jog_axis_ok(aletter, direction, widget))
STATUS.task_state.onValueChanged(lambda: _jog_axis_ok(aletter, direction, widget))
STATUS.interp_state.onValueChanged(lambda: _jog_axis_ok(aletter, direction, widget))
jog.axis.ok = _jog_axis_ok
jog.axis.bindOk = _jog_axis_bindOk
class jog_mode:
"""Jog Mode Group"""
@staticmethod
def continuous():
"""Set Jog Continuous
ActionButton syntax::
machine.jog-mode.continuous
"""
jog_mode_incremental.setValue(False)
def _jog_axis_bindOk(axis, direction, widget):
aletter = getAxisLetter(axis)
if aletter not in INFO.AXIS_LETTER_LIST:
msg = 'Machine has no {} axis'.format(aletter.upper())
widget.setEnabled(False)
widget.setToolTip(msg)
widget.setStatusTip(msg)
return
STATUS.limit.onValueChanged(lambda: _jog_axis_ok(aletter, direction, widget))
STATUS.homed.onValueChanged(lambda: _jog_axis_ok(aletter, direction, widget))
STATUS.task_state.onValueChanged(lambda: _jog_axis_ok(aletter, direction, widget))
STATUS.interp_state.onValueChanged(lambda: _jog_axis_ok(aletter, direction, widget))
jog.axis.ok = _jog_axis_ok
jog.axis.bindOk = _jog_axis_bindOk
class jog_mode:
"""Jog Mode Group"""
@staticmethod
def continuous():
"""Set Jog Continuous
ActionButton syntax::
machine.jog-mode.continuous
"""
jog_mode_incremental.setValue(False)
def _jog_speed_slider_bindOk(widget):
try:
# these will only work for QSlider or QSpinBox
widget.setMinimum(0)
widget.setMaximum(100)
widget.setValue((jog.linear_speed.getValue() / jog.max_linear_speed) * 100)
# jog.linear_speed.connect(lambda v: widget.setValue(v * 100))
except AttributeError:
pass
jog_linear_speed_percentage.setValue(percentage)
def _jog_speed_slider_bindOk(widget):
try:
# these will only work for QSlider or QSpinBox
widget.setMinimum(0)
widget.setMaximum(100)
widget.setValue((jog.linear_speed.getValue() / jog.max_linear_speed) * 100)
# jog.linear_speed.connect(lambda v: widget.setValue(v * 100))
except AttributeError:
pass
jog.set_linear_speed.ok = jog.set_angular_speed.ok = lambda *a, **k: True
jog.set_linear_speed.bindOk = jog.set_angular_speed.bindOk = lambda *a, **k: True
jog.set_linear_speed_percentage.ok = lambda *a, **k: True
jog.set_linear_speed_percentage.bindOk = _jog_speed_slider_bindOk
def _jog_axis_ok(axis, direction=0, widget=None):
axisnum = getAxisNumber(axis)
if STAT.task_state == linuxcnc.STATE_ON \
and STAT.interp_state == linuxcnc.INTERP_IDLE \
and STAT.limit[axisnum] == 0:
# and STAT.homed[axisnum] == 1 \
ok = True
msg = ""
else:
ok = False
def _jog_speed_slider_bindOk(widget):
try:
# these will only work for QSlider or QSpinBox
widget.setMinimum(0)
widget.setMaximum(100)
widget.setValue((jog.linear_speed.getValue() / jog.max_linear_speed) * 100)
# jog.linear_speed.connect(lambda v: widget.setValue(v * 100))
except AttributeError:
pass
jog_linear_speed_percentage.setValue(percentage)
def _jog_speed_slider_bindOk(widget):
try:
# these will only work for QSlider or QSpinBox
widget.setMinimum(0)
widget.setMaximum(100)
widget.setValue((jog.linear_speed.getValue() / jog.max_linear_speed) * 100)
# jog.linear_speed.connect(lambda v: widget.setValue(v * 100))
except AttributeError:
pass
jog.set_linear_speed.ok = jog.set_angular_speed.ok = lambda *a, **k: True
jog.set_linear_speed.bindOk = jog.set_angular_speed.bindOk = lambda *a, **k: True
jog.set_linear_speed_percentage.ok = lambda *a, **k: True
jog.set_linear_speed_percentage.bindOk = _jog_speed_slider_bindOk
def _jog_axis_ok(axis, direction=0, widget=None):
axisnum = getAxisNumber(axis)
if STAT.task_state == linuxcnc.STATE_ON \
and STAT.interp_state == linuxcnc.INTERP_IDLE \
and STAT.limit[axisnum] == 0:
# and STAT.homed[axisnum] == 1 \
ok = True
msg = ""
else:
ok = False
def _jog_speed_slider_bindOk(widget):
try:
# these will only work for QSlider or QSpinBox
widget.setMinimum(0)
widget.setMaximum(100)
widget.setValue((jog.linear_speed.getValue() / jog.max_linear_speed) * 100)
# jog.linear_speed.connect(lambda v: widget.setValue(v * 100))
except AttributeError:
pass
jog.set_linear_speed.ok = jog.set_angular_speed.ok = lambda *a, **k: True
jog.set_linear_speed.bindOk = jog.set_angular_speed.bindOk = lambda *a, **k: True
jog.set_linear_speed_percentage.ok = lambda *a, **k: True
jog.set_linear_speed_percentage.bindOk = _jog_speed_slider_bindOk
def _jog_axis_ok(axis, direction=0, widget=None):
axisnum = getAxisNumber(axis)
if STAT.task_state == linuxcnc.STATE_ON \
and STAT.interp_state == linuxcnc.INTERP_IDLE \
and STAT.limit[axisnum] == 0:
# and STAT.homed[axisnum] == 1 \
ok = True
msg = ""
else:
ok = False
msg = "Machine must be ON and in IDLE to jog"
_jog_axis_ok.msg = msg