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)
self.lastUpdateTime = t
if extraInfo is not None:
- self._addTermLog(extraInfo)
+ self._addTermLog('<%s\n' % (extraInfo))
self.UpdateButtonStates()
if connection.isPrinting():
sys.stdout.write('changeZ:%d\n' % (newZ))
def monitorStdin(self):
-
while not self._comm.isClosed():
line = sys.stdin.readline().strip()
line = line.split(':', 1)
__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
#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
self._temperature = []
- self._lineCount = 0
self._commState = None
self._commStateString = None
self._gcodeData = []
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):
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)
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()