#configBase.SettingRow(right, 'save_profile')
#configBase.TitleRow(right, 'SD Card settings')
- #configBase.SettingRow(right, 'sdpath', removableStorage.getPossibleSDcardDrives())
configBase.TitleRow(right, 'Cura settings')
+ configBase.SettingRow(right, 'auto_detect_sd')
configBase.SettingRow(right, 'check_for_updates')
configBase.SettingRow(right, 'submit_slice_information')
self.sceneUpdated()
def sceneUpdated(self):
- self._sceneUpdateTimer.Start(1, True)
+ self._sceneUpdateTimer.Start(500, True)
self._slicer.abortSlicer()
self._scene.setSizeOffsets(numpy.array(profile.calculateObjectSizeOffsets(), numpy.float32))
self.QueueRefresh()
setting('save_profile', 'False', bool, 'preference', 'hidden').setLabel('Save profile on slice', 'When slicing save the profile as [stl_file]_profile.ini next to the model.')
setting('filament_cost_kg', '0', float, 'preference', 'hidden').setLabel('Cost (price/kg)', 'Cost of your filament per kg, to estimate the cost of the final print.')
setting('filament_cost_meter', '0', float, 'preference', 'hidden').setLabel('Cost (price/m)', 'Cost of your filament per meter, to estimate the cost of the final print.')
-setting('sdpath', '', str, 'preference', 'hidden').setLabel('SD card drive', 'Location of your SD card, when using the copy to SD feature.')
+setting('auto_detect_sd', 'True', bool, 'preference', 'hidden').setLabel('Auto detect SD card drive', 'Auto detect the SD card. You can disable this because on some systems external hard-drives or USB sticks are detected as SD card.')
setting('check_for_updates', 'True', bool, 'preference', 'hidden').setLabel('Check for updates', 'Check for newer versions of Cura on startup')
setting('submit_slice_information', 'False', bool, 'preference', 'hidden').setLabel('Send usage statistics', 'Submit anonymous usage information to improve next versions of Cura')
except:
from xml.etree import ElementTree
+from Cura.util import profile
+
_removeableCache = None
_removeableCacheTime = None
if _removeableCache is not None and time.time() - _removeableCacheTime < 5.0:
return _removeableCache
+ if profile.getPreference('auto_detect_sd') == 'False':
+ return []
+
drives = []
if platform.system() == "Windows":
from ctypes import windll
def ejectDrive(driveName):
if platform.system() == "Windows":
- cmd = '"%s" %s>NUL' % (os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'EjectMedia.exe')), driveName)
+ cmd = [os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'EjectMedia.exe')), driveName]
elif platform.system() == "Darwin":
- cmd = "diskutil eject '%s' > /dev/null 2>&1" % (driveName)
+ cmd = ["diskutil", "eject", driveName]
else:
- cmd = "umount '%s' > /dev/null 2>&1" % (driveName)
- if os.system(cmd):
+ cmd = ["umount", driveName]
+
+ kwargs = {}
+ if subprocess.mswindows:
+ su = subprocess.STARTUPINFO()
+ su.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+ su.wShowWindow = subprocess.SW_HIDE
+ kwargs['startupinfo'] = su
+ p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs)
+ output = p.communicate()
+
+ if p.wait():
+ print output[0]
+ print output[1]
return False
else:
return True