chiark / gitweb /
Fix pause support.
authordaid <daid303@gmail.com>
Thu, 6 Sep 2012 15:24:34 +0000 (17:24 +0200)
committerdaid <daid303@gmail.com>
Thu, 6 Sep 2012 15:24:34 +0000 (17:24 +0200)
Cura/gui/printWindow.py
Cura/util/machineCom.py

index 70e373a03611b70e624d04990a67faa92cc99f19..b0f46f39fdd1f7d67c0b01938a158284ec3d5508 100644 (file)
@@ -297,9 +297,9 @@ class printWindow(wx.Frame):
        def UpdateButtonStates(self):\r
                self.connectButton.Enable(self.machineCom == None or self.machineCom.isClosedOrError())\r
                #self.loadButton.Enable(self.printIdx == None)\r
-               self.printButton.Enable(self.machineCom != None and self.machineCom.isOperational() and not self.machineCom.isPrinting())\r
-               self.pauseButton.Enable(self.machineCom != None and self.machineCom.isPrinting())\r
-               self.cancelButton.Enable(self.machineCom != None and self.machineCom.isPrinting())\r
+               self.printButton.Enable(self.machineCom != None and self.machineCom.isOperational() and not (self.machineCom.isPrinting() or self.machineCome.isPaused()))\r
+               self.pauseButton.Enable(self.machineCom != None and (self.machineCom.isPrinting() or self.machineCome.isPaused()))\r
+               self.cancelButton.Enable(self.machineCom != None and (self.machineCom.isPrinting() or self.machineCome.isPaused()))\r
                self.temperatureSelect.Enable(self.machineCom != None and self.machineCom.isOperational())\r
                self.bedTemperatureSelect.Enable(self.machineCom != None and self.machineCom.isOperational())\r
                self.directControlPanel.Enable(self.machineCom != None and self.machineCom.isOperational())\r
@@ -481,8 +481,7 @@ class printWindow(wx.Frame):
                return True\r
 \r
        def mcLog(self, message):\r
-               #print message\r
-               pass\r
+               print message\r
        \r
        def mcTempUpdate(self, temp, bedTemp):\r
                self.temperatureGraph.addPoint(temp, self.temperatureSelect.GetValue(), bedTemp, self.bedTemperatureSelect.GetValue())\r
index dd19231c884c9e030afb7e029adc4e1e1d8b9d11..fd03fbdee6fb13e4d3c02b14aa7706ca66413995 100644 (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]