chiark / gitweb /
Add safely remove SD feature.
authordaid303 <daid303@gmail.com>
Tue, 6 Nov 2012 10:06:09 +0000 (11:06 +0100)
committerdaid303 <daid303@gmail.com>
Tue, 6 Nov 2012 10:06:09 +0000 (11:06 +0100)
Cura/gui/preview3d.py
Cura/gui/sliceProgessPanel.py
package.sh

index 4882df71042e41735e83fdd46bcb6db71ad76a21..6ebae45d1a13bfa1703d3db62377e981a2534208 100644 (file)
@@ -322,6 +322,8 @@ class previewPanel(wx.Panel):
                else:\r
                        self.warningPopup.yesButton.Show(True)\r
                        self.warningPopup.noButton.SetLabel('no')\r
+               self.warningPopup.Fit()\r
+               self.warningPopup.Layout()\r
                self.OnMove()\r
                self.warningPopup.Show(True)\r
                self.warningPopup.timer.Start(5000)\r
index 5b35fbfc2b8c63f9ad6d0961fd72062e2ab6165d..eaaed967992710999d85842186d7f2d695fc7dcd 100644 (file)
@@ -90,10 +90,17 @@ class sliceProgessPanel(wx.Panel):
                except:
                        self.GetParent().preview3d.ShowWarningPopup("Failed to copy file to SD card.")
                        return
-               self.GetParent().preview3d.ShowWarningPopup("Copy finished, safely remove SD card?", OnSafeRemove)
+               self.GetParent().preview3d.ShowWarningPopup("Copy finished, safely remove SD card?", self.OnSafeRemove)
        
        def OnSafeRemove(self):
-               print "Remove!"
+               if platform.system() == "Windows":
+                       cmd = "%s %s>NUL" % (os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'EjectMedia.exe')), profile.getPreference('sdpath'))
+               else:
+                       cmd = "umount %s > /dev/null 2>&1" % (profile.getPreference('sdpath'))
+               if os.system(cmd):
+                       self.GetParent().preview3d.ShowWarningPopup("Safe remove failed.")
+               else:
+                       self.GetParent().preview3d.ShowWarningPopup("You can now eject the card.")
 
        def OnSliceDone(self, result):
                self.progressGauge.Destroy()
index 6a90ee5e1534995766529ed3bc2a925a6430273d..86dc04b83d1d73bc7acf5547c62653644b4640cf 100755 (executable)
@@ -97,6 +97,7 @@ if [ $BUILD_TARGET = "win32" ]; then
        downloadURL http://videocapture.sourceforge.net/VideoCapture-0.9-5.zip
        downloadURL http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20120927-git-13f0cd6-win32-static.7z
        downloadURL http://sourceforge.net/projects/comtypes/files/comtypes/0.6.2/comtypes-0.6.2.win32.exe
+       downloadURL http://www.uwe-sieber.de/files/ejectmedia.zip
        #Get pypy
        downloadURL https://bitbucket.org/pypy/pypy/downloads/pypy-${PYPY_VERSION}-win32.zip
 elif [ $BUILD_TARGET = "osx64" ]; then
@@ -129,6 +130,7 @@ if [ $BUILD_TARGET = "win32" ]; then
        extract ffmpeg-20120927-git-13f0cd6-win32-static.7z ffmpeg-20120927-git-13f0cd6-win32-static/bin/ffmpeg.exe
        extract ffmpeg-20120927-git-13f0cd6-win32-static.7z ffmpeg-20120927-git-13f0cd6-win32-static/licenses
        extract comtypes-0.6.2.win32.exe
+       extract ejectmedia.zip Win32
        
        mkdir -p ${TARGET_DIR}/python
        mkdir -p ${TARGET_DIR}/Cura/
@@ -141,6 +143,7 @@ if [ $BUILD_TARGET = "win32" ]; then
        mv VideoCapture-0.9-5/Python27/DLLs/vidcap.pyd ${TARGET_DIR}/python/DLLs
        mv ffmpeg-20120927-git-13f0cd6-win32-static/bin/ffmpeg.exe ${TARGET_DIR}/Cura/
        mv ffmpeg-20120927-git-13f0cd6-win32-static/licenses ${TARGET_DIR}/Cura/ffmpeg-licenses/
+       mv Win32/EjectMedia.exe ${TARGET_DIR}/Cura/
        rm -rf \$_OUTDIR
        rm -rf PURELIB
        rm -rf PLATLIB