def handle_response(self, idx, txt):
root = self.comtree.invisibleRootItem()
item = root.child(idx)
item.setText(0, time.strftime("%Y.%m.%d. %H:%M:%S", time.localtime()))
if not txt:
txt = 'ok'
item.setText(2, txt)
item.setCheckState(0, Qt.Checked)
self.comtree.scrollToItem(item)
cmd = item.text(1)
proc_events()
if 'G0' in cmd or 'G1' in cmd:
x, y, z = parse.xyz(cmd[2:])
# should probably emit signals
self.current_x = x
self.current_y = y
self.current_z = z
if 'G38.2' in cmd:
try:
# e.g. Probe not tripped from LinuxCNC
# (we get error message from backend)
if 'error' in txt:
z = -999.0
else:
z = parse.probe(txt)
except:
self.err('Unable to parse probe: {}'.format(txt))
self.err('Is your flavor ({}) correct?'.format(self.flavor))
z = -999.0
self.gl.result.data.append((self.current_x, self.current_y, z))
self.update_result()
self['probe result.lowest'] = min(self['probe result.lowest'], z)
self['probe result.highest'] = max(self['probe result.highest'], z)
self['probe result.last'] = z
评论列表
文章目录