chiark / gitweb /
Add slice log window.
authordaid303 <daid303@gmail.com>
Wed, 24 Apr 2013 13:42:33 +0000 (15:42 +0200)
committerdaid303 <daid303@gmail.com>
Wed, 24 Apr 2013 13:42:33 +0000 (15:42 +0200)
Cura/gui/mainWindow.py
Cura/gui/sceneView.py
Cura/util/sliceEngine.py

index 95599cd8e8c11c8882d42745e85e20921c5e9a20..3aeadb703b7fc9b752971690819e118ef72a8b4d 100644 (file)
@@ -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...')
index 90188970ecbbabad00980bd3368737e6755d12fb..7f24caf3cf674d9f4335710bdea27d3161bfc9cb 100644 (file)
@@ -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()
index 9671d580a34722dfcf833910aab17eaeca92c022..348822cafbb7c14881d08c04943013c1d24ce306 100644 (file)
@@ -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)