From: daid303 Date: Wed, 24 Apr 2013 13:42:33 +0000 (+0200) Subject: Add slice log window. X-Git-Tag: 13.05~53 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ed8a7407a85ac2687cd76f9fdc2f47de3966e57e;p=cura.git Add slice log window. --- diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index 95599cd8..3aeadb70 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -54,6 +54,8 @@ class mainWindow(wx.Frame): self.Bind(wx.EVT_MENU, lambda e: self.scene.ShowLoadModel(1), i) i = self.fileMenu.Append(-1, 'Print...\tCTRL+P') self.Bind(wx.EVT_MENU, lambda e: self.scene.ShowPrintWindow(), i) + i = self.fileMenu.Append(-1, 'Save GCode...') + self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveGCode(), i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, 'Open Profile...') diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index 90188970..7f24caf3 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -150,15 +150,16 @@ class SceneView(openglGui.glGuiPanel): else: self.notification.message("Saved as %s" % (drive[1] + filename)) else: - self._showSaveGCode() + self.showSaveGCode() if button == 3: menu = wx.Menu() self.Bind(wx.EVT_MENU, lambda e: printWindow.printFile(self._slicer.getGCodeFilename()), menu.Append(-1, 'Print with USB')) - self.Bind(wx.EVT_MENU, lambda e: self._showSaveGCode(), menu.Append(-1, 'Save GCode...')) + self.Bind(wx.EVT_MENU, lambda e: self.showSaveGCode(), menu.Append(-1, 'Save GCode...')) + self.Bind(wx.EVT_MENU, lambda e: self._showSliceLog(), menu.Append(-1, 'Slice engine log...')) self.PopupMenu(menu) menu.Destroy() - def _showSaveGCode(self): + def showSaveGCode(self): defPath = profile.getPreference('lastFile') defPath = defPath[0:defPath.rfind('.')] + '.gcode' dlg=wx.FileDialog(self, 'Save toolpath', defPath, style=wx.FD_SAVE) @@ -177,6 +178,11 @@ class SceneView(openglGui.glGuiPanel): else: self.notification.message("Saved as %s" % (filename)) + def _showSliceLog(self): + dlg = wx.TextEntryDialog(self, "The slicing engine reported the following", "Engine log...", '\n'.join(self._slicer.getSliceLog()), wx.TE_MULTILINE | wx.OK | wx.CENTRE) + dlg.ShowModal() + dlg.Destroy() + def OnToolSelect(self, button): if self.rotateToolButton.getSelected(): self.tool = previewTools.toolRotate(self) @@ -295,11 +301,11 @@ class SceneView(openglGui.glGuiPanel): if self._focusObj is None: return obj = self._focusObj - dlg = wx.NumberEntryDialog(self, "How many copies need to be made?", "Copies", "Multiply", 1, 1, 100) + dlg = wx.NumberEntryDialog(self, "How many items do you want?", "Copies", "Multiply", 2, 1, 100) if dlg.ShowModal() != wx.ID_OK: dlg.Destroy() return - cnt = dlg.GetValue() + cnt = dlg.GetValue() - 1 dlg.Destroy() n = 0 while True: @@ -311,6 +317,8 @@ class SceneView(openglGui.glGuiPanel): break if n > cnt: break + if n <= cnt: + self.notification.message("Could not create more then %d items" % (n)) self._scene.remove(newObj) self._scene.centerAll() self.sceneUpdated() diff --git a/Cura/util/sliceEngine.py b/Cura/util/sliceEngine.py index 9671d580..348822ca 100644 --- a/Cura/util/sliceEngine.py +++ b/Cura/util/sliceEngine.py @@ -34,6 +34,7 @@ class Slicer(object): self._exportFilename = getTempFilename() self._progressSteps = ['inset', 'skin', 'export'] self._objCount = 0 + self._sliceLog = [] def cleanup(self): self.abortSlicer() @@ -57,6 +58,9 @@ class Slicer(object): def getGCodeFilename(self): return self._exportFilename + def getSliceLog(self): + return self._sliceLog + def runSlicer(self, scene): self.abortSlicer() self._callback(0.0, False) @@ -103,7 +107,6 @@ class Slicer(object): commandList += ['#' * len(obj._meshList)] self._objCount += 1 if self._objCount > 0: - print ' '.join(commandList) try: self._process = self._runSliceProcess(commandList) self._thread = threading.Thread(target=self._watchProcess) @@ -114,6 +117,7 @@ class Slicer(object): def _watchProcess(self): self._callback(0.0, False) + self._sliceLog = [] line = self._process.stdout.readline() objectNr = 0 while len(line): @@ -134,13 +138,11 @@ class Slicer(object): except: pass else: - print '#', line.strip() - pass + self._sliceLog.append(line.strip()) line = self._process.stdout.readline() for line in self._process.stderr: - print line.strip() + self._sliceLog.append(line.strip()) returnCode = self._process.wait() - print returnCode try: if returnCode == 0: self._callback(1.0, True)