1 from __future__ import absolute_import
2 __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
6 from Cura.gui import configBase
7 from Cura.util import machineCom
8 from Cura.util import profile
10 class preferencesDialog(wx.Dialog):
11 def __init__(self, parent):
12 super(preferencesDialog, self).__init__(None, title="Preferences")
14 wx.EVT_CLOSE(self, self.OnClose)
17 self.oldExtruderAmount = int(profile.getMachineSetting('extruder_amount'))
19 self.panel = configBase.configPanelBase(self)
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')
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')
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))
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)
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')
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()))
57 #configBase.TitleRow(right, 'Slicer settings')
58 #configBase.SettingRow(right, 'save_profile')
60 #configBase.TitleRow(right, 'SD Card settings')
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')
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())
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()