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 extruderCount = int(profile.getMachineSetting('extruder_amount'))
19 self.panel = configBase.configPanelBase(self)
21 left, right, main = self.panel.CreateConfigPanel(self)
23 configBase.TitleRow(left, _("Colours"))
24 configBase.SettingRow(left, 'model_colour', wx.Colour)
25 for i in xrange(1, extruderCount):
26 configBase.SettingRow(left, 'model_colour%d' % (i+1), wx.Colour)
28 configBase.TitleRow(right, _("Filament settings"))
29 configBase.SettingRow(right, 'filament_physical_density')
30 configBase.SettingRow(right, 'filament_cost_kg')
31 configBase.SettingRow(right, 'filament_cost_meter')
33 #configBase.TitleRow(right, 'Slicer settings')
34 #configBase.SettingRow(right, 'save_profile')
36 #configBase.TitleRow(right, 'SD Card settings')
38 configBase.TitleRow(right, _("Cura settings"))
39 configBase.SettingRow(right, 'auto_detect_sd')
40 configBase.SettingRow(right, 'check_for_updates')
41 configBase.SettingRow(right, 'submit_slice_information')
43 self.okButton = wx.Button(right, -1, 'Ok')
44 right.GetSizer().Add(self.okButton, (right.GetSizer().GetRows(), 0), flag=wx.BOTTOM, border=5)
45 self.okButton.Bind(wx.EVT_BUTTON, lambda e: self.Close())
51 #self.parent.reloadSettingPanels()
54 class machineSettingsDialog(wx.Dialog):
55 def __init__(self, parent):
56 super(machineSettingsDialog, self).__init__(None, title="Machine settings")
58 wx.EVT_CLOSE(self, self.OnClose)
61 extruderCount = int(profile.getMachineSetting('extruder_amount'))
63 self.panel = configBase.configPanelBase(self)
64 self.SetSizer(wx.BoxSizer(wx.HORIZONTAL))
65 self.GetSizer().Add(self.panel, 1, wx.EXPAND)
66 self.nb = wx.Notebook(self.panel)
67 self.panel.SetSizer(wx.BoxSizer(wx.VERTICAL))
68 self.panel.GetSizer().Add(self.nb, 1, wx.EXPAND)
70 for idx in xrange(0, profile.getMachineCount()):
71 left, right, main = self.panel.CreateConfigPanel(self.nb)
72 configBase.TitleRow(left, _("Machine settings"))
73 configBase.SettingRow(left, 'steps_per_e', index=idx)
74 configBase.SettingRow(left, 'machine_width', index=idx)
75 configBase.SettingRow(left, 'machine_depth', index=idx)
76 configBase.SettingRow(left, 'machine_height', index=idx)
77 configBase.SettingRow(left, 'extruder_amount', index=idx)
78 configBase.SettingRow(left, 'has_heated_bed', index=idx)
79 configBase.SettingRow(left, 'gcode_flavor', index=idx)
81 configBase.TitleRow(right, _("Printer head size"))
82 configBase.SettingRow(right, 'extruder_head_size_min_x', index=idx)
83 configBase.SettingRow(right, 'extruder_head_size_min_y', index=idx)
84 configBase.SettingRow(right, 'extruder_head_size_max_x', index=idx)
85 configBase.SettingRow(right, 'extruder_head_size_max_y', index=idx)
86 configBase.SettingRow(right, 'extruder_head_size_height', index=idx)
88 for i in xrange(1, extruderCount):
89 configBase.TitleRow(left, _("Extruder %d") % (i+1))
90 configBase.SettingRow(left, 'extruder_offset_x%d' % (i), index=idx)
91 configBase.SettingRow(left, 'extruder_offset_y%d' % (i), index=idx)
93 configBase.TitleRow(right, _("Communication settings"))
94 configBase.SettingRow(right, 'serial_port', ['AUTO'] + machineCom.serialList(), index=idx)
95 configBase.SettingRow(right, 'serial_baud', ['AUTO'] + map(str, machineCom.baudrateList()), index=idx)
97 self.nb.AddPage(main, profile.getMachineSetting('machine_name', idx))
99 self.okButton = wx.Button(self.panel, -1, 'Ok')
100 self.panel.GetSizer().Add(self.okButton, flag=wx.ALL, border=5)
101 self.okButton.Bind(wx.EVT_BUTTON, lambda e: self.Close())
106 def OnClose(self, e):
107 self.parent.reloadSettingPanels()