Add safely remove SD feature.

master
daid303 2012-11-06 11:06:09 +01:00
parent 6eb39c97f4
commit 9e5fe59904
3 changed files with 14 additions and 2 deletions

View File

@ -322,6 +322,8 @@ class previewPanel(wx.Panel):
else:
self.warningPopup.yesButton.Show(True)
self.warningPopup.noButton.SetLabel('no')
self.warningPopup.Fit()
self.warningPopup.Layout()
self.OnMove()
self.warningPopup.Show(True)
self.warningPopup.timer.Start(5000)

View 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()

View File

@ -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