From: daid303 Date: Thu, 28 Mar 2013 15:48:35 +0000 (+0100) Subject: Only show removable media on windows for SD cards. Needs work for mac and linux. X-Git-Tag: 13.05~149 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=2a8dc69ebfaf03856a87beb969894ede0be29993;p=cura.git Only show removable media on windows for SD cards. Needs work for mac and linux. --- diff --git a/Cura/gui/preferencesDialog.py b/Cura/gui/preferencesDialog.py index baf103eb..6886b133 100644 --- a/Cura/gui/preferencesDialog.py +++ b/Cura/gui/preferencesDialog.py @@ -50,10 +50,7 @@ class preferencesDialog(wx.Frame): configBase.SettingRow(right, 'save_profile') configBase.TitleRow(right, 'SD Card settings') - if len(profile.getSDcardDrives()) > 1: - configBase.SettingRow(right, 'sdpath', profile.getSDcardDrives()) - else: - configBase.SettingRow(right, 'sdpath') + configBase.SettingRow(right, 'sdpath', profile.getSDcardDrives()) configBase.SettingRow(right, 'sdshortnames') configBase.TitleRow(right, 'Cura settings') diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 3810fe92..69779063 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -755,7 +755,7 @@ def getPluginList(): item['params'].append({'name': m.group(1), 'type': m.group(2), 'default': m.group(3), 'description': m.group(4)}) else: print "Unknown item in effect meta data: %s %s" % (line[0], line[1]) - if item['name'] != None and item['type'] == 'postprocess': + if item['name'] is not None and item['type'] == 'postprocess': ret.append(item) return ret @@ -800,18 +800,21 @@ def runPostProcessingPlugins(gcodefilename): return None def getSDcardDrives(): - drives = [''] + drives = [] if platform.system() == "Windows": from ctypes import windll bitmask = windll.kernel32.GetLogicalDrives() for letter in string.uppercase: - if bitmask & 1: + if bitmask & 1 and windll.kernel32.GetDriveTypeA(letter + ':/') == 2: drives.append(letter + ':/') bitmask >>= 1 - if platform.system() == "Darwin": - drives = [] + elif platform.system() == "Darwin": for volume in glob.glob('/Volumes/*'): if stat.S_ISLNK(os.lstat(volume).st_mode): continue + #'Ejectable: Yes' in os.system('diskutil info \'%s\'' % (volume)) + drives.append(volume) + else: + for volume in glob.glob('/media/*'): drives.append(volume) return drives