Fix the print window resizing (no longer move the cancel button). Fix the reporting of the M115 reply, was seen as a temperature report.

master
daid303 2012-10-01 15:14:47 +02:00
parent 3bdba75b87
commit f6abc5c33a
2 changed files with 9 additions and 11 deletions

View File

@ -130,7 +130,7 @@ class printWindow(wx.Frame):
self.sizer.Add(self.pauseButton, pos=(3,1)) self.sizer.Add(self.pauseButton, pos=(3,1))
self.sizer.Add(self.cancelButton, pos=(4,1)) self.sizer.Add(self.cancelButton, pos=(4,1))
self.sizer.Add(self.machineLogButton, pos=(5,1)) self.sizer.Add(self.machineLogButton, pos=(5,1))
self.sizer.Add(self.progress, pos=(6,0), span=(1,2), flag=wx.EXPAND) self.sizer.Add(self.progress, pos=(6,0), span=(1,7), flag=wx.EXPAND)
nb = wx.Notebook(self.panel) nb = wx.Notebook(self.panel)
self.sizer.Add(nb, pos=(0,3), span=(6,4), flag=wx.EXPAND) self.sizer.Add(nb, pos=(0,3), span=(6,4), flag=wx.EXPAND)
@ -263,7 +263,7 @@ class printWindow(wx.Frame):
self.camPreview.timer.Start(500) self.camPreview.timer.Start(500)
self.camPreview.Bind(wx.EVT_ERASE_BACKGROUND, self.OnCameraEraseBackground) self.camPreview.Bind(wx.EVT_ERASE_BACKGROUND, self.OnCameraEraseBackground)
self.sizer.AddGrowableRow(3) self.sizer.AddGrowableRow(5)
self.sizer.AddGrowableCol(3) self.sizer.AddGrowableCol(3)
self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(wx.EVT_CLOSE, self.OnClose)
@ -622,6 +622,6 @@ class LogWindow(wx.Frame):
def __init__(self, logText): def __init__(self, logText):
super(LogWindow, self).__init__(None, title="Machine log") super(LogWindow, self).__init__(None, title="Machine log")
self.textBox = wx.TextCtrl(self, -1, logText, style=wx.TE_MULTILINE|wx.TE_DONTWRAP|wx.TE_READONLY) self.textBox = wx.TextCtrl(self, -1, logText, style=wx.TE_MULTILINE|wx.TE_DONTWRAP|wx.TE_READONLY)
self.SetSize((400,300)) self.SetSize((500,400))
self.Centre() self.Centre()
self.Show(True) self.Show(True)

View File

@ -280,10 +280,10 @@ class MachineCom(object):
line = line.rstrip() + self._readline() line = line.rstrip() + self._readline()
self._errorValue = line self._errorValue = line
self._changeState(self.STATE_ERROR) self._changeState(self.STATE_ERROR)
if 'T:' in line: if ' T:' in line:
self._temp = float(re.search("[0-9\.]*", line.split('T:')[1]).group(0)) self._temp = float(re.search("[0-9\.]*", line.split(' T:')[1]).group(0))
if 'B:' in line: if ' B:' in line:
self._bedTemp = float(re.search("[0-9\.]*", line.split('B:')[1]).group(0)) self._bedTemp = float(re.search("[0-9\.]*", line.split(' B:')[1]).group(0))
self._callback.mcTempUpdate(self._temp, self._bedTemp) self._callback.mcTempUpdate(self._temp, self._bedTemp)
elif line.strip() != 'ok': elif line.strip() != 'ok':
self._callback.mcMessage(line) self._callback.mcMessage(line)
@ -369,8 +369,7 @@ class MachineCom(object):
if ret == '': if ret == '':
#self._log("Recv: TIMEOUT") #self._log("Recv: TIMEOUT")
return '' return ''
if ret != 'ok\n': self._log("Recv: %s" % (unicode(ret, 'ascii', 'replace').encode('ascii', 'replace').rstrip()))
self._log("Recv: %s" % (unicode(ret, 'ascii', 'replace').encode('ascii', 'replace').rstrip()))
return ret return ret
def close(self, isError = False): def close(self, isError = False):
@ -388,8 +387,7 @@ class MachineCom(object):
def _sendCommand(self, cmd): def _sendCommand(self, cmd):
if self._serial == None: if self._serial == None:
return return
if not cmd.startswith('N'): self._log('Send: %s' % (cmd))
self._log('Send: %s' % (cmd))
try: try:
#TODO: This can throw a write timeout exception, but we do not want timeout on writes. Find a fix for this. #TODO: This can throw a write timeout exception, but we do not want timeout on writes. Find a fix for this.
# Oddly enough, the write timeout is not even set and thus we should not get a write timeout. # Oddly enough, the write timeout is not even set and thus we should not get a write timeout.