From: daid Date: Mon, 10 Feb 2014 12:34:13 +0000 (+0100) Subject: Add minimized print window. X-Git-Tag: 14.02-RC1~20 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=8f5f18f3a3372afab99aaf973541128f4ef6cc56;p=cura.git Add minimized print window. --- diff --git a/Cura/cura.py b/Cura/cura.py index a8b22ef5..36e487b2 100644 --- a/Cura/cura.py +++ b/Cura/cura.py @@ -24,9 +24,16 @@ def main(): help="Slice the given files instead of opening them in Cura") parser.add_option("-o", "--output", action="store", type="string", dest="output", help="path to write sliced file to") + parser.add_option("--serialCommunication", action="store", type="string", dest="serialCommunication", + help="Start commandline serial monitor") (options, args) = parser.parse_args() + if options.serialCommunication: + from Cura import serialCommunication + serialCommunication.startMonitor(options.serialCommunication) + return + print "load preferences from " + profile.getPreferencePath() profile.loadPreferences(profile.getPreferencePath()) diff --git a/Cura/gui/printWindow2.py b/Cura/gui/printWindow2.py index 57c62284..d6ab2955 100644 --- a/Cura/gui/printWindow2.py +++ b/Cura/gui/printWindow2.py @@ -12,10 +12,10 @@ from Cura.util import resources class printWindow(wx.Frame): "Main user interface window" - def __init__(self, printerConnection): - super(printWindow, self).__init__(None, -1, title=_("Printing")) + def __init__(self, parent, printerConnection): + super(printWindow, self).__init__(parent, -1, style=wx.CLOSE_BOX|wx.CLIP_CHILDREN|wx.CAPTION|wx.SYSTEM_MENU|wx.FRAME_TOOL_WINDOW|wx.FRAME_FLOAT_ON_PARENT, title=_("Printing on %s") % (printerConnection.getName())) self._printerConnection = printerConnection - self.lastUpdateTime = 0 + self._lastUpdateTime = 0 self.SetSizer(wx.BoxSizer()) self.panel = wx.Panel(self) @@ -23,26 +23,21 @@ class printWindow(wx.Frame): self.sizer = wx.GridBagSizer(2, 2) self.panel.SetSizer(self.sizer) - sb = wx.StaticBox(self.panel, label=_("Info")) - boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) - self.powerWarningText = wx.StaticText(parent=self.panel, id=-1, label=_("Your computer is running on battery power.\nConnect your computer to AC power or your print might not finish."), style=wx.ALIGN_CENTER) self.powerWarningText.SetBackgroundColour('red') self.powerWarningText.SetForegroundColour('white') - boxsizer.AddF(self.powerWarningText, flags=wx.SizerFlags().Expand().Border(wx.BOTTOM, 10)) + self.sizer.Add(self.powerWarningText, pos=(0, 0), span=(1, 5), flag=wx.EXPAND|wx.BOTTOM, border=5) self.powerManagement = power.PowerManagement() self.powerWarningTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnPowerWarningChange, self.powerWarningTimer) self.OnPowerWarningChange(None) self.powerWarningTimer.Start(10000) - self.statsText = wx.StaticText(self.panel, -1, _("Filament: ####.##m #.##g\nEstimated print time: #####:##\nMachine state:\nDetecting baudrateXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")) - boxsizer.Add(self.statsText, flag=wx.LEFT, border=5) - - self.sizer.Add(boxsizer, pos=(0, 0), span=(7, 1), flag=wx.EXPAND) + self.statsText = wx.StaticText(self.panel, -1, _("InfoLine from printer connection\nInfoLine from dialog")) + self.sizer.Add(self.statsText, pos=(1, 0), span=(1, 5), flag=wx.LEFT, border=5) self.connectButton = wx.Button(self.panel, -1, _("Connect")) #self.loadButton = wx.Button(self.panel, -1, 'Load') @@ -52,103 +47,13 @@ class printWindow(wx.Frame): self.errorLogButton = wx.Button(self.panel, -1, _("Error log")) self.progress = wx.Gauge(self.panel, -1, range=1000) - self.sizer.Add(self.connectButton, pos=(1, 1), flag=wx.EXPAND) - #self.sizer.Add(self.loadButton, pos=(1,1), flag=wx.EXPAND) - self.sizer.Add(self.printButton, pos=(2, 1), flag=wx.EXPAND) - self.sizer.Add(self.pauseButton, pos=(3, 1), flag=wx.EXPAND) - self.sizer.Add(self.cancelButton, pos=(4, 1), flag=wx.EXPAND) - self.sizer.Add(self.errorLogButton, pos=(5, 1), flag=wx.EXPAND) - self.sizer.Add(self.progress, pos=(7, 0), span=(1, 7), flag=wx.EXPAND) - - nb = wx.Notebook(self.panel) - self.tabs = nb - self.sizer.Add(nb, pos=(0, 2), span=(7, 4), flag=wx.EXPAND) - - self.temperaturePanel = wx.Panel(nb) - sizer = wx.GridBagSizer(2, 2) - self.temperaturePanel.SetSizer(sizer) - - self.temperatureSelect = wx.SpinCtrl(self.temperaturePanel, -1, '0', size=(21 * 3, 21), style=wx.SP_ARROW_KEYS) - self.temperatureSelect.SetRange(0, 400) - self.temperatureHeatUp = wx.Button(self.temperaturePanel, -1, str(int(profile.getProfileSettingFloat('print_temperature'))) + 'C') - self.bedTemperatureLabel = wx.StaticText(self.temperaturePanel, -1, _("BedTemp:")) - self.bedTemperatureSelect = wx.SpinCtrl(self.temperaturePanel, -1, '0', size=(21 * 3, 21), style=wx.SP_ARROW_KEYS) - self.bedTemperatureSelect.SetRange(0, 400) - self.bedTemperatureLabel.Show(False) - self.bedTemperatureSelect.Show(False) - - self.temperatureGraph = TemperatureGraph(self.temperaturePanel) - - sizer.Add(wx.StaticText(self.temperaturePanel, -1, _("Temp:")), pos=(0, 0)) - sizer.Add(self.temperatureSelect, pos=(0, 1)) - sizer.Add(self.temperatureHeatUp, pos=(0, 2)) - sizer.Add(self.bedTemperatureLabel, pos=(1, 0)) - sizer.Add(self.bedTemperatureSelect, pos=(1, 1)) - sizer.Add(self.temperatureGraph, pos=(2, 0), span=(1, 3), flag=wx.EXPAND) - sizer.AddGrowableRow(2) - sizer.AddGrowableCol(2) - - nb.AddPage(self.temperaturePanel, 'Temp') - - self.directControlPanel = wx.Panel(nb) - - sizer = wx.GridBagSizer(2, 2) - self.directControlPanel.SetSizer(sizer) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y100 F6000', 'G90'], 'print-move-y100.png'), pos=(0, 3)) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y10 F6000', 'G90'], 'print-move-y10.png'), pos=(1, 3)) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y1 F6000', 'G90'], 'print-move-y1.png'), pos=(2, 3)) - - sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y-1 F6000', 'G90'], 'print-move-y-1.png'), pos=(4, 3)) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y-10 F6000', 'G90'], 'print-move-y-10.png'), pos=(5, 3)) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y-100 F6000', 'G90'], 'print-move-y-100.png'), pos=(6, 3)) - - sizer.Add(PrintCommandButton(self, ['G91', 'G1 X-100 F6000', 'G90'], 'print-move-x-100.png'), pos=(3, 0)) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 X-10 F6000', 'G90'], 'print-move-x-10.png'), pos=(3, 1)) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 X-1 F6000', 'G90'], 'print-move-x-1.png'), pos=(3, 2)) - - sizer.Add(PrintCommandButton(self, ['G28 X0 Y0'], 'print-move-home.png'), pos=(3, 3)) - - sizer.Add(PrintCommandButton(self, ['G91', 'G1 X1 F6000', 'G90'], 'print-move-x1.png'), pos=(3, 4)) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 X10 F6000', 'G90'], 'print-move-x10.png'), pos=(3, 5)) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 X100 F6000', 'G90'], 'print-move-x100.png'), pos=(3, 6)) - - sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z10 F200', 'G90'], 'print-move-z10.png'), pos=(0, 8)) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z1 F200', 'G90'], 'print-move-z1.png'), pos=(1, 8)) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z0.1 F200', 'G90'], 'print-move-z0.1.png'), pos=(2, 8)) - - sizer.Add(PrintCommandButton(self, ['G28 Z0'], 'print-move-home.png'), pos=(3, 8)) - - sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z-0.1 F200', 'G90'], 'print-move-z-0.1.png'), pos=(4, 8)) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z-1 F200', 'G90'], 'print-move-z-1.png'), pos=(5, 8)) - sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z-10 F200', 'G90'], 'print-move-z-10.png'), pos=(6, 8)) - - sizer.Add(PrintCommandButton(self, ['G92 E0', 'G1 E2 F120'], 'extrude.png', size=(60, 20)), pos=(1, 10), span=(1, 3), flag=wx.EXPAND) - sizer.Add(PrintCommandButton(self, ['G92 E0', 'G1 E-2 F120'], 'retract.png', size=(60, 20)), pos=(2, 10), span=(1, 3), flag=wx.EXPAND) - - nb.AddPage(self.directControlPanel, _("Jog")) - - self.termPanel = wx.Panel(nb) - sizer = wx.GridBagSizer(2, 2) - self.termPanel.SetSizer(sizer) - - f = wx.Font(8, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False) - self.termLog = wx.TextCtrl(self.termPanel, style=wx.TE_MULTILINE | wx.TE_DONTWRAP) - self.termLog.SetFont(f) - self.termLog.SetEditable(0) - self.termInput = wx.TextCtrl(self.termPanel, style=wx.TE_PROCESS_ENTER) - self.termInput.SetFont(f) - self._termHistory = [] - self._termHistoryIdx = 0 - - sizer.Add(self.termLog, pos=(0, 0), flag=wx.EXPAND) - sizer.Add(self.termInput, pos=(1, 0), flag=wx.EXPAND) - sizer.AddGrowableCol(0) - sizer.AddGrowableRow(0) - - nb.AddPage(self.termPanel, _("Term")) - - self.sizer.AddGrowableRow(6) - self.sizer.AddGrowableCol(3) + self.sizer.Add(self.connectButton, pos=(2, 0)) + #self.sizer.Add(self.loadButton, pos=(2,1)) + self.sizer.Add(self.printButton, pos=(2, 1)) + self.sizer.Add(self.pauseButton, pos=(2, 2)) + self.sizer.Add(self.cancelButton, pos=(2, 3)) + self.sizer.Add(self.errorLogButton, pos=(2, 4)) + self.sizer.Add(self.progress, pos=(3, 0), span=(1, 5), flag=wx.EXPAND) self.Bind(wx.EVT_CLOSE, self.OnClose) self.connectButton.Bind(wx.EVT_BUTTON, self.OnConnect) @@ -158,21 +63,13 @@ class printWindow(wx.Frame): self.cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel) self.errorLogButton.Bind(wx.EVT_BUTTON, self.OnErrorLog) - self.Bind(wx.EVT_BUTTON, lambda e: (self.temperatureSelect.SetValue(int(profile.getProfileSettingFloat('print_temperature'))), self.machineCom.sendCommand("M104 S%d" % (int(profile.getProfileSettingFloat('print_temperature'))))), self.temperatureHeatUp) - self.Bind(wx.EVT_SPINCTRL, self.OnTempChange, self.temperatureSelect) - self.Bind(wx.EVT_SPINCTRL, self.OnBedTempChange, self.bedTemperatureSelect) - - self.Bind(wx.EVT_TEXT_ENTER, self.OnTermEnterLine, self.termInput) - self.termInput.Bind(wx.EVT_CHAR, self.OnTermKey) - self.Layout() self.Fit() self.Centre() - self.statsText.SetMinSize(self.statsText.GetSize()) - self.statsText.SetLabel(self._printerConnection.getStatusString()) - - self.UpdateButtonStates() + self.progress.SetMinSize(self.progress.GetSize()) + self.statsText.SetLabel('') + self._updateButtonStates() self._printerConnection.addCallback(self._doPrinterConnectionUpdate) @@ -185,13 +82,20 @@ class printWindow(wx.Frame): self.powerWarningText.Hide() self.panel.Layout() self.Layout() + self.Fit() + self.Refresh() elif type != power.POWER_TYPE_AC and not self.powerWarningText.IsShown(): self.powerWarningText.Show() self.panel.Layout() self.Layout() + self.Fit() + self.Refresh() def OnClose(self, e): - self._printerConnection.closeActiveConnection() + if self._printerConnection.hasActiveConnection(): + if self._printerConnection.isPrinting(): + pass #TODO: Give warning that the close will kill the print. + self._printerConnection.closeActiveConnection() self._printerConnection.removeCallback(self._doPrinterConnectionUpdate) self.Destroy() @@ -229,7 +133,7 @@ class printWindow(wx.Frame): line = self.termInput.GetValue() if line == '': return - self._addTermLog('>%s\n' % (line)) + self._addTermLog('> %s\n' % (line)) self._printerConnection.sendCommand(line) self._termHistory.append(line) self._termHistoryIdx = len(self._termHistory) @@ -250,33 +154,42 @@ class printWindow(wx.Frame): e.Skip() def _addTermLog(self, line): - if len(self.termLog.GetValue()) > 10000: - self.termLog.SetValue(self.termLog.GetValue()[-10000:]) - self.termLog.SetInsertionPointEnd() - self.termLog.AppendText(unicode(line, 'utf-8', 'replace').encode('utf-8', 'replace')) + pass + # if len(self.termLog.GetValue()) > 10000: + # self.termLog.SetValue(self.termLog.GetValue()[-10000:]) + # self.termLog.SetInsertionPointEnd() + # if type(line) != unicode: + # line = unicode(line, 'utf-8', 'replace') + # self.termLog.AppendText(line.encode('utf-8', 'replace')) def _doPrinterConnectionUpdate(self, connection, extraInfo = None): wx.CallAfter(self.__doPrinterConnectionUpdate, connection, extraInfo) - temp = [connection.getTemperature(0)] - self.temperatureGraph.addPoint(temp, [0], connection.getBedTemperature(), 0) + #temp = [connection.getTemperature(0)] + #self.temperatureGraph.addPoint(temp, [0], connection.getBedTemperature(), 0) def __doPrinterConnectionUpdate(self, connection, extraInfo): t = time.time() - if self.lastUpdateTime + 0.5 > t and extraInfo is None: + if self._lastUpdateTime + 0.5 > t and extraInfo is None: return - self.lastUpdateTime = t + self._lastUpdateTime = t if extraInfo is not None: - self._addTermLog('<%s\n' % (extraInfo)) + self._addTermLog('< %s\n' % (extraInfo)) - self.UpdateButtonStates() + self._updateButtonStates() if connection.isPrinting(): self.progress.SetValue(connection.getPrintProgress() * 1000) else: self.progress.SetValue(0) - self.statsText.SetLabel(connection.getStatusString()) - - def UpdateButtonStates(self): + info = connection.getStatusString() + info += '\n' + if self._printerConnection.getTemperature(0) is not None: + info += 'Temperature: %d' % (self._printerConnection.getTemperature(0)) + if self._printerConnection.getBedTemperature() > 0: + info += ' Bed: %d' % (self._printerConnection.getBedTemperature()) + self.statsText.SetLabel(info) + + def _updateButtonStates(self): self.connectButton.Show(self._printerConnection.hasActiveConnection()) self.connectButton.Enable(not self._printerConnection.isActiveConnectionOpen()) self.pauseButton.Show(self._printerConnection.hasPause()) @@ -290,30 +203,10 @@ class printWindow(wx.Frame): self.cancelButton.Enable(False) self.errorLogButton.Show(self._printerConnection.isInErrorState()) - self.directControlPanel.Enable(self._printerConnection.isAbleToSendDirectCommand()) - self.temperatureSelect.Enable(self._printerConnection.isAbleToSendDirectCommand()) - self.temperatureHeatUp.Enable(self._printerConnection.isAbleToSendDirectCommand()) - self.termInput.Enable(self._printerConnection.isAbleToSendDirectCommand()) - -class PrintCommandButton(buttons.GenBitmapButton): - def __init__(self, parent, commandList, bitmapFilename, size=(20, 20)): - self.bitmap = wx.Bitmap(resources.getPathForImage(bitmapFilename)) - super(PrintCommandButton, self).__init__(parent.directControlPanel, -1, self.bitmap, size=size) - - self.commandList = commandList - self.parent = parent - - self.SetBezelWidth(1) - self.SetUseFocusIndicator(False) - - self.Bind(wx.EVT_BUTTON, self.OnClick) - - def OnClick(self, e): - if self.parent._printerConnection is None or self.parent._printerConnection.isAbleToSendDirectCommand(): - return - for cmd in self.commandList: - self.parent._printerConnection.sendCommand(cmd) - e.Skip() + #self.directControlPanel.Enable(self._printerConnection.isAbleToSendDirectCommand()) + #self.temperatureSelect.Enable(self._printerConnection.isAbleToSendDirectCommand()) + #self.temperatureHeatUp.Enable(self._printerConnection.isAbleToSendDirectCommand()) + #self.termInput.Enable(self._printerConnection.isAbleToSendDirectCommand()) class TemperatureGraph(wx.Panel): def __init__(self, parent): diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index ae95c705..6d263bdd 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -273,7 +273,7 @@ class SceneView(openglGui.glGuiPanel): def _openPrintWindowForConnection(self, connection): print '_openPrintWindowForConnection', connection.getName() if connection.window is None or not connection.window: - connection.window = printWindow2.printWindow(connection) + connection.window = printWindow2.printWindow(self, connection) connection.window.Show() connection.window.Raise() if not connection.loadGCodeData(StringIO.StringIO(self._engine.getResult().getGCode())): diff --git a/Cura/serialCommunication.py b/Cura/serialCommunication.py index 0534a84b..7a2d91ea 100644 --- a/Cura/serialCommunication.py +++ b/Cura/serialCommunication.py @@ -25,7 +25,7 @@ class serialComm(object): sys.stdout.write('log:%s\n' % (message)) def mcTempUpdate(self, temp, bedTemp, targetTemp, bedTargetTemp): - sys.stdout.write('temp:%s\n' % json.dumps(temp)) + sys.stdout.write('temp:%s:%s:%f:%f\n' % (json.dumps(temp), json.dumps(targetTemp), bedTemp, bedTargetTemp)) def mcStateChange(self, state): if self._comm is None: @@ -50,18 +50,23 @@ class serialComm(object): self._gcodeList = ['M110'] elif line[0] == 'G': self._gcodeList.append(line[1]) + elif line[0] == 'C': + self._comm.sendCommand(line[1]) elif line[0] == 'START': self._comm.printGCode(self._gcodeList) else: sys.stderr.write(str(line)) +def startMonitor(portName): + sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) + comm = serialComm(portName) + comm.monitorStdin() + def main(): if len(sys.argv) != 2: return - sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) portName = sys.argv[1] - comm = serialComm(portName) - comm.monitorStdin() + startMonitor(portName) if __name__ == '__main__': main() diff --git a/Cura/util/printerConnection/doodle3dConnect.py b/Cura/util/printerConnection/doodle3dConnect.py index ad3ea51b..0182a7ec 100644 --- a/Cura/util/printerConnection/doodle3dConnect.py +++ b/Cura/util/printerConnection/doodle3dConnect.py @@ -191,14 +191,13 @@ class doodle3dConnect(printerConnectionBase.printerConnectionBase): if not self._isAvailable: return "Doodle3D box not found" if self._printing: - ret = "Print progress: %.1f%%" % (self.getPrintProgress() * 100.0) if self._blockIndex < len(self._fileBlocks): - ret += "\nSending GCode: %.1f%%" % (float(self._blockIndex) * 100.0 / float(len(self._fileBlocks))) + ret = "Sending GCode: %.1f%%" % (float(self._blockIndex) * 100.0 / float(len(self._fileBlocks))) elif len(self._fileBlocks) > 0: - ret += "\nFinished sending GCode to Doodle3D box.\nPrint will continue even if you shut down Cura." + ret = "Finished sending GCode to Doodle3D box." else: - ret += "\nDifferent print still running..." - ret += "\nErrorCount: %d" % (self._errorCount) + ret = "Different print still running..." + #ret += "\nErrorCount: %d" % (self._errorCount) return ret return "Printer found, waiting for print command." diff --git a/Cura/util/printerConnection/dummyConnection.py b/Cura/util/printerConnection/dummyConnection.py index be3c57ea..42a7834f 100644 --- a/Cura/util/printerConnection/dummyConnection.py +++ b/Cura/util/printerConnection/dummyConnection.py @@ -55,6 +55,7 @@ class dummyConnection(printerConnectionBase.printerConnectionBase): #Start printing the previously loaded file def startPrint(self): + print 'startPrint', self._printing, self._lineCount if self._printing or self._lineCount < 1: return self._progressLine = 0 @@ -80,7 +81,7 @@ class dummyConnection(printerConnectionBase.printerConnectionBase): # Get the connection status string. This is displayed to the user and can be used to communicate # various information to the user. def getStatusString(self): - return "DUMMY!\n%i %i\n%i" % (self._progressLine, self._lineCount, self._printing) + return "DUMMY!:%i %i:%i" % (self._progressLine, self._lineCount, self._printing) def _dummyThread(self): while True: diff --git a/Cura/util/printerConnection/serialConnection.py b/Cura/util/printerConnection/serialConnection.py index f19dbc23..1e8e5b77 100644 --- a/Cura/util/printerConnection/serialConnection.py +++ b/Cura/util/printerConnection/serialConnection.py @@ -41,6 +41,10 @@ class serialConnection(printerConnectionBase.printerConnectionBase): self._thread = None self._temperature = [] + self._targetTemperature = [] + self._bedTemperature = 0 + self._targetBedTemperature = 0 + self._log = [] self._commState = None self._commStateString = None @@ -126,9 +130,30 @@ class serialConnection(printerConnectionBase.printerConnectionBase): return None return self._temperature[extruder] + def getBedTemperature(self): + return self._bedTemperature + + #Are we able to send a direct coammand with sendCommand at this moment in time. + def isAbleToSendDirectCommand(self): + return self.isActiveConnectionOpen() + + #Directly send a command to the printer. + def sendCommand(self, command): + if self._process is None: + return + self._process.stdin.write('C:%s\n' % (command)) + + #Returns true if we got some kind of error. The getErrorLog returns all the information to diagnose the problem. + def isInErrorState(self): + return self._commState == machineCom.MachineCom.STATE_ERROR or self._commState == machineCom.MachineCom.STATE_CLOSED_WITH_ERROR + + #Returns the error log in case there was an error. + def getErrorLog(self): + return '\n'.join(self._log) + def _serialCommunicationThread(self): if platform.system() == "Darwin" and hasattr(sys, 'frozen'): - cmdList = [os.path.join(os.path.dirname(sys.executable), 'Cura')] + cmdList = [os.path.join(os.path.dirname(sys.executable), 'Cura'), '--serialCommunication'] else: cmdList = [sys.executable, '-m', 'Cura.serialCommunication'] cmdList += [self._portName] @@ -143,10 +168,15 @@ class serialConnection(printerConnectionBase.printerConnectionBase): if line[0] == '': pass elif line[0] == 'log': - pass + self._log.append(line[1]) + if len(self._log) > 30: + self._log.pop(0) elif line[0] == 'temp': - line = line[1].split(':', 1) + line = line[1].split(':') self._temperature = json.loads(line[0]) + self._targetTemperature = json.loads(line[1]) + self._bedTemperature = float(line[2]) + self._targetBedTemperature = float(line[3]) self._doCallback() elif line[0] == 'message': self._doCallback(line[1]) diff --git a/Cura/util/sliceEngine.py b/Cura/util/sliceEngine.py index b800ebb7..ceca5b95 100644 --- a/Cura/util/sliceEngine.py +++ b/Cura/util/sliceEngine.py @@ -264,7 +264,7 @@ class Engine(object): commandList = [getEngineFilename(), '-v', '-p'] for k, v in self._engineSettings(extruderCount).iteritems(): commandList += ['-s', '%s=%s' % (k, str(v))] - commandList += ['-g', '%d' % self._serverPortNr] + commandList += ['-g', '%d' % (self._serverPortNr)] self._objCount = 0 engineModelData = [] hash = hashlib.sha512()