chiark / gitweb /
Merge pull request #1113 from pmsimard/15.01_RC10_SDFolderStructure
authordaid <daid303@gmail.com>
Fri, 30 Jan 2015 07:56:10 +0000 (08:56 +0100)
committerdaid <daid303@gmail.com>
Fri, 30 Jan 2015 07:56:10 +0000 (08:56 +0100)
SD replication Default path to MyDocuments & browse button

Cura/gui/preferencesDialog.py
Cura/util/profile.py

index 3f9acd21ac199389a6ae99b2cb4fc6ced873c7f8..708d30b56919e2662d460534636b0b503efcee09 100644 (file)
@@ -1,6 +1,7 @@
 __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
 
 import wx
+import os
 
 from Cura.gui import configWizard
 from Cura.gui import configBase
@@ -48,7 +49,12 @@ class preferencesDialog(wx.Dialog):
                configBase.TitleRow(right, 'SD Card settings')
                configBase.SettingRow(right, 'auto_detect_sd')
                configBase.SettingRow(right, 'sdcard_rootfolder')
-               
+               #same as the expert settings button.
+               self.browseButton = wx.Button(right, -1, '...', style=wx.BU_EXACTFIT)
+               self.browseButton.SetFont(wx.Font(wx.SystemSettings.GetFont(wx.SYS_ANSI_VAR_FONT).GetPointSize() * 0.8, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_NORMAL))
+               self.browseButton.Bind(wx.EVT_BUTTON, self.OnBrowseSDRootFolder)
+               right.GetSizer().Add(self.browseButton, (right.GetSizer().GetRows()-1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
+
                configBase.TitleRow(right, _("Cura settings"))
                configBase.SettingRow(right, 'check_for_updates')
                configBase.SettingRow(right, 'submit_slice_information')
@@ -64,6 +70,28 @@ class preferencesDialog(wx.Dialog):
                #self.parent.reloadSettingPanels()
                self.Destroy()
 
+       def OnBrowseSDRootFolder(self, e):
+               path = profile.getPreference('sdcard_rootfolder')
+               if path == '':
+                       path = os.path.expanduser('~/Documents')
+                       if not os.path.exists(path):
+                               path = ''
+
+               dlg=wx.DirDialog(self, _("Select replication root folder"), path)
+               if dlg.ShowModal() != wx.ID_OK:
+                       dlg.Destroy()
+                       return
+
+               profile.putPreference('sdcard_rootfolder', dlg.GetPath())
+               dlg.Destroy()
+               self.Close()
+               self.parent.OnPreferences(None)
+
+
+
+
+
+
 class machineSettingsDialog(wx.Dialog):
        def __init__(self, parent):
                super(machineSettingsDialog, self).__init__(None, title=_("Machine settings"))
index d7d75b357d6fba69eb227fb72fe1bb5bf16a7385..d94ed3f8559d81c825d523eb40a8f635ff17ec62 100644 (file)
@@ -487,7 +487,15 @@ setting('save_profile', 'False', bool, 'preference', 'hidden').setLabel(_("Save
 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('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('sdcard_rootfolder', '', str, 'preference', 'hidden').setLabel(_("Base folder to replicate on SD card"), _("The specified folder will be used as a base path. Any gcode generated from object coming from within that folder will be automatically saved on the SD card at the same sub-folder. Any object coming from outside of this path will save the gcode on the root folder of the card."))
+
+def _getMyDocumentsFolder():
+       path = os.path.expanduser('~/Documents')
+       if not os.path.exists(path):
+               path = ''
+
+       return path
+
+setting('sdcard_rootfolder', _getMyDocumentsFolder(), str, 'preference', 'hidden').setLabel(_("Base folder to replicate on SD card"), _("The specified folder will be used as a base path. Any gcode generated from object coming from within that folder will be automatically saved on the SD card at the same sub-folder. Any object coming from outside of this path will save the gcode on the root folder of the 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 future versions of Cura"))
 setting('youmagine_token', '', str, 'preference', 'hidden')