Update on the GL window, better lighting. Upda on the plugin system GUI. Always show copy-to-SD button, and open preferences if no drive is set.

This commit is contained in:
daid303 2012-11-06 08:52:16 +01:00
parent f357ee18a3
commit 7c7937fde5
8 changed files with 76 additions and 49 deletions

View file

@ -21,7 +21,7 @@ def InitGL(window, view3D, zoom):
size = window.GetSize() size = window.GetSize()
glViewport(0,0, size.GetWidth(), size.GetHeight()) glViewport(0,0, size.GetWidth(), size.GetHeight())
glLightfv(GL_LIGHT0, GL_POSITION, [1.0, 1.0, 1.0, 0.0]) glLightfv(GL_LIGHT0, GL_POSITION, [0.2, 0.2, 1.0, 0.0])
glLightfv(GL_LIGHT1, GL_POSITION, [1.0, 1.0, 1.0, 0.0]) glLightfv(GL_LIGHT1, GL_POSITION, [1.0, 1.0, 1.0, 0.0])
glEnable(GL_RESCALE_NORMAL) glEnable(GL_RESCALE_NORMAL)
@ -53,7 +53,7 @@ def DrawMachine(machineSize):
if profile.getPreference('machine_type') == 'ultimaker': if profile.getPreference('machine_type') == 'ultimaker':
glPushMatrix() glPushMatrix()
glEnable(GL_LIGHTING) glEnable(GL_LIGHTING)
glTranslate(100,120,-285) glTranslate(100,200,-5)
glLightfv(GL_LIGHT0, GL_DIFFUSE, [0.8,0.8,0.8]) glLightfv(GL_LIGHT0, GL_DIFFUSE, [0.8,0.8,0.8])
glLightfv(GL_LIGHT0, GL_AMBIENT, [0.5,0.5,0.5]) glLightfv(GL_LIGHT0, GL_AMBIENT, [0.5,0.5,0.5])
glEnable(GL_BLEND) glEnable(GL_BLEND)
@ -62,7 +62,7 @@ def DrawMachine(machineSize):
global platformMesh global platformMesh
if platformMesh == None: if platformMesh == None:
platformMesh = meshLoader.loadMesh(os.path.normpath(os.path.join(os.path.split(__file__)[0], "../images", 'ultimaker_platform.stl'))) platformMesh = meshLoader.loadMesh(os.path.normpath(os.path.join(os.path.split(__file__)[0], "../images", 'ultimaker_platform.stl')))
platformMesh.setRotateMirror(0, False, True, False, False, True) platformMesh.setRotateMirror(0, False, False, False, False, False)
DrawMesh(platformMesh) DrawMesh(platformMesh)
glPopMatrix() glPopMatrix()
@ -130,7 +130,7 @@ def DrawMachine(machineSize):
glVertex3f(min(x+10, machineSize.x), min(y+10, machineSize.y), -0.01) glVertex3f(min(x+10, machineSize.x), min(y+10, machineSize.y), -0.01)
glVertex3f(x, min(y+10, machineSize.y), -0.01) glVertex3f(x, min(y+10, machineSize.y), -0.01)
glEnd() glEnd()
glColor4ub(5/2,171/2,231/2,128) glColor4ub(5*8/10,171*8/10,231*8/10,128)
glBegin(GL_QUADS) glBegin(GL_QUADS)
for x in xrange(10, int(machineSize.x), 20): for x in xrange(10, int(machineSize.x), 20):
for y in xrange(0, int(machineSize.y), 20): for y in xrange(0, int(machineSize.y), 20):
@ -147,7 +147,7 @@ def DrawMachine(machineSize):
glEnd() glEnd()
glEnable(GL_CULL_FACE) glEnable(GL_CULL_FACE)
glColor4ub(5,171,231,128) glColor4ub(5,171,231,64)
glBegin(GL_QUADS) glBegin(GL_QUADS)
glVertex3f(0, 0, machineSize.z) glVertex3f(0, 0, machineSize.z)
glVertex3f(0, machineSize.y, machineSize.z) glVertex3f(0, machineSize.y, machineSize.z)
@ -155,7 +155,7 @@ def DrawMachine(machineSize):
glVertex3f(machineSize.x, 0, machineSize.z) glVertex3f(machineSize.x, 0, machineSize.z)
glEnd() glEnd()
glColor4ub(5,171,231,192) glColor4ub(5,171,231,96)
glBegin(GL_QUADS) glBegin(GL_QUADS)
glVertex3f(0, 0, 0) glVertex3f(0, 0, 0)
glVertex3f(0, 0, machineSize.z) glVertex3f(0, 0, machineSize.z)
@ -168,7 +168,7 @@ def DrawMachine(machineSize):
glVertex3f(machineSize.x, machineSize.y, machineSize.z) glVertex3f(machineSize.x, machineSize.y, machineSize.z)
glEnd() glEnd()
glColor4ub(5,171,231,255) glColor4ub(5,171,231,128)
glBegin(GL_QUADS) glBegin(GL_QUADS)
glVertex3f(0, 0, machineSize.z) glVertex3f(0, 0, machineSize.z)
glVertex3f(0, 0, 0) glVertex3f(0, 0, 0)
@ -395,7 +395,7 @@ def DrawGCodeLayer(layer):
dist = (v0 - v1).vsize() dist = (v0 - v1).vsize()
if dist > 0 and path.layerThickness > 0: if dist > 0 and path.layerThickness > 0:
extrusionMMperDist = (v1.e - v0.e) / dist extrusionMMperDist = (v1.e - v0.e) / dist
lineWidth = extrusionMMperDist * filamentArea / path.layerThickness / 2 lineWidth = extrusionMMperDist * filamentArea / path.layerThickness / 2 * v1.extrudeAmountMultiply
drawLength += (v0 - v1).vsize() drawLength += (v0 - v1).vsize()
normal = (v0 - v1).cross(util3d.Vector3(0,0,1)) normal = (v0 - v1).cross(util3d.Vector3(0,0,1))

View file

@ -66,12 +66,14 @@ class pluginPanel(wx.Panel):
title = wx.StaticText(pluginPanel, -1, plugin['name']) title = wx.StaticText(pluginPanel, -1, plugin['name'])
title.SetFont(wx.Font(wx.SystemSettings.GetFont(wx.SYS_ANSI_VAR_FONT).GetPointSize(), wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD)) title.SetFont(wx.Font(wx.SystemSettings.GetFont(wx.SYS_ANSI_VAR_FONT).GetPointSize(), wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD))
remButton = wx.Button(pluginPanel, -1, 'X', style=wx.BU_EXACTFIT) remButton = wx.Button(pluginPanel, -1, 'X', style=wx.BU_EXACTFIT)
s.Add(title, pos=(0,0), span=(1,2), flag=wx.ALIGN_BOTTOM|wx.TOP|wx.LEFT|wx.RIGHT, border=5) helpButton = wx.Button(pluginPanel, -1, '?', style=wx.BU_EXACTFIT)
s.Add(remButton, pos=(0,2), span=(1,1), flag=wx.TOP|wx.LEFT|wx.RIGHT|wx.ALIGN_RIGHT, border=5) s.Add(title, pos=(0,1), span=(1,2), flag=wx.ALIGN_BOTTOM|wx.TOP|wx.LEFT|wx.RIGHT, border=5)
s.Add(wx.StaticLine(pluginPanel), pos=(1,0), span=(1,3), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3) s.Add(helpButton, pos=(0,0), span=(1,1), flag=wx.TOP|wx.LEFT|wx.ALIGN_RIGHT, border=5)
s.Add(remButton, pos=(0,3), span=(1,1), flag=wx.TOP|wx.RIGHT|wx.ALIGN_RIGHT, border=5)
s.Add(wx.StaticLine(pluginPanel), pos=(1,0), span=(1,4), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3)
info = wx.StaticText(pluginPanel, -1, plugin['info']) info = wx.StaticText(pluginPanel, -1, plugin['info'])
info.Wrap(300) info.Wrap(300)
s.Add(info, pos=(2,0), span=(1,3), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3) s.Add(info, pos=(2,0), span=(1,4), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3)
pluginPanel.paramCtrls = {} pluginPanel.paramCtrls = {}
i = 0 i = 0
@ -81,19 +83,19 @@ class pluginPanel(wx.Panel):
value = pluginConfig['params'][param['name']] value = pluginConfig['params'][param['name']]
ctrl = wx.TextCtrl(pluginPanel, -1, value) ctrl = wx.TextCtrl(pluginPanel, -1, value)
s.Add(wx.StaticText(pluginPanel, -1, param['description']), pos=(3+i,0), span=(1,1), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL,border=3) s.Add(wx.StaticText(pluginPanel, -1, param['description']), pos=(3+i,0), span=(1,2), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL,border=3)
s.Add(ctrl, pos=(3+i,2), span=(1,1), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3) s.Add(ctrl, pos=(3+i,2), span=(1,2), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3)
ctrl.Bind(wx.EVT_TEXT, self.OnSettingChange) ctrl.Bind(wx.EVT_TEXT, self.OnSettingChange)
pluginPanel.paramCtrls[param['name']] = ctrl pluginPanel.paramCtrls[param['name']] = ctrl
i += 1 i += 1
s.Add(wx.StaticLine(pluginPanel), pos=(3+i,0), span=(1,3), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3) s.Add(wx.StaticLine(pluginPanel), pos=(3+i,0), span=(1,4), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3)
self.Bind(wx.EVT_BUTTON, self.OnRem, remButton) self.Bind(wx.EVT_BUTTON, self.OnRem, remButton)
s.AddGrowableCol(2) s.AddGrowableCol(1)
pluginPanel.SetBackgroundColour(self.GetParent().GetBackgroundColour()) pluginPanel.SetBackgroundColour(self.GetParent().GetBackgroundColour())
self.pluginEnabledPanel.GetSizer().Add(pluginPanel, flag=wx.EXPAND) self.pluginEnabledPanel.GetSizer().Add(pluginPanel, flag=wx.EXPAND)
self.pluginEnabledPanel.Layout() self.pluginEnabledPanel.Layout()

View file

@ -60,8 +60,8 @@ class preferencesDialog(configBase.configWindowBase):
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') 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')
configBase.TitleRow(right, 'SD Card settings') configBase.TitleRow(right, 'SD Card settings')
if len(getDrives()) > 1: if len(profile.getSDcardDrives()) > 1:
c = configBase.SettingRow(right, 'SD card drive', 'sdpath', getDrives(), 'Location of your SD card, when using the copy to SD feature.', type = 'preference') c = configBase.SettingRow(right, 'SD card drive', 'sdpath', profile.getSDcardDrives(), 'Location of your SD card, when using the copy to SD feature.', type = 'preference')
else: else:
c = configBase.SettingRow(right, 'SD card path', 'sdpath', '', 'Location of your SD card, when using the copy to SD feature.', type = 'preference') c = configBase.SettingRow(right, 'SD card path', 'sdpath', '', 'Location of your SD card, when using the copy to SD feature.', type = 'preference')
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') 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')
@ -80,20 +80,3 @@ class preferencesDialog(configBase.configWindowBase):
self.MakeModal(False) self.MakeModal(False)
self.parent.updateProfileToControls() self.parent.updateProfileToControls()
self.Destroy() self.Destroy()
def getDrives():
drives = ['']
if platform.system() == "Windows":
from ctypes import windll
bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.uppercase:
if bitmask & 1:
drives.append(letter + ':/')
bitmask >>= 1
if platform.system() == "Darwin":
drives = []
for volume in glob.glob('/Volumes/*'):
if stat.S_ISLNK(os.lstat(volume).st_mode):
continue
drives.append(volume)
return drives

View file

@ -64,7 +64,7 @@ class previewPanel(wx.Panel):
self.warningPopup.timer = wx.Timer(self) self.warningPopup.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.OnHideWarning, self.warningPopup.timer) self.Bind(wx.EVT_TIMER, self.OnHideWarning, self.warningPopup.timer)
self.Bind(wx.EVT_BUTTON, self.OnResetAll, self.warningPopup.yesButton) self.Bind(wx.EVT_BUTTON, self.OnWarningPopup, self.warningPopup.yesButton)
self.Bind(wx.EVT_BUTTON, self.OnHideWarning, self.warningPopup.noButton) self.Bind(wx.EVT_BUTTON, self.OnHideWarning, self.warningPopup.noButton)
parent.Bind(wx.EVT_MOVE, self.OnMove) parent.Bind(wx.EVT_MOVE, self.OnMove)
parent.Bind(wx.EVT_SIZE, self.OnMove) parent.Bind(wx.EVT_SIZE, self.OnMove)
@ -136,7 +136,8 @@ class previewPanel(wx.Panel):
sizer.Add(self.toolbar2, 0, flag=wx.EXPAND|wx.BOTTOM|wx.LEFT|wx.RIGHT, border=1) sizer.Add(self.toolbar2, 0, flag=wx.EXPAND|wx.BOTTOM|wx.LEFT|wx.RIGHT, border=1)
self.SetSizer(sizer) self.SetSizer(sizer)
def OnMove(self, e): def OnMove(self, e = None):
if e != None:
e.Skip() e.Skip()
x, y = self.glCanvas.ClientToScreenXY(0, 0) x, y = self.glCanvas.ClientToScreenXY(0, 0)
sx, sy = self.glCanvas.GetClientSizeTuple() sx, sy = self.glCanvas.GetClientSizeTuple()
@ -249,9 +250,16 @@ class previewPanel(wx.Panel):
if showWarning: if showWarning:
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': 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.Show(True)
self.warningPopup.timer.Start(5000) self.warningPopup.timer.Start(5000)
def loadReModelFiles(self, filelist): def loadReModelFiles(self, filelist):
#Only load this again if the filename matches the file we have already loaded (for auto loading GCode after slicing) #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)): for idx in xrange(0, len(filelist)):
@ -303,7 +311,7 @@ class previewPanel(wx.Panel):
def loadProgress(self, progress): def loadProgress(self, progress):
pass pass
def OnResetAll(self, e): def OnResetAll(self, e = None):
profile.putProfileSetting('model_scale', '1.0') profile.putProfileSetting('model_scale', '1.0')
profile.putProfileSetting('model_rotate_base', '0') profile.putProfileSetting('model_rotate_base', '0')
profile.putProfileSetting('flip_x', 'False') profile.putProfileSetting('flip_x', 'False')
@ -312,8 +320,11 @@ class previewPanel(wx.Panel):
profile.putProfileSetting('swap_xz', 'False') profile.putProfileSetting('swap_xz', 'False')
profile.putProfileSetting('swap_yz', 'False') profile.putProfileSetting('swap_yz', 'False')
self.updateProfileToControls() self.updateProfileToControls()
def OnWarningPopup(self, e):
self.warningPopup.Show(False) self.warningPopup.Show(False)
self.warningPopup.timer.Stop() self.warningPopup.timer.Stop()
self.warningPopup.callback()
def OnHideWarning(self, e): def OnHideWarning(self, e):
self.warningPopup.Show(False) self.warningPopup.Show(False)
@ -676,7 +687,7 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)
elif self.viewMode == "Normal": elif self.viewMode == "Normal":
glLightfv(GL_LIGHT0, GL_DIFFUSE, self.objColor[self.parent.objectList.index(obj)]) glLightfv(GL_LIGHT0, GL_DIFFUSE, self.objColor[self.parent.objectList.index(obj)])
glLightfv(GL_LIGHT0, GL_AMBIENT, map(lambda x: x / 5, self.objColor[self.parent.objectList.index(obj)])) glLightfv(GL_LIGHT0, GL_AMBIENT, map(lambda x: x * 0.4, self.objColor[self.parent.objectList.index(obj)]))
glEnable(GL_LIGHTING) glEnable(GL_LIGHTING)
self.drawModel(obj) self.drawModel(obj)

View file

@ -4,6 +4,7 @@ import __init__
import wx, sys, os, shutil, math, threading, subprocess, time, re import wx, sys, os, shutil, math, threading, subprocess, time, re
from gui import taskbar from gui import taskbar
from gui import preferencesDialog
from util import profile from util import profile
from util import sliceRun from util import sliceRun
from util import exporer from util import exporer
@ -72,6 +73,14 @@ class sliceProgessPanel(wx.Panel):
exporer.openExporer(sliceRun.getExportFilename(self.filelist[0])) exporer.openExporer(sliceRun.getExportFilename(self.filelist[0]))
def OnCopyToSD(self, e): def OnCopyToSD(self, e):
if profile.getPreference('sdpath') == '':
wx.MessageBox("You need to configure your SD card drive first before you can copy files to it.\nOpening the preferences now.", 'No SD card drive.', wx.OK | wx.ICON_INFORMATION)
prefDialog = preferencesDialog.preferencesDialog(self.GetParent())
prefDialog.Centre()
prefDialog.Show(True)
if profile.getPreference('sdpath') == '':
print "No path set"
return
exportFilename = sliceRun.getExportFilename(self.filelist[0]) exportFilename = sliceRun.getExportFilename(self.filelist[0])
filename = os.path.basename(exportFilename) filename = os.path.basename(exportFilename)
if profile.getPreference('sdshortnames') == 'True': if profile.getPreference('sdshortnames') == 'True':
@ -98,8 +107,8 @@ class sliceProgessPanel(wx.Panel):
self.openFileLocationButton = wx.Button(self, -1, "Open file location") self.openFileLocationButton = wx.Button(self, -1, "Open file location")
self.Bind(wx.EVT_BUTTON, self.OnOpenFileLocation, self.openFileLocationButton) self.Bind(wx.EVT_BUTTON, self.OnOpenFileLocation, self.openFileLocationButton)
self.sizer.Add(self.openFileLocationButton, 0) self.sizer.Add(self.openFileLocationButton, 0)
if profile.getPreference('sdpath') != '': if len(profile.getSDcardDrives()) > 0:
self.copyToSDButton = wx.Button(self, -1, "To SDCard") self.copyToSDButton = wx.Button(self, -1, "Copy to SDCard")
self.Bind(wx.EVT_BUTTON, self.OnCopyToSD, self.copyToSDButton) self.Bind(wx.EVT_BUTTON, self.OnCopyToSD, self.copyToSDButton)
self.sizer.Add(self.copyToSDButton, 0) self.sizer.Add(self.copyToSDButton, 0)
self.showButton = wx.Button(self, -1, "Show result") self.showButton = wx.Button(self, -1, "Show result")

Binary file not shown.

View file

@ -56,6 +56,7 @@ class gcode(object):
totalExtrusion = 0.0 totalExtrusion = 0.0
maxExtrusion = 0.0 maxExtrusion = 0.0
currentExtruder = 0 currentExtruder = 0
extrudeAmountMultiply = 1.0
totalMoveTimeMinute = 0.0 totalMoveTimeMinute = 0.0
scale = 1.0 scale = 1.0
posAbs = True posAbs = True
@ -66,6 +67,7 @@ class gcode(object):
currentLayer = [] currentLayer = []
currentPath = gcodePath('move', pathType, layerThickness, pos.copy()) currentPath = gcodePath('move', pathType, layerThickness, pos.copy())
currentPath.list[0].e = totalExtrusion currentPath.list[0].e = totalExtrusion
currentPath.list[0].extrudeAmountMultiply = extrudeAmountMultiply
currentLayer.append(currentPath) currentLayer.append(currentPath)
for line in gcodeFile: for line in gcodeFile:
if type(line) is tuple: if type(line) is tuple:
@ -141,15 +143,13 @@ class gcode(object):
moveType = 'extrude' moveType = 'extrude'
if e < currentE: if e < currentE:
moveType = 'retract' moveType = 'retract'
totalExtrusion += e - currentE
currentE = e
else: else:
if e > 0: if e > 0:
moveType = 'extrude' moveType = 'extrude'
if e < 0: if e < 0:
moveType = 'retract' moveType = 'retract'
totalExtrusion += e totalExtrusion += e - currentE
currentE += e currentE = e
if totalExtrusion > maxExtrusion: if totalExtrusion > maxExtrusion:
maxExtrusion = totalExtrusion maxExtrusion = totalExtrusion
if moveType == 'move' and oldPos.z != pos.z: if moveType == 'move' and oldPos.z != pos.z:
@ -161,6 +161,7 @@ class gcode(object):
currentLayer.append(currentPath) currentLayer.append(currentPath)
newPos = pos.copy() newPos = pos.copy()
newPos.e = totalExtrusion newPos.e = totalExtrusion
newPos.extrudeAmountMultiply = extrudeAmountMultiply
currentPath.list.append(newPos) currentPath.list.append(newPos)
elif G == 4: #Delay elif G == 4: #Delay
S = self.getCodeFloat(line, 'S') S = self.getCodeFloat(line, 'S')
@ -242,6 +243,10 @@ class gcode(object):
pass pass
elif M == 190: #Set bed temperature & wait elif M == 190: #Set bed temperature & wait
pass pass
elif M == 221: #Extrude amount multiplier
s = self.getCodeFloat(line, 'S')
if s != None:
extrudeAmountMultiply = s / 100.0
else: else:
print "Unknown M code:" + str(M) print "Unknown M code:" + str(M)
self.layerList.append(currentLayer) self.layerList.append(currentLayer)

View file

@ -3,7 +3,7 @@ from __future__ import division
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module. #Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__ import __init__
import os, traceback, math, re, zlib, base64, time, sys, platform, glob import os, traceback, math, re, zlib, base64, time, sys, platform, glob, string
import cPickle as pickle import cPickle as pickle
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
import ConfigParser import ConfigParser
@ -621,3 +621,20 @@ def runPostProcessingPlugins(gcodefilename):
locationInfo = traceback.extract_tb(sys.exc_info()[2])[-1] locationInfo = traceback.extract_tb(sys.exc_info()[2])[-1]
return "%s: '%s' @ %s:%s:%d" % (str(sys.exc_info()[0].__name__), str(sys.exc_info()[1]), os.path.basename(locationInfo[0]), locationInfo[2], locationInfo[1]) return "%s: '%s' @ %s:%s:%d" % (str(sys.exc_info()[0].__name__), str(sys.exc_info()[1]), os.path.basename(locationInfo[0]), locationInfo[2], locationInfo[1])
return None return None
def getSDcardDrives():
drives = ['']
if platform.system() == "Windows":
from ctypes import windll
bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.uppercase:
if bitmask & 1:
drives.append(letter + ':/')
bitmask >>= 1
if platform.system() == "Darwin":
drives = []
for volume in glob.glob('/Volumes/*'):
if stat.S_ISLNK(os.lstat(volume).st_mode):
continue
drives.append(volume)
return drives