Improve the first run wizard with the communication error log, and add info buttons to the Ultimaker wiki when steps fail.
parent
57b585b851
commit
3d0e633983
|
@ -6,6 +6,7 @@ import wx.wizard
|
||||||
|
|
||||||
from gui import firmwareInstall
|
from gui import firmwareInstall
|
||||||
from gui import toolbarUtil
|
from gui import toolbarUtil
|
||||||
|
from gui import printWindow
|
||||||
from util import machineCom
|
from util import machineCom
|
||||||
from util import profile
|
from util import profile
|
||||||
|
|
||||||
|
@ -24,28 +25,40 @@ class InfoBox(wx.Panel):
|
||||||
|
|
||||||
self.bitmap = wx.StaticBitmap(self, -1, wx.EmptyBitmapRGBA(24, 24, red=255, green=255, blue=255, alpha=1))
|
self.bitmap = wx.StaticBitmap(self, -1, wx.EmptyBitmapRGBA(24, 24, red=255, green=255, blue=255, alpha=1))
|
||||||
self.text = wx.StaticText(self, -1, '')
|
self.text = wx.StaticText(self, -1, '')
|
||||||
|
self.extraInfoButton = wx.Button(self, -1, 'i', style=wx.BU_EXACTFIT)
|
||||||
self.sizer.Add(self.bitmap, pos=(0,0), flag=wx.ALL, border=5)
|
self.sizer.Add(self.bitmap, pos=(0,0), flag=wx.ALL, border=5)
|
||||||
self.sizer.Add(self.text, pos=(0,1), flag=wx.TOP|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL, border=5)
|
self.sizer.Add(self.text, pos=(0,1), flag=wx.TOP|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL, border=5)
|
||||||
|
self.sizer.Add(self.extraInfoButton, pos=(0,2), flag=wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, border=5)
|
||||||
|
self.sizer.AddGrowableCol(1)
|
||||||
|
|
||||||
|
self.extraInfoButton.Show(False)
|
||||||
|
|
||||||
|
self.extraInfoUrl = ''
|
||||||
self.busyState = None
|
self.busyState = None
|
||||||
self.timer = wx.Timer(self)
|
self.timer = wx.Timer(self)
|
||||||
self.Bind(wx.EVT_TIMER, self.doBusyUpdate, self.timer)
|
self.Bind(wx.EVT_TIMER, self.doBusyUpdate, self.timer)
|
||||||
|
self.Bind(wx.EVT_BUTTON, self.doExtraInfo, self.extraInfoButton)
|
||||||
self.timer.Start(100)
|
self.timer.Start(100)
|
||||||
|
|
||||||
def SetInfo(self, info):
|
def SetInfo(self, info):
|
||||||
self.SetBackgroundColour('#FFFF80')
|
self.SetBackgroundColour('#FFFF80')
|
||||||
self.text.SetLabel(info)
|
self.text.SetLabel(info)
|
||||||
|
self.extraInfoButton.Show(False)
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
def SetError(self, info):
|
def SetError(self, info, extraInfoUrl):
|
||||||
|
self.extraInfoUrl = extraInfoUrl
|
||||||
self.SetBackgroundColour('#FF8080')
|
self.SetBackgroundColour('#FF8080')
|
||||||
self.text.SetLabel(info)
|
self.text.SetLabel(info)
|
||||||
|
self.extraInfoButton.Show(True)
|
||||||
|
self.Layout()
|
||||||
self.SetErrorIndicator()
|
self.SetErrorIndicator()
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
def SetAttention(self, info):
|
def SetAttention(self, info):
|
||||||
self.SetBackgroundColour('#FFFF80')
|
self.SetBackgroundColour('#FFFF80')
|
||||||
self.text.SetLabel(info)
|
self.text.SetLabel(info)
|
||||||
|
self.extraInfoButton.Show(False)
|
||||||
self.SetAttentionIndicator()
|
self.SetAttentionIndicator()
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
|
@ -61,6 +74,9 @@ class InfoBox(wx.Panel):
|
||||||
self.busyState = 0
|
self.busyState = 0
|
||||||
self.bitmap.SetBitmap(self.busyBitmap[self.busyState])
|
self.bitmap.SetBitmap(self.busyBitmap[self.busyState])
|
||||||
|
|
||||||
|
def doExtraInfo(self, e):
|
||||||
|
webbrowser.open(self.extraInfoUrl)
|
||||||
|
|
||||||
def SetReadyIndicator(self):
|
def SetReadyIndicator(self):
|
||||||
self.busyState = None
|
self.busyState = None
|
||||||
self.bitmap.SetBitmap(self.readyBitmap)
|
self.bitmap.SetBitmap(self.readyBitmap)
|
||||||
|
@ -310,6 +326,8 @@ class UltimakerCheckupPage(InfoPage):
|
||||||
self.infoBox = self.AddInfoBox()
|
self.infoBox = self.AddInfoBox()
|
||||||
self.machineState = self.AddText('')
|
self.machineState = self.AddText('')
|
||||||
self.temperatureLabel = self.AddText('')
|
self.temperatureLabel = self.AddText('')
|
||||||
|
self.errorLogButton = self.AddButton('Show error log')
|
||||||
|
self.errorLogButton.Show(False)
|
||||||
self.AddSeperator()
|
self.AddSeperator()
|
||||||
self.endstopBitmap = self.AddBitmap(self.endStopNoneBitmap)
|
self.endstopBitmap = self.AddBitmap(self.endStopNoneBitmap)
|
||||||
self.comm = None
|
self.comm = None
|
||||||
|
@ -319,6 +337,8 @@ class UltimakerCheckupPage(InfoPage):
|
||||||
self.yMaxStop = False
|
self.yMaxStop = False
|
||||||
self.zMinStop = False
|
self.zMinStop = False
|
||||||
self.zMaxStop = False
|
self.zMaxStop = False
|
||||||
|
|
||||||
|
self.Bind(wx.EVT_BUTTON, self.OnErrorLog, self.errorLogButton)
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self.comm != None:
|
if self.comm != None:
|
||||||
|
@ -332,6 +352,7 @@ class UltimakerCheckupPage(InfoPage):
|
||||||
self.GetParent().FindWindowById(wx.ID_FORWARD).Enable()
|
self.GetParent().FindWindowById(wx.ID_FORWARD).Enable()
|
||||||
|
|
||||||
def OnCheckClick(self, e = None):
|
def OnCheckClick(self, e = None):
|
||||||
|
self.errorLogButton.Show(False)
|
||||||
if self.comm != None:
|
if self.comm != None:
|
||||||
self.comm.close()
|
self.comm.close()
|
||||||
del self.comm
|
del self.comm
|
||||||
|
@ -345,6 +366,9 @@ class UltimakerCheckupPage(InfoPage):
|
||||||
self.stopState.SetBitmap(self.unknownBitmap)
|
self.stopState.SetBitmap(self.unknownBitmap)
|
||||||
self.checkupState = 0
|
self.checkupState = 0
|
||||||
self.comm = machineCom.MachineCom(callbackObject=self)
|
self.comm = machineCom.MachineCom(callbackObject=self)
|
||||||
|
|
||||||
|
def OnErrorLog(self, e):
|
||||||
|
printWindow.LogWindow('\n'.join(self.comm.getLog()))
|
||||||
|
|
||||||
def mcLog(self, message):
|
def mcLog(self, message):
|
||||||
pass
|
pass
|
||||||
|
@ -388,7 +412,7 @@ class UltimakerCheckupPage(InfoPage):
|
||||||
if self.tempCheckTimeout < 1:
|
if self.tempCheckTimeout < 1:
|
||||||
self.checkupState = -1
|
self.checkupState = -1
|
||||||
wx.CallAfter(self.tempState.SetBitmap, self.crossBitmap)
|
wx.CallAfter(self.tempState.SetBitmap, self.crossBitmap)
|
||||||
wx.CallAfter(self.infoBox.SetError, 'Temperature measurement FAILED!')
|
wx.CallAfter(self.infoBox.SetError, 'Temperature measurement FAILED!', 'http://wiki.ultimaker.com/Cura/Temperature_measurement_problems')
|
||||||
self.comm.sendCommand('M104 S0')
|
self.comm.sendCommand('M104 S0')
|
||||||
self.comm.sendCommand('M104 S0')
|
self.comm.sendCommand('M104 S0')
|
||||||
wx.CallAfter(self.temperatureLabel.SetLabel, 'Head temperature: %d' % (temp))
|
wx.CallAfter(self.temperatureLabel.SetLabel, 'Head temperature: %d' % (temp))
|
||||||
|
@ -398,11 +422,16 @@ class UltimakerCheckupPage(InfoPage):
|
||||||
return
|
return
|
||||||
if self.comm.isOperational():
|
if self.comm.isOperational():
|
||||||
wx.CallAfter(self.commState.SetBitmap, self.checkBitmap)
|
wx.CallAfter(self.commState.SetBitmap, self.checkBitmap)
|
||||||
|
wx.CallAfter(self.machineState.SetLabel, 'Communication State: %s' % (self.comm.getStateString()))
|
||||||
elif self.comm.isError():
|
elif self.comm.isError():
|
||||||
wx.CallAfter(self.commState.SetBitmap, self.crossBitmap)
|
wx.CallAfter(self.commState.SetBitmap, self.crossBitmap)
|
||||||
wx.CallAfter(self.infoBox.SetError, 'Failed to establish connection with the printer.')
|
wx.CallAfter(self.infoBox.SetError, 'Failed to establish connection with the printer.', 'http://wiki.ultimaker.com/Cura/Connection_problems')
|
||||||
wx.CallAfter(self.endstopBitmap.Show, False)
|
wx.CallAfter(self.endstopBitmap.Show, False)
|
||||||
wx.CallAfter(self.machineState.SetLabel, 'Communication State: %s' % (self.comm.getStateString()))
|
wx.CallAfter(self.machineState.SetLabel, '%s' % (self.comm.getErrorString()))
|
||||||
|
wx.CallAfter(self.errorLogButton.Show, True)
|
||||||
|
wx.CallAfter(self.Layout)
|
||||||
|
else:
|
||||||
|
wx.CallAfter(self.machineState.SetLabel, 'Communication State: %s' % (self.comm.getStateString()))
|
||||||
|
|
||||||
def mcMessage(self, message):
|
def mcMessage(self, message):
|
||||||
if self.checkupState >= 3 and self.checkupState < 10 and 'x_min' in message:
|
if self.checkupState >= 3 and self.checkupState < 10 and 'x_min' in message:
|
||||||
|
|
|
@ -207,6 +207,9 @@ class MachineCom(object):
|
||||||
if len(self._errorValue) < 20:
|
if len(self._errorValue) < 20:
|
||||||
return self._errorValue
|
return self._errorValue
|
||||||
return self._errorValue[:20] + "..."
|
return self._errorValue[:20] + "..."
|
||||||
|
|
||||||
|
def getErrorString(self):
|
||||||
|
return self._errorValue
|
||||||
|
|
||||||
def isClosedOrError(self):
|
def isClosedOrError(self):
|
||||||
return self._state == self.STATE_ERROR or self._state == self.STATE_CLOSED_WITH_ERROR or self._state == self.STATE_CLOSED
|
return self._state == self.STATE_ERROR or self._state == self.STATE_CLOSED_WITH_ERROR or self._state == self.STATE_CLOSED
|
||||||
|
|
Loading…
Reference in New Issue