chiark / gitweb /
For now prevent UltiGCode from using connectionManager.
authordaid <daid303@gmail.com>
Mon, 3 Feb 2014 15:25:46 +0000 (16:25 +0100)
committerdaid <daid303@gmail.com>
Mon, 3 Feb 2014 15:25:46 +0000 (16:25 +0100)
Cura/gui/printWindow2.py
Cura/serialCommunication.py
Cura/util/printerConnection/printerConnectionManager.py
Cura/util/printerConnection/serialConnection.py

index d421a1bbd396290c9ba3271184aa98743956318f..de51e3fdc250043466339d6ea164d4debd7cb22e 100644 (file)
@@ -250,7 +250,7 @@ class printWindow(wx.Frame):
                if len(self.termLog.GetValue()) > 10000:
                        self.termLog.SetValue(self.termLog.GetValue()[-10000:])
                self.termLog.SetInsertionPointEnd()
-               self.termLog.AppendText(line.encode('utf-8', 'replace'))
+               self.termLog.AppendText(unicode(line, 'utf-8', 'replace').encode('utf-8', 'replace'))
 
        def _doPrinterConnectionUpdate(self, connection, extraInfo = None):
                wx.CallAfter(self.__doPrinterConnectionUpdate, connection, extraInfo)
@@ -264,7 +264,7 @@ class printWindow(wx.Frame):
                self.lastUpdateTime = t
 
                if extraInfo is not None:
-                       self._addTermLog(extraInfo)
+                       self._addTermLog('<%s\n' % (extraInfo))
 
                self.UpdateButtonStates()
                if connection.isPrinting():
index 4a90d2582c6f717fdddc146836b2b8d34ea99609..6a8b1a0501370f50f25e1976dd21383bf3c5715f 100644 (file)
@@ -38,7 +38,6 @@ class serialComm(object):
                sys.stdout.write('changeZ:%d\n' % (newZ))
 
        def monitorStdin(self):
-
                while not self._comm.isClosed():
                        line = sys.stdin.readline().strip()
                        line = line.split(':', 1)
index 0e00c2cb1f7f7cc01642acf7e11c20fcc7758dd3..c1dd2081ff43936b356fa6c67ae39aef2e5fe419 100644 (file)
@@ -1,5 +1,6 @@
 __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
 
+from Cura.util import profile
 from Cura.util import version
 from Cura.util.printerConnection import dummyConnection
 from Cura.util.printerConnection import serialConnection
@@ -18,6 +19,8 @@ class PrinterConnectionManager(object):
 
        #Return the highest priority available connection.
        def getAvailableGroup(self):
+               if profile.getMachineSetting('gcode_flavor') == 'UltiGCode':
+                       return None
                for g in self._groupList:
                        if len(g.getAvailableConnections()) > 0:
                                return g
index 45360d3d165fe849af94fbd1f18d23329086f13e..f19dbc23f1d47fe7f6fcc6c04b2afeb5d5c502ce 100644 (file)
@@ -42,7 +42,6 @@ class serialConnection(printerConnectionBase.printerConnectionBase):
 
                self._temperature = []
 
-               self._lineCount = 0
                self._commState = None
                self._commStateString = None
                self._gcodeData = []
@@ -72,19 +71,23 @@ class serialConnection(printerConnectionBase.printerConnectionBase):
                for line in self._gcodeData:
                        self._process.stdin.write('G:%s\n' % (line))
                self._process.stdin.write('START\n')
+               self._printProgress = 0
 
        #Abort the previously loaded print file
        def cancelPrint(self):
-               pass
+               if not self.isPrinting()or self._process is None:
+                       return
+               self._process.stdin.write('STOP\n')
+               self._printProgress = 0
 
        def isPrinting(self):
                return self._commState == machineCom.MachineCom.STATE_PRINTING
 
        #Amount of progression of the current print file. 0.0 to 1.0
        def getPrintProgress(self):
-               if self._lineCount < 1:
+               if len(self._gcodeData) < 1:
                        return 0.0
-               return float(self._progressLine) / float(self._lineCount)
+               return float(self._printProgress) / float(len(self._gcodeData))
 
        # Return if the printer with this connection type is available
        def isAvailable(self):
@@ -137,7 +140,9 @@ class serialConnection(printerConnectionBase.printerConnectionBase):
                while len(line) > 0:
                        line = line.strip()
                        line = line.split(':', 1)
-                       if line[0] == 'log':
+                       if line[0] == '':
+                               pass
+                       elif line[0] == 'log':
                                pass
                        elif line[0] == 'temp':
                                line = line[1].split(':', 1)
@@ -150,6 +155,9 @@ class serialConnection(printerConnectionBase.printerConnectionBase):
                                self._commState = int(line[0])
                                self._commStateString = line[1]
                                self._doCallback()
+                       elif line[0] == 'progress':
+                               self._printProgress = int(line[1])
+                               self._doCallback()
                        else:
                                print line
                        line = self._process.stdout.readline()