From 339e6782539c62cf5c1674fc29bc7e8ceee42185 Mon Sep 17 00:00:00 2001 From: Daid Date: Fri, 29 Jun 2012 00:32:33 +0200 Subject: [PATCH] Add copy to SD to batch run tool. --- Cura/gui/batchRun.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Cura/gui/batchRun.py b/Cura/gui/batchRun.py index f9b6d6d..f8c7f2f 100644 --- a/Cura/gui/batchRun.py +++ b/Cura/gui/batchRun.py @@ -1,7 +1,7 @@ from __future__ import absolute_import import __init__ -import wx, os, platform, types, webbrowser, math, subprocess, multiprocessing, threading, time, re +import wx, os, platform, types, webbrowser, math, subprocess, multiprocessing, threading, time, re, shutil from util import profile from util import sliceRun @@ -113,7 +113,7 @@ class BatchSliceProgressWindow(wx.Frame): self.progressGauge = [] self.statusText = [] for i in xrange(0, self.threadCount): - self.statusText.append(wx.StaticText(self, -1, "Building: %d XXXXXXXXXXXXXXXXXXXXX" % (len(self.sliceCmdList)))) + self.statusText.append(wx.StaticText(self, -1, "Building: %d " % (len(self.sliceCmdList)))) self.progressGauge.append(wx.Gauge(self, -1)) self.progressGauge[i].SetRange(10000) self.progressGaugeTotal = wx.Gauge(self, -1) @@ -204,7 +204,18 @@ class BatchSliceProgressWindow(wx.Frame): self.abortButton.Destroy() self.closeButton = wx.Button(self, -1, "Close") self.sizer.Add(self.closeButton, (2+self.threadCount*2,0), span=(1,1)) + if profile.getPreference('sdpath') != '': + self.copyToSDButton = wx.Button(self, -1, "To SDCard") + self.Bind(wx.EVT_BUTTON, self.OnCopyToSD, self.copyToSDButton) + self.sizer.Add(self.copyToSDButton, (2+self.threadCount*2,1), span=(1,1)) self.Bind(wx.EVT_BUTTON, self.OnAbort, self.closeButton) self.Layout() self.Fit() + def OnCopyToSD(self, e): + for f in self.filenameList: + exportFilename = sliceRun.getExportFilename(f) + filename = os.path.basename(exportFilename) + if profile.getPreference('sdshortnames') == 'True': + filename = sliceRun.getShortFilename(filename) + shutil.copy(exportFilename, os.path.join(profile.getPreference('sdpath'), filename))