Add popups when copying files to the SD card, to indicate succes or failure. Still need to add safely remove code.

master
daid303 2012-11-06 09:11:57 +01:00
parent 7c7937fde5
commit 6eb39c97f4
3 changed files with 24 additions and 9 deletions

View File

@ -252,14 +252,6 @@ class previewPanel(wx.Panel):
if profile.getProfileSettingFloat('model_scale') != 1.0 or profile.getProfileSettingFloat('model_rotate_base') != 0 or profile.getProfileSetting('flip_x') != 'False' or profile.getProfileSetting('flip_y') != 'False' or profile.getProfileSetting('flip_z') != 'False' or profile.getProfileSetting('swap_xz') != 'False' or profile.getProfileSetting('swap_yz') != 'False':
self.ShowWarningPopup('Reset scale, rotation and mirror?', self.OnResetAll)
def ShowWarningPopup(self, text, callback):
self.warningPopup.text.SetLabel(text)
self.warningPopup.callback = callback
self.OnMove()
self.warningPopup.Show(True)
self.warningPopup.timer.Start(5000)
def loadReModelFiles(self, filelist):
#Only load this again if the filename matches the file we have already loaded (for auto loading GCode after slicing)
for idx in xrange(0, len(filelist)):
@ -320,6 +312,19 @@ class previewPanel(wx.Panel):
profile.putProfileSetting('swap_xz', 'False')
profile.putProfileSetting('swap_yz', 'False')
self.updateProfileToControls()
def ShowWarningPopup(self, text, callback = None):
self.warningPopup.text.SetLabel(text)
self.warningPopup.callback = callback
if callback == None:
self.warningPopup.yesButton.Show(False)
self.warningPopup.noButton.SetLabel('ok')
else:
self.warningPopup.yesButton.Show(True)
self.warningPopup.noButton.SetLabel('no')
self.OnMove()
self.warningPopup.Show(True)
self.warningPopup.timer.Start(5000)
def OnWarningPopup(self, e):
self.warningPopup.Show(False)

View File

@ -85,8 +85,16 @@ class sliceProgessPanel(wx.Panel):
filename = os.path.basename(exportFilename)
if profile.getPreference('sdshortnames') == 'True':
filename = sliceRun.getShortFilename(filename)
shutil.copy(exportFilename, os.path.join(profile.getPreference('sdpath'), filename))
try:
shutil.copy(exportFilename, os.path.join(profile.getPreference('sdpath'), filename))
except:
self.GetParent().preview3d.ShowWarningPopup("Failed to copy file to SD card.")
return
self.GetParent().preview3d.ShowWarningPopup("Copy finished, safely remove SD card?", OnSafeRemove)
def OnSafeRemove(self):
print "Remove!"
def OnSliceDone(self, result):
self.progressGauge.Destroy()
self.abortButton.Destroy()

View File

@ -572,6 +572,8 @@ def getPluginList():
item['info'] = line[1].strip()
elif line[0].upper() == 'TYPE':
item['type'] = line[1].strip()
elif line[0].upper() == 'DEPEND':
pass
elif line[0].upper() == 'PARAM':
m = re.match('([a-zA-Z]*)\(([a-zA-Z_]*)(?:\:([^\)]*))?\) +(.*)', line[1].strip())
if m != None: