Code:
def dialog_return(self, w, message):
rtn = message.get('RETURN')
name = message.get('NAME')
plate_code = bool(message.get('ID') == '_touchplate_')
sensor_code = bool(message.get('ID') == '_toolsensor_')
wait_code = bool(message.get('ID') == '_wait_resume_')
lower_code = bool(message.get('ID') == '_wait_to_lower_')
unhome_code = bool(message.get('ID') == '_unhome_')
overwrite = bool(message.get('ID') == '_overwrite_')
if plate_code and name == 'MESSAGE' and rtn is True:
self.touchoff('touchplate')
elif sensor_code and name == 'MESSAGE' and rtn is True:
self.touchoff('sensor')
elif wait_code and name == 'MESSAGE':
self.lowerSpindle()
elif unhome_code and name == 'MESSAGE' and rtn is True:
ACTION.SET_MACHINE_UNHOMED(-1)
elif overwrite and name == 'MESSAGE':
if rtn is True:
self.do_file_copy()
else:
self.add_status(_translate("HandlerClass","File not copied"), CRITICAL)
elif lower_code and name == 'MESSAGE':
self.h['eoffset-spindle-count'] = 0
self.h['spindle-inhibit'] = False # add this line <------
self.add_status(_translate("HandlerClass",'Spindle lowered after machine stopped'))