chiark / gitweb /
Add a notification if the copy of GCode fails. Fix the refresh bug if there is no...
authordaid303 <daid303@gmail.com>
Thu, 18 Apr 2013 15:35:56 +0000 (17:35 +0200)
committerdaid303 <daid303@gmail.com>
Thu, 18 Apr 2013 15:35:56 +0000 (17:35 +0200)
Cura/gui/sceneView.py
Cura/gui/util/openglGui.py
Cura/util/profile.py

index 59ee0e09469d2f8107bdce6b32e5454b08eb4349..67232d9b7226e33c5b18e64eb7590eb91de169d4 100644 (file)
@@ -136,8 +136,12 @@ class SceneView(openglGui.glGuiPanel):
                                        drive = drives[0]
                                filename = os.path.basename(profile.getPreference('lastFile'))
                                filename = filename[0:filename.rfind('.')] + '.gcode'
-                               shutil.copy(self._slicer.getGCodeFilename(), drive[1] + filename)
-                               self.notification.message("Saved as %s" % (drive[1] + filename))
+                               try:
+                                       shutil.copy(self._slicer.getGCodeFilename(), drive[1] + filename)
+                               except:
+                                       self.notification.message("Failed to save to SD card")
+                               else:
+                                       self.notification.message("Saved as %s" % (drive[1] + filename))
                        else:
                                defPath = profile.getPreference('lastFile')
                                defPath = defPath[0:defPath.rfind('.')] + '.gcode'
@@ -150,8 +154,12 @@ class SceneView(openglGui.glGuiPanel):
                                filename = dlg.GetPath()
                                dlg.Destroy()
 
-                               shutil.copy(self._slicer.getGCodeFilename(), filename)
-                               self.notification.message("Saved as %s" % (filename))
+                               try:
+                                       shutil.copy(self._slicer.getGCodeFilename(), filename)
+                               except:
+                                       self.notification.message("Failed to save")
+                               else:
+                                       self.notification.message("Saved as %s" % (filename))
 
        def OnToolSelect(self, button):
                if self.rotateToolButton.getSelected():
index 7d289cf71155353153cf2158dea27a28f3209fd1..8855b06f7600a79ae129baf125601a64e0ae48f3 100644 (file)
@@ -297,6 +297,9 @@ class glGuiPanel(glcanvas.GLCanvas):
                pass
 
        def QueueRefresh(self):
+               wx.CallAfter(self._queueRefresh)
+
+       def _queueRefresh(self):
                self._refreshQueued = True
 
        def add(self, ctrl):
index 0727cb93f7f48232aa035e7181c5ab9449f4f7a2..dd69fc74b127f6780410c6d27e92f4e5091833af 100644 (file)
@@ -571,6 +571,8 @@ def calculateLineCount():
 def calculateSolidLayerCount():
        layerHeight = getProfileSettingFloat('layer_height')
        solidThickness = getProfileSettingFloat('solid_layer_thickness')
+       if layerHeight == 0.0:
+               return 1
        return int(math.ceil(solidThickness / layerHeight - 0.0001))
 
 def calculateObjectSizeOffsets():