def CALL_OWORD(self, code, time=5 ): log.debug('OWORD_COMMAND= {}'.format(code)) self.ensure_mode(labvcnc.MODE_MDI) self.cmd.mdi(code) STATUS.stat.poll() while STATUS.stat.exec_state == labvcnc.EXEC_WAITING_FOR_MOTION_AND_IO or \ STATUS.stat.exec_state == labvcnc.EXEC_WAITING_FOR_MOTION: result = self.cmd.wait_complete(time) if result == -1: log.error('Oword timeout oast () Error = # {}'.format(time, result)) self.ABORT() return -1 elif result == labvcnc.RCS_ERROR: log.error('Oword RCS Error = # {}'.format(result)) return -1 result = labvcnc.error_channel().poll() if result: STATUS.emit('error',result[0],result[1]) log.error('Oword Error: {}'.format(result[1])) return -1 STATUS.stat.poll() result = self.cmd.wait_complete(time) if result == -1 or result == labvcnc.RCS_ERROR or labvcnc.error_channel().poll(): log.error('Oword RCS Error = # {}'.format(result)) return -1 result = labvcnc.error_channel().poll() if result: STATUS.emit('error',result[0],result[1]) log.error('Oword Error: {}'.format(result[1])) return -1 log.debug('OWORD_COMMAND returns complete : {}'.format(result)) return 0
def __init__(self, halcomp, widgets, paths): self.hal = halcomp self.w = widgets self.stat = labvcnc.stat() self.cmnd = labvcnc.command() self.error = labvcnc.error_channel() self.PATH = paths.CONFIGPATH self.IMAGE_PATH = paths.IMAGEDIR self.STYLE = Styles(widgets, paths)
def __init__(self, parent=None): super(ScreenOptions, self).__init__(parent) self.error = labvcnc.error_channel() self.catch_errors = True self.desktop_notify = True self.close_event = True self.play_sounds = True self.mchnMsg_play_sound = True self.usrMsg_play_sound = True self.usrMsg_sound_type = 'READY' self.usrMsg_use_FocusOverlay = True self.play_shutdown_sounds = True self.notify_start_title = 'Welcome' self.notify_start_detail = '' self.notify_start_timeout = 5 self.shutdown_msg_title = 'Do you want to Shutdown now?' self.shutdown_msg_detail = '' self.user_messages = True self.use_pref_file = True self.process_tabs = True self.add_message_dialog = True self.add_close_dialog = True self.add_entry_dialog = False self.add_tool_dialog = False self.add_file_dialog = False self.add_focus_overlay = False self.add_versaprobe_dialog = False self.add_macrotab_dialog = False self.add_camview_dialog = False self.add_originoffset_dialog = False self.add_tooloffset_dialog = False self.add_calculator_dialog = False self.add_machinelog_dialog = False self.pref_filename = '~/.qtvcp_screen_preferences' self._default_tab_name = '' self._close_color = QtGui.QColor(100, 0, 0, 150) self._messageDialogColor = QtGui.QColor(0, 0, 0, 150) self._closeDialogColor = QtGui.QColor(0, 0, 0, 150) self._entryDialogSoftkey = True self._entryDialogColor = QtGui.QColor(0, 0, 0, 150) self._toolDialogColor = QtGui.QColor(100, 0, 0, 150) self._fileDialogColor = QtGui.QColor(0, 0, 100, 150) self._versaProbeDialogColor = QtGui.QColor(0, 0, 0, 150) self._macroTabDialogColor = QtGui.QColor(0, 0, 0, 150) self._camViewDialogColor = QtGui.QColor(0, 0, 0, 150) self._originOffsetDialogColor = QtGui.QColor(0, 0, 0, 150) self._toolOffsetDialogColor = QtGui.QColor(0, 0, 0, 150) self._calculatorDialogColor = QtGui.QColor(0, 0, 0, 150) self._machineLogDialogColor = QtGui.QColor(0, 0, 0, 150)
def __init__(self, command=None, status=None, error=None): """init docs""" self.command = command self.status = status self.error = error if not self.command: self.command = labvcnc.command() if not self.status: self.status = labvcnc.stat() if not self.error: self.error = labvcnc.error_channel()
def __init__(self, halcomp, widgets, paths): self.hal = halcomp self.w = widgets self.stat = labvcnc.stat() self.cmnd = labvcnc.command() self.error = labvcnc.error_channel() self.jog_velocity = 10.0 self.PATH = paths.CONFIGPATH self.IMAGE_PATH = paths.IMAGEDIR #print paths.CONFIGPATH # connect to GStat to catch labvcnc events STATUS.connect('state-estop', self.say_estop) STATUS.connect('state-on', self.on_state_on) STATUS.connect('state-off', self.on_state_off) STATUS.connect('jograte-changed', self.on_jograte_changed) STATUS.connect('periodic', self.on_periodic) # Read user preferences self.desktop_notify = PREFS.getpref('desktop_notify', True, bool) self.shutdown_check = PREFS.getpref('shutdown_check', True, bool)
def CALL_MDI_WAIT(self, code, time = 5): log.debug('MDI_WAIT_COMMAND= {}, maxt = {}'.format(code, time)) self.ensure_mode(labvcnc.MODE_MDI) for l in code.split("\n"): log.debug('MDI_COMMAND: {}'.format(l)) self.cmd.mdi( l ) result = self.cmd.wait_complete(time) if result == -1: log.debug('MDI_COMMAND_WAIT timeout past {} sec. Error: {}'.format( time, result)) #STATUS.emit('MDI time out error',) self.ABORT() return -1 elif result == labvcnc.RCS_ERROR: log.debug('MDI_COMMAND_WAIT RCS error: {}'.format( time, result)) #STATUS.emit('MDI time out error',) return -1 result = labvcnc.error_channel().poll() if result: STATUS.emit('error',result[0],result[1]) log.error('MDI_COMMAND_WAIT Error channel: {}'.format(result[1])) return -1 return 0
# # set up pins # shell out to halcmd to net our pins to where they need to go # h = hal.component("python-ui") h.ready() # # connect to LabvCNC # c = labvcnc.command() s = labvcnc.stat() e = labvcnc.error_channel() l = labvcnc_util.LabvCNC(command=c, status=s, error=e) c.state(labvcnc.STATE_ESTOP_RESET) c.state(labvcnc.STATE_ON) c.home(0) c.home(1) c.home(2) l.wait_for_home([1, 1, 1, 0, 0, 0, 0, 0, 0]) c.mode(labvcnc.MODE_MDI) c.mdi("O<obug> call [0]") c.wait_complete()
def __init__(self, timeout=2): self.c = labvcnc.command() self.e = labvcnc.error_channel() self.s = labvcnc.stat() self.timeout = timeout