1 __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
5 from Cura.util import profile
7 class simpleModePanel(wx.Panel):
8 "Main user interface window for Quickprint mode"
9 def __init__(self, parent, callback):
10 super(simpleModePanel, self).__init__(parent)
11 self._callback = callback
13 #toolsMenu = wx.Menu()
14 #i = toolsMenu.Append(-1, 'Switch to Normal mode...')
15 #self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i)
16 #self.menubar.Insert(1, toolsMenu, 'Normal mode')
18 printTypePanel = wx.Panel(self)
19 self.printTypeHigh = wx.RadioButton(printTypePanel, -1, _("High quality print"), style=wx.RB_GROUP)
20 self.printTypeNormal = wx.RadioButton(printTypePanel, -1, _("Normal quality print"))
21 self.printTypeLow = wx.RadioButton(printTypePanel, -1, _("Fast low quality print"))
22 self.printTypeJoris = wx.RadioButton(printTypePanel, -1, _("Thin walled cup or vase"))
23 self.printTypeJoris.Hide()
25 printMaterialPanel = wx.Panel(self)
26 self.printMaterialPLA = wx.RadioButton(printMaterialPanel, -1, 'PLA', style=wx.RB_GROUP)
27 self.printMaterialABS = wx.RadioButton(printMaterialPanel, -1, 'ABS')
28 self.printMaterialDiameter = wx.TextCtrl(printMaterialPanel, -1, profile.getProfileSetting('filament_diameter'))
29 if profile.getMachineSetting('gcode_flavor') == 'UltiGCode':
30 printMaterialPanel.Show(False)
32 self.printSupport = wx.CheckBox(self, -1, _("Print support structure"))
34 sizer = wx.GridBagSizer()
37 sb = wx.StaticBox(printTypePanel, label=_("Select a quickprint profile:"))
38 boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
39 boxsizer.Add(self.printTypeHigh)
40 boxsizer.Add(self.printTypeNormal)
41 boxsizer.Add(self.printTypeLow)
42 boxsizer.Add(self.printTypeJoris, border=5, flag=wx.TOP)
43 printTypePanel.SetSizer(wx.BoxSizer(wx.VERTICAL))
44 printTypePanel.GetSizer().Add(boxsizer, flag=wx.EXPAND)
45 sizer.Add(printTypePanel, (0,0), flag=wx.EXPAND)
47 sb = wx.StaticBox(printMaterialPanel, label=_("Material:"))
48 boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
49 boxsizer.Add(self.printMaterialPLA)
50 boxsizer.Add(self.printMaterialABS)
51 boxsizer.Add(wx.StaticText(printMaterialPanel, -1, _("Diameter:")))
52 boxsizer.Add(self.printMaterialDiameter)
53 printMaterialPanel.SetSizer(wx.BoxSizer(wx.VERTICAL))
54 printMaterialPanel.GetSizer().Add(boxsizer, flag=wx.EXPAND)
55 sizer.Add(printMaterialPanel, (1,0), flag=wx.EXPAND)
57 sb = wx.StaticBox(self, label=_("Other:"))
58 boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
59 boxsizer.Add(self.printSupport)
60 sizer.Add(boxsizer, (2,0), flag=wx.EXPAND)
62 self.printTypeNormal.SetValue(True)
63 self.printMaterialPLA.SetValue(True)
65 self.printTypeHigh.Bind(wx.EVT_RADIOBUTTON, lambda e: self._callback())
66 self.printTypeNormal.Bind(wx.EVT_RADIOBUTTON, lambda e: self._callback())
67 self.printTypeLow.Bind(wx.EVT_RADIOBUTTON, lambda e: self._callback())
68 #self.printTypeJoris.Bind(wx.EVT_RADIOBUTTON, lambda e: self._callback())
70 self.printMaterialPLA.Bind(wx.EVT_RADIOBUTTON, lambda e: self._callback())
71 self.printMaterialABS.Bind(wx.EVT_RADIOBUTTON, lambda e: self._callback())
72 self.printMaterialDiameter.Bind(wx.EVT_TEXT, lambda e: self._callback())
74 self.printSupport.Bind(wx.EVT_CHECKBOX, lambda e: self._callback())
77 put = profile.setTempOverride
78 get = profile.getProfileSetting
79 for setting in profile.settingsList:
80 if not setting.isProfile():
82 profile.setTempOverride(setting.getName(), setting.getDefault())
84 if self.printSupport.GetValue():
85 put('support', _("Exterior Only"))
87 nozzle_size = float(get('nozzle_size'))
88 if self.printTypeNormal.GetValue():
89 put('layer_height', '0.2')
90 put('wall_thickness', nozzle_size * 2.0)
91 put('layer_height', '0.10')
92 put('fill_density', '20')
93 elif self.printTypeLow.GetValue():
94 put('wall_thickness', nozzle_size * 2.5)
95 put('layer_height', '0.20')
96 put('fill_density', '10')
97 put('print_speed', '60')
98 put('cool_min_layer_time', '3')
99 put('bottom_layer_speed', '30')
100 elif self.printTypeHigh.GetValue():
101 put('wall_thickness', nozzle_size * 2.0)
102 put('layer_height', '0.06')
103 put('fill_density', '20')
104 put('bottom_layer_speed', '15')
105 elif self.printTypeJoris.GetValue():
106 put('wall_thickness', nozzle_size * 1.5)
108 put('filament_diameter', self.printMaterialDiameter.GetValue())
109 if self.printMaterialPLA.GetValue():
111 if self.printMaterialABS.GetValue():
112 put('print_bed_temperature', '100')
113 put('platform_adhesion', 'Brim')
114 put('filament_flow', '107')
115 put('print_temperature', '245')
116 put('plugin_config', '')
118 def updateProfileToControls(self):