Fix pause support.

master
daid 2012-09-06 17:24:34 +02:00
parent 1f4835b97e
commit 68f1353e60
2 changed files with 20 additions and 10 deletions

View File

@ -297,9 +297,9 @@ class printWindow(wx.Frame):
def UpdateButtonStates(self):
self.connectButton.Enable(self.machineCom == None or self.machineCom.isClosedOrError())
#self.loadButton.Enable(self.printIdx == None)
self.printButton.Enable(self.machineCom != None and self.machineCom.isOperational() and not self.machineCom.isPrinting())
self.pauseButton.Enable(self.machineCom != None and self.machineCom.isPrinting())
self.cancelButton.Enable(self.machineCom != None and self.machineCom.isPrinting())
self.printButton.Enable(self.machineCom != None and self.machineCom.isOperational() and not (self.machineCom.isPrinting() or self.machineCome.isPaused()))
self.pauseButton.Enable(self.machineCom != None and (self.machineCom.isPrinting() or self.machineCome.isPaused()))
self.cancelButton.Enable(self.machineCom != None and (self.machineCom.isPrinting() or self.machineCome.isPaused()))
self.temperatureSelect.Enable(self.machineCom != None and self.machineCom.isOperational())
self.bedTemperatureSelect.Enable(self.machineCom != None and self.machineCom.isOperational())
self.directControlPanel.Enable(self.machineCom != None and self.machineCom.isOperational())
@ -481,8 +481,7 @@ class printWindow(wx.Frame):
return True
def mcLog(self, message):
#print message
pass
print message
def mcTempUpdate(self, temp, bedTemp):
self.temperatureGraph.addPoint(temp, self.temperatureSelect.GetValue(), bedTemp, self.bedTemperatureSelect.GetValue())

View File

@ -107,9 +107,10 @@ class MachineCom(object):
STATE_CONNECTING = 2
STATE_OPERATIONAL = 3
STATE_PRINTING = 4
STATE_CLOSED = 5
STATE_ERROR = 6
STATE_CLOSED_WITH_ERROR = 7
STATE_PAUSED = 5
STATE_CLOSED = 6
STATE_ERROR = 7
STATE_CLOSED_WITH_ERROR = 8
def __init__(self, port = None, baudrate = None, callbackObject = None):
if port == None:
@ -191,6 +192,8 @@ class MachineCom(object):
return "Operational"
if self._state == self.STATE_PRINTING:
return "Printing"
if self._state == self.STATE_PAUSED:
return "Paused"
if self._state == self.STATE_CLOSED:
return "Closed"
if self._state == self.STATE_ERROR:
@ -203,7 +206,7 @@ class MachineCom(object):
return self._state == self.STATE_ERROR or self._state == self.STATE_CLOSED_WITH_ERROR or self._state == self.STATE_CLOSED
def isOperational(self):
return self._state == self.STATE_OPERATIONAL or self._state == self.STATE_PRINTING
return self._state == self.STATE_OPERATIONAL or self._state == self.STATE_PRINTING or self._state == self.STATE_PAUSED
def isPrinting(self):
return self._state == self.STATE_PRINTING
@ -212,7 +215,7 @@ class MachineCom(object):
return self._gcodePos
def isPaused(self):
return False
return self._state == self.STATE_PAUSED
def getTemp(self):
return self._temp
@ -376,6 +379,14 @@ class MachineCom(object):
def cancelPrint(self):
if self.isOperational():
self._changeState(self.STATE_OPERATIONAL)
def setPause(self, pause):
if not pause and self.isPaused():
self._changeState(self.STATE_PRINTING)
for i in xrange(0, 6):
self._sendNext()
if pause and self.isPrinting():
self._changeState(self.STATE_PAUSED)
def getExceptionString():
locationInfo = traceback.extract_tb(sys.exc_info()[2])[0]