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