from __future__ import absolute_import\r
import __init__\r
\r
-import wx, os, platform, types\r
+import wx, os, platform, types, string\r
import ConfigParser\r
\r
from gui import configBase\r
configBase.TitleRow(right, 'Slicer settings')\r
#c = configBase.SettingRow(right, 'Slicer selection', 'slicer', ['Cura (Skeinforge based)', 'Slic3r'], 'Which slicer to use to slice objects. Usually the Cura engine produces the best results. But Slic3r is developing fast and is faster with slicing.', type = 'preference')\r
c = configBase.SettingRow(right, 'Save profile on slice', 'save_profile', False, 'When slicing save the profile as [stl_file]_profile.ini next to the model.', type = 'preference')\r
- \r
+\r
+ configBase.TitleRow(right, 'SD Card settings')\r
+ if len(getDrives()) > 1:\r
+ c = configBase.SettingRow(right, 'SD card drive', 'sdpath', getDrives(), 'Location of your SD card, when using the copy to SD feature.', type = 'preference')\r
+ else:\r
+ c = configBase.SettingRow(right, 'SD card path', 'sdpath', '', 'Location of your SD card, when using the copy to SD feature.', type = 'preference')\r
+ c = configBase.SettingRow(right, 'Copy to SD with 8.3 names', 'sdshortnames', False, 'Save the gcode files in short filenames, so they are properly shown on the UltiController', type = 'preference')\r
+\r
self.okButton = wx.Button(left, -1, 'Ok')\r
left.GetSizer().Add(self.okButton, (left.GetSizer().GetRows(), 1))\r
self.okButton.Bind(wx.EVT_BUTTON, self.OnClose)\r
wx.MessageBox('After changing the amount of extruders you need to restart Cura for full effect.', 'Extruder amount warning.', wx.OK | wx.ICON_INFORMATION)\r
self.MakeModal(False)\r
self.Destroy()\r
+\r
+def getDrives():\r
+ drives = ['']\r
+ if platform.system() == "Windows":\r
+ from ctypes import windll\r
+ bitmask = windll.kernel32.GetLogicalDrives()\r
+ for letter in string.uppercase:\r
+ if bitmask & 1:\r
+ drives.append(letter + ':/')\r
+ bitmask >>= 1\r
+ return drives\r
from __future__ import absolute_import
import __init__
-import wx, sys, os, math, threading, subprocess, time, re
+import wx, sys, os, shutil, math, threading, subprocess, time, re
from util import profile
from util import sliceRun
def OnOpenFileLocation(self, e):
exporer.openExporer(sliceRun.getExportFilename(self.filelist[0]))
+ def OnCopyToSD(self, e):
+ exportFilename = sliceRun.getExportFilename(self.filelist[0])
+ filename = os.path.basename(exportFilename)
+ if profile.getPreference('sdshortnames') == 'True':
+ filename = sliceRun.getShortFilename(filename)
+ shutil.copy(exportFilename, os.path.join(profile.getPreference('sdpath'), filename))
+
def OnSliceDone(self, result):
self.progressGauge.Destroy()
self.abortButton.Destroy()
self.openFileLocationButton = wx.Button(self, -1, "Open file location")
self.Bind(wx.EVT_BUTTON, self.OnOpenFileLocation, self.openFileLocationButton)
self.sizer.Add(self.openFileLocationButton, 0)
+ 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, 0)
self.showButton = wx.Button(self, -1, "Show result")
self.Bind(wx.EVT_BUTTON, self.OnShowGCode, self.showButton)
self.sizer.Add(self.showButton, 0)
'save_profile': 'False',\r
'filament_cost_kg': '0',\r
'filament_cost_meter': '0',\r
+ 'sdpath': '',\r
+ 'sdshortnames': 'True',\r
\r
'extruder_head_size_min_x': '70.0',\r
'extruder_head_size_min_y': '18.0',\r
def getExportFilename(filename, ext = "gcode"):
return "%s_export.%s" % (filename[: filename.rfind('.')], ext)
+#Get a short filename in 8.3 format for proper saving on SD.
+def getShortFilename(filename):
+ ext = filename[filename.rfind('.'):]
+ filename = filename[: filename.rfind('.')]
+ return filename[:8] + ext[:2]
+
def getSliceCommand(filename):
if profile.getPreference('slicer').startswith('Slic3r') and getSlic3rExe() != False:
slic3rExe = getSlic3rExe()