chiark / gitweb /
Some small text updates.
[cura.git] / Cura / gui / preferencesDialog.py
1 from __future__ import absolute_import\r
2 import __init__\r
3 \r
4 import wx, os, platform, types, string, glob, stat\r
5 import ConfigParser\r
6 \r
7 from gui import configBase\r
8 from util import validators\r
9 from util import machineCom\r
10 from util import profile\r
11 \r
12 class preferencesDialog(configBase.configWindowBase):\r
13         def __init__(self, parent):\r
14                 super(preferencesDialog, self).__init__(title="Preferences", style=wx.DEFAULT_DIALOG_STYLE)\r
15                 \r
16                 wx.EVT_CLOSE(self, self.OnClose)\r
17                 \r
18                 self.parent = parent\r
19                 self.oldExtruderAmount = int(profile.getPreference('extruder_amount'))\r
20                 \r
21                 left, right, main = self.CreateConfigPanel(self)\r
22                 configBase.TitleRow(left, 'Machine settings')\r
23                 c = configBase.SettingRow(left, 'Steps per E', 'steps_per_e', '0', 'Amount of steps per mm filament extrusion', type = 'preference')\r
24                 validators.validFloat(c, 0.1)\r
25                 c = configBase.SettingRow(left, 'Maximum width (mm)', 'machine_width', '205', 'Size of the machine in mm', type = 'preference')\r
26                 validators.validFloat(c, 10.0)\r
27                 c = configBase.SettingRow(left, 'Maximum depth (mm)', 'machine_depth', '205', 'Size of the machine in mm', type = 'preference')\r
28                 validators.validFloat(c, 10.0)\r
29                 c = configBase.SettingRow(left, 'Maximum height (mm)', 'machine_height', '200', 'Size of the machine in mm', type = 'preference')\r
30                 validators.validFloat(c, 10.0)\r
31                 c = configBase.SettingRow(left, 'Extruder count', 'extruder_amount', ['1', '2', '3', '4'], 'Amount of extruders in your machine.', type = 'preference')\r
32                 c = configBase.SettingRow(left, 'Heated bed', 'has_heated_bed', False, 'If you have an heated bed, this enabled heated bed settings', type = 'preference')\r
33                 \r
34                 for i in xrange(1, self.oldExtruderAmount):\r
35                         configBase.TitleRow(left, 'Extruder %d' % (i+1))\r
36                         c = configBase.SettingRow(left, 'Offset X', 'extruder_offset_x%d' % (i), '0.0', 'The offset of your secondary extruder compared to the primary.', type = 'preference')\r
37                         validators.validFloat(c)\r
38                         c = configBase.SettingRow(left, 'Offset Y', 'extruder_offset_y%d' % (i), '0.0', 'The offset of your secondary extruder compared to the primary.', type = 'preference')\r
39                         validators.validFloat(c)\r
40 \r
41                 configBase.TitleRow(left, 'Colours')\r
42                 c = configBase.SettingRow(left, 'Model colour', 'model_colour', wx.Colour(0,0,0), '', type = 'preference')\r
43                 for i in xrange(1, self.oldExtruderAmount):\r
44                         c = configBase.SettingRow(left, 'Model colour (%d)' % (i+1), 'model_colour%d' % (i+1), wx.Colour(0,0,0), '', type = 'preference')\r
45 \r
46                 configBase.TitleRow(right, 'Filament settings')\r
47                 c = configBase.SettingRow(right, 'Density (kg/m3)', 'filament_density', '1300', 'Weight of the filament per m3. Around 1300 for PLA. And around 1040 for ABS. This value is used to estimate the weight if the filament used for the print.', type = 'preference')\r
48                 validators.validFloat(c, 500.0, 3000.0)\r
49                 c = configBase.SettingRow(right, 'Cost (price/kg)', 'filament_cost_kg', '0', 'Cost of your filament per kg, to estimate the cost of the final print.', type = 'preference')\r
50                 validators.validFloat(c, 0.0)\r
51                 c = configBase.SettingRow(right, 'Cost (price/m)', 'filament_cost_meter', '0', 'Cost of your filament per meter, to estimate the cost of the final print.', type = 'preference')\r
52                 validators.validFloat(c, 0.0)\r
53                 \r
54                 configBase.TitleRow(right, 'Communication settings')\r
55                 c = configBase.SettingRow(right, 'Serial port', 'serial_port', ['AUTO'] + machineCom.serialList(), 'Serial port to use for communication with the printer', type = 'preference')\r
56                 c = configBase.SettingRow(right, 'Baudrate', 'serial_baud', ['AUTO'] + map(str, machineCom.baudrateList()), 'Speed of the serial port communication\nNeeds to match your firmware settings\nCommon values are 250000, 115200, 57600', type = 'preference')\r
57 \r
58                 configBase.TitleRow(right, 'Slicer settings')\r
59                 #c = configBase.SettingRow(right, 'Slicer selection', 'slicer', ['Cura (Skeinforge based)', 'Slic3r'], 'Which slicer to use to slice objects. Usually the Cura engine produces the best results. But Slic3r is developing fast and is faster with slicing.', type = 'preference')\r
60                 c = configBase.SettingRow(right, 'Save profile on slice', 'save_profile', False, 'When slicing save the profile as [stl_file]_profile.ini next to the model.', type = 'preference')\r
61 \r
62                 configBase.TitleRow(right, 'SD Card settings')\r
63                 if len(profile.getSDcardDrives()) > 1:\r
64                         c = configBase.SettingRow(right, 'SD card drive', 'sdpath', profile.getSDcardDrives(), 'Location of your SD card, when using the copy to SD feature.', type = 'preference')\r
65                 else:\r
66                         c = configBase.SettingRow(right, 'SD card path', 'sdpath', '', 'Location of your SD card, when using the copy to SD feature.', type = 'preference')\r
67                 c = configBase.SettingRow(right, 'Copy to SD with 8.3 names', 'sdshortnames', False, 'Save the gcode files in short filenames, so they are properly shown on the UltiController', type = 'preference')\r
68 \r
69                 self.okButton = wx.Button(right, -1, 'Ok')\r
70                 right.GetSizer().Add(self.okButton, (right.GetSizer().GetRows(), 0), flag=wx.BOTTOM, border=5)\r
71                 self.okButton.Bind(wx.EVT_BUTTON, self.OnClose)\r
72                 \r
73                 self.MakeModal(True)\r
74                 main.Fit()\r
75                 self.Fit()\r
76 \r
77         def OnClose(self, e):\r
78                 if self.oldExtruderAmount != int(profile.getPreference('extruder_amount')):\r
79                         wx.MessageBox('After changing the amount of extruders you need to restart Cura for full effect.', 'Extruder amount warning.', wx.OK | wx.ICON_INFORMATION)\r
80                 self.MakeModal(False)\r
81                 self.parent.updateProfileToControls()\r
82                 self.Destroy()\r