Skip to content

Commit 14456bc

Browse files
committed
qtvcp -action button: add no action option
supress am annoying warning message of no recognised action selected.
1 parent 007d053 commit 14456bc

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

lib/python/qtvcp/widgets/action_button.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@
4040
LOG = logger.getLogger(__name__)
4141

4242
# Force the log level for this module
43-
# LOG.setLevel(logger.INFO) # One of DEBUG, INFO, WARNING, ERROR, CRITICAL
43+
LOG.setLevel(logger.DEBUG) # One of DEBUG, INFO, WARNING, ERROR, CRITICAL
4444

4545
class ActionButton(IndicatedPushButton):
4646
def __init__(self, parent=None):
4747
super(ActionButton, self).__init__(parent)
4848
self._block_signal = False
4949
self._designer_block_signal = False
5050
self._designer_running = False
51+
self._no_action = False
5152
self.estop = False
5253
self.machine_on = False
5354
self.home = False
@@ -432,6 +433,8 @@ def spindle_control_test(e,d):
432433
STATUS.connect('all-homed', lambda w: self.setEnabled(True))
433434
STATUS.connect('interp-idle', lambda w: self.setEnabled(homed_on_test()))
434435
STATUS.connect('interp-run', lambda w: self.setEnabled(False))
436+
elif self._no_action:
437+
pass
435438

436439
# connect a signal and callback function to the button
437440
if self.isCheckable():
@@ -462,7 +465,9 @@ def view_check(self,data):
462465
def action(self, state=None):
463466
# don't do anything if the signal is blocked
464467
if self._block_signal: return
465-
if self.estop:
468+
if self._no_action:
469+
pass
470+
elif self.estop:
466471
if self.isCheckable():
467472
if STATUS.estop_is_clear():
468473
ACTION.SET_ESTOP_STATE(STATUS.STATE_ESTOP)
@@ -897,13 +902,22 @@ def _toggle_properties(self, picked):
897902
'launch_calibration',
898903
'exit', 'machine_log_dialog', 'zero_g5x', 'zero_g92', 'zero_zrot',
899904
'origin_offset_dialog', 'run_from_status', 'run_from_slot',
900-
'tool_chooser_dialog', 'lathe_mirror_x')
905+
'tool_chooser_dialog', 'lathe_mirror_x', 'no')
901906

902907
for i in data:
903908
if not i == picked:
904909
self[i+'_action'] = False
905910

906911
# BOOL VARIABLES----------------------
912+
def set_no_action(self, data):
913+
self._no_action = data
914+
if data:
915+
self._toggle_properties('no')
916+
def get_no_action(self):
917+
return self._no_action
918+
def reset_no_action(self):
919+
self._no_action = False
920+
907921
def set_estop(self, data):
908922
self.estop = data
909923
if data:
@@ -1539,6 +1553,7 @@ def reset_ini_mdi_key(self):
15391553

15401554
# designer will show these properties in this order:
15411555
# BOOL
1556+
no_action = QtCore.pyqtProperty(bool, get_no_action, set_no_action, reset_no_action)
15421557
estop_action = QtCore.pyqtProperty(bool, get_estop, set_estop, reset_estop)
15431558
machine_on_action = QtCore.pyqtProperty(bool, get_machine_on, set_machine_on, reset_machine_on)
15441559
auto_action = QtCore.pyqtProperty(bool, get_auto, set_auto, reset_auto)

0 commit comments

Comments
 (0)