chiark / gitweb /
Only show removable media on windows for SD cards. Needs work for mac and linux.
authordaid303 <daid303@gmail.com>
Thu, 28 Mar 2013 15:48:35 +0000 (16:48 +0100)
committerdaid303 <daid303@gmail.com>
Thu, 28 Mar 2013 15:48:35 +0000 (16:48 +0100)
Cura/gui/preferencesDialog.py
Cura/util/profile.py

index baf103eb9448bcc6d32ddee1e8fb2c4c45353238..6886b133f4286667defd7036a4a287695f67b190 100644 (file)
@@ -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')
index 3810fe92e1f20671a84bcaa3b29254fa925fd251..69779063eb30e3ebf26de19adbb95d4feb6b127d 100644 (file)
@@ -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