chiark / gitweb /
Seperate the machine settings from the preference settings
[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 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.getMachineSetting('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                 configBase.SettingRow(left, 'gcode_flavor')
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.getMachineSetting('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()