chiark / gitweb /
Add option to disable SD auto detect. Log output if SD card remove fails.
[cura.git] / Cura / gui / preferencesDialog.py
1 from __future__ import absolute_import
2 __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
3
4 import wx
5
6 from Cura.gui import configBase
7 from Cura.util import removableStorage
8 from Cura.util import machineCom
9 from Cura.util import profile
10
11 class preferencesDialog(wx.Dialog):
12         def __init__(self, parent):
13                 super(preferencesDialog, self).__init__(None, title="Preferences")
14                 
15                 wx.EVT_CLOSE(self, self.OnClose)
16                 
17                 self.parent = parent
18                 self.oldExtruderAmount = int(profile.getPreference('extruder_amount'))
19
20                 self.panel = configBase.configPanelBase(self)
21                 
22                 left, right, main = self.panel.CreateConfigPanel(self)
23                 configBase.TitleRow(left, 'Machine settings')
24                 configBase.SettingRow(left, 'steps_per_e')
25                 configBase.SettingRow(left, 'machine_width')
26                 configBase.SettingRow(left, 'machine_depth')
27                 configBase.SettingRow(left, 'machine_height')
28                 configBase.SettingRow(left, 'extruder_amount')
29                 configBase.SettingRow(left, 'has_heated_bed')
30
31                 configBase.TitleRow(left, 'Printer head size')
32                 configBase.SettingRow(left, 'extruder_head_size_min_x')
33                 configBase.SettingRow(left, 'extruder_head_size_min_y')
34                 configBase.SettingRow(left, 'extruder_head_size_max_x')
35                 configBase.SettingRow(left, 'extruder_head_size_max_y')
36                 configBase.SettingRow(left, 'extruder_head_size_height')
37
38                 for i in xrange(1, self.oldExtruderAmount):
39                         configBase.TitleRow(left, 'Extruder %d' % (i+1))
40                         configBase.SettingRow(left, 'extruder_offset_x%d' % (i))
41                         configBase.SettingRow(left, 'extruder_offset_y%d' % (i))
42
43                 configBase.TitleRow(right, 'Colours')
44                 configBase.SettingRow(right, 'model_colour', wx.Colour)
45                 for i in xrange(1, self.oldExtruderAmount):
46                         configBase.SettingRow(right, 'model_colour%d' % (i+1), wx.Colour)
47
48                 configBase.TitleRow(right, 'Filament settings')
49                 configBase.SettingRow(right, 'filament_physical_density')
50                 configBase.SettingRow(right, 'filament_cost_kg')
51                 configBase.SettingRow(right, 'filament_cost_meter')
52
53                 configBase.TitleRow(right, 'Communication settings')
54                 configBase.SettingRow(right, 'serial_port', ['AUTO'] + machineCom.serialList())
55                 configBase.SettingRow(right, 'serial_baud', ['AUTO'] + map(str, machineCom.baudrateList()))
56
57                 #configBase.TitleRow(right, 'Slicer settings')
58                 #configBase.SettingRow(right, 'save_profile')
59
60                 #configBase.TitleRow(right, 'SD Card settings')
61
62                 configBase.TitleRow(right, 'Cura settings')
63                 configBase.SettingRow(right, 'auto_detect_sd')
64                 configBase.SettingRow(right, 'check_for_updates')
65                 configBase.SettingRow(right, 'submit_slice_information')
66
67                 self.okButton = wx.Button(right, -1, 'Ok')
68                 right.GetSizer().Add(self.okButton, (right.GetSizer().GetRows(), 0), flag=wx.BOTTOM, border=5)
69                 self.okButton.Bind(wx.EVT_BUTTON, lambda e: self.Close())
70                 
71                 main.Fit()
72                 self.Fit()
73
74         def OnClose(self, e):
75                 if self.oldExtruderAmount != int(profile.getPreference('extruder_amount')):
76                         wx.MessageBox('After changing the amount of extruders you need to restart Cura for full effect.', 'Extruder amount warning.', wx.OK | wx.ICON_INFORMATION)
77                 self.parent.updateProfileToControls()
78                 self.Destroy()