From: daid303 Date: Wed, 1 May 2013 12:04:10 +0000 (+0200) Subject: You can now safely remove the SD card from within Cura. X-Git-Tag: 13.05~39 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=b7b212ed152dfd199d56e543247b7a6a38175113;p=cura.git You can now safely remove the SD card from within Cura. --- diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index 6dc2f3f4..72ed1b03 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -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: diff --git a/Cura/gui/util/openglGui.py b/Cura/gui/util/openglGui.py index adbbf001..3eac071c 100644 --- a/Cura/gui/util/openglGui.py +++ b/Cura/gui/util/openglGui.py @@ -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) diff --git a/Cura/resources/images/glButtons.png b/Cura/resources/images/glButtons.png index ab0b930d..2b91dda5 100644 Binary files a/Cura/resources/images/glButtons.png and b/Cura/resources/images/glButtons.png differ