From: daid303 Date: Fri, 29 Mar 2013 15:15:16 +0000 (+0100) Subject: Put SD card code in a seperate file. X-Git-Tag: 13.05~142 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=8571f9fdb1279c5ff09773e36247993c5b530b9c;p=cura.git Put SD card code in a seperate file. --- diff --git a/Cura/gui/preferencesDialog.py b/Cura/gui/preferencesDialog.py index 6886b133..10cac728 100644 --- a/Cura/gui/preferencesDialog.py +++ b/Cura/gui/preferencesDialog.py @@ -3,7 +3,7 @@ from __future__ import absolute_import import wx from Cura.gui import configBase -from Cura.util import validators +from Cura.util import removableStorage from Cura.util import machineCom from Cura.util import profile @@ -50,8 +50,7 @@ class preferencesDialog(wx.Frame): configBase.SettingRow(right, 'save_profile') configBase.TitleRow(right, 'SD Card settings') - configBase.SettingRow(right, 'sdpath', profile.getSDcardDrives()) - configBase.SettingRow(right, 'sdshortnames') + configBase.SettingRow(right, 'sdpath', removableStorage.getPossibleSDcardDrives()) configBase.TitleRow(right, 'Cura settings') configBase.SettingRow(right, 'check_for_updates') diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index 933737a7..64d8e5c3 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -273,7 +273,10 @@ class SceneView(openglGui.glGuiPanel): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT) def OnPaint(self,e): - self.printButton._imageID = 6 if machineCom.machineIsConnected() else 2 + if machineCom.machineIsConnected(): + self.printButton._imageID = 6 + else: + self.printButton._imageID = 3 if self._animView is not None: self._viewTarget = self._animView.getPosition() diff --git a/Cura/resources/images/glButtons.png b/Cura/resources/images/glButtons.png index 1720620f..de4ac15c 100644 Binary files a/Cura/resources/images/glButtons.png and b/Cura/resources/images/glButtons.png differ diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 69779063..8388e657 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -261,7 +261,6 @@ setting('save_profile', 'False', bool, 'preference', 'hidden').setLabel('Save pr 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('sdshortnames', 'False', bool, 'preference', 'hidden').setLabel('Copy to SD with 8.3 names', 'Save the gcode files in short filenames, so they are properly shown on the UltiController') 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') @@ -798,23 +797,3 @@ def runPostProcessingPlugins(gcodefilename): 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 None - -def getSDcardDrives(): - drives = [] - if platform.system() == "Windows": - from ctypes import windll - bitmask = windll.kernel32.GetLogicalDrives() - for letter in string.uppercase: - if bitmask & 1 and windll.kernel32.GetDriveTypeA(letter + ':/') == 2: - drives.append(letter + ':/') - bitmask >>= 1 - 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 diff --git a/Cura/util/removableStorage.py b/Cura/util/removableStorage.py new file mode 100644 index 00000000..e020c7d5 --- /dev/null +++ b/Cura/util/removableStorage.py @@ -0,0 +1,26 @@ +import platform +import string +import glob +import os +import stat + +def getPossibleSDcardDrives(): + drives = [] + if platform.system() == "Windows": + from ctypes import windll + bitmask = windll.kernel32.GetLogicalDrives() + for letter in string.uppercase: + if bitmask & 1 and windll.kernel32.GetDriveTypeA(letter + ':/') == 2: + drives.append(letter + ':/') + bitmask >>= 1 + 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 +