chiark / gitweb /
Add proper head sizes for the Ultimaker2.
[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                 extruderCount = int(profile.getMachineSetting('extruder_amount'))
18
19                 self.panel = configBase.configPanelBase(self)
20
21                 left, right, main = self.panel.CreateConfigPanel(self)
22
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)
27
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')
32
33                 #configBase.TitleRow(right, 'Slicer settings')
34                 #configBase.SettingRow(right, 'save_profile')
35
36                 #configBase.TitleRow(right, 'SD Card settings')
37
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')
42
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())
46
47                 main.Fit()
48                 self.Fit()
49
50         def OnClose(self, e):
51                 #self.parent.reloadSettingPanels()
52                 self.Destroy()
53
54 class machineSettingsDialog(wx.Dialog):
55         def __init__(self, parent):
56                 super(machineSettingsDialog, self).__init__(None, title="Machine settings")
57
58                 wx.EVT_CLOSE(self, self.OnClose)
59
60                 self.parent = parent
61                 extruderCount = int(profile.getMachineSetting('extruder_amount'))
62
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)
69
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)
80
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)
87
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)
92
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)
96
97                         self.nb.AddPage(main, profile.getMachineSetting('machine_name', idx).title())
98
99                 self.nb.SetSelection(int(profile.getPreferenceFloat('active_machine')))
100
101                 self.okButton = wx.Button(self.panel, -1, 'Ok')
102                 self.panel.GetSizer().Add(self.okButton, flag=wx.ALL, border=5)
103                 self.okButton.Bind(wx.EVT_BUTTON, lambda e: self.Close())
104
105                 main.Fit()
106                 self.Fit()
107
108         def OnClose(self, e):
109                 self.parent.reloadSettingPanels()
110                 self.Destroy()