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