chiark / gitweb /
You can now safely remove the SD card from within Cura.
authordaid303 <daid303@gmail.com>
Wed, 1 May 2013 12:04:10 +0000 (14:04 +0200)
committerdaid303 <daid303@gmail.com>
Wed, 1 May 2013 12:04:10 +0000 (14:04 +0200)
Cura/gui/sceneView.py
Cura/gui/util/openglGui.py
Cura/resources/images/glButtons.png

index 6dc2f3f405fb45a85c2307fe2f590eb44f6f455d..72ed1b0371cf615fc108c0ca90f0f42b02fdd373 100644 (file)
@@ -160,7 +160,7 @@ class SceneView(openglGui.glGuiPanel):
                                except:
                                        self.notification.message("Failed to save to SD card")
                                else:
-                                       self.notification.message("Saved as %s" % (drive[1] + filename))
+                                       self.notification.message("Saved as %s" % (drive[1] + filename), lambda : self.notification.message('You can now eject the card.') if removableStorage.ejectDrive(drive[1]) else self.notification.message('Safe remove failed...'))
                        else:
                                self.showSaveGCode()
                if button == 3:
index adbbf001e356e7aceb65ff01e51ec4d58da65a8b..3eac071c576ed34a9e447d85bfd96bee9b3f737a 100644 (file)
@@ -380,6 +380,7 @@ class glGuiLayoutGrid(object):
 class glButton(glGuiControl):
        def __init__(self, parent, imageID, tooltip, pos, callback, size = None):
                self._buttonSize = size
+               self._hidden = False
                super(glButton, self).__init__(parent, pos)
                self._tooltip = tooltip
                self._parent = parent
@@ -387,7 +388,6 @@ class glButton(glGuiControl):
                self._callback = callback
                self._selected = False
                self._focus = False
-               self._hidden = False
                self._disabled = False
                self._showExpandArrow = False
                self._progressBar = None
@@ -415,6 +415,8 @@ class glButton(glGuiControl):
                return self._selected
 
        def getMinSize(self):
+               if self._hidden:
+                       return 0, 0
                if self._buttonSize is not None:
                        return self._buttonSize, self._buttonSize
                return self._base._buttonSize, self._base._buttonSize
@@ -681,7 +683,8 @@ class glNotification(glFrame):
                super(glNotification, self).__init__(parent, pos)
                glGuiLayoutGrid(self)._alignBottom = False
                self._label = glLabel(self, "Notification", (0, 0))
-               self._button = glButton(self, 30, "", (1, 0), self.onClose, 25)
+               self._buttonEject = glButton(self, 31, "Eject", (1, 0), self.onEject, 25)
+               self._button = glButton(self, 30, "", (2, 0), self.onClose, 25)
                self._padding = glLabel(self, "", (0, 1))
                self.setHidden(True)
 
@@ -698,15 +701,21 @@ class glNotification(glFrame):
                self.updateLayout()
                super(glNotification, self).draw()
 
-       def message(self, text):
+       def message(self, text, ejectCallback = None):
                if self._anim is not None:
                        self._anim = animation(self._base, self._anim.getPosition(), 25, 1)
                else:
                        self._anim = animation(self._base, -20, 25, 1)
                self.setHidden(False)
                self._label.setLabel(text)
+               self._buttonEject.setHidden(ejectCallback is None)
+               self._ejectCallback = ejectCallback
                self.updateLayout()
 
+       def onEject(self, button):
+               self.onClose(button)
+               self._ejectCallback()
+
        def onClose(self, button):
                if self._anim is not None:
                        self._anim = animation(self._base, self._anim.getPosition(), -20, 1)
index ab0b930d606c3985385619e69ff495a9fbe7f12c..2b91dda57bbad3a9a0742cc6e803c6a4e7fa9d78 100644 (file)
Binary files a/Cura/resources/images/glButtons.png and b/Cura/resources/images/glButtons.png differ