printrun-src/printrun/gui/controls.py

Wed, 20 Jan 2021 11:37:03 +0100

author
mdd
date
Wed, 20 Jan 2021 11:37:03 +0100
changeset 48
3c27b4ee6fec
parent 46
cce0af6351f0
permissions
-rw-r--r--

reimplemented lasercutter changes

48
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
1 # FILE MODIFIED BY NEOSOFT - MALTE DI DONATO
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
2 # Embed Lasercut controls
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
3
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
4 # This file is part of the Printrun suite.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
5 #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
6 # Printrun is free software: you can redistribute it and/or modify
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
7 # it under the terms of the GNU General Public License as published by
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
8 # the Free Software Foundation, either version 3 of the License, or
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
9 # (at your option) any later version.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
10 #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
11 # Printrun is distributed in the hope that it will be useful,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
14 # GNU General Public License for more details.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
15 #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
16 # You should have received a copy of the GNU General Public License
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
17 # along with Printrun. If not, see <http://www.gnu.org/licenses/>.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
18
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
19 import wx
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
20
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
21 from .xybuttons import XYButtons, XYButtonsMini
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
22 from .zbuttons import ZButtons, ZButtonsMini
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
23 from .graph import Graph
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
24 from .widgets import TempGauge
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
25 from wx.lib.agw.floatspin import FloatSpin
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
26
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
27 from .utils import make_button, make_custom_button
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
28
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
29 class XYZControlsSizer(wx.GridBagSizer):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
30
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
31 def __init__(self, root, parentpanel = None):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
32 super(XYZControlsSizer, self).__init__()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
33 if not parentpanel: parentpanel = root.panel
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
34 root.xyb = XYButtons(parentpanel, root.moveXY, root.homeButtonClicked, root.spacebarAction, root.bgcolor, zcallback=root.moveZ)
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
35 root.xyb.SetToolTip(_('[J]og controls. (Shift)+TAB ESC Shift/Ctrl+(arrows PgUp/PgDn)'))
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
36 self.Add(root.xyb, pos = (0, 1), flag = wx.ALIGN_CENTER)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
37 root.zb = ZButtons(parentpanel, root.moveZ, root.bgcolor)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
38 self.Add(root.zb, pos = (0, 2), flag = wx.ALIGN_CENTER)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
39
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
40 def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode = False):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
41 standalone_mode = extra_buttons is not None
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
42 base_line = 1 if standalone_mode else 2
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
43
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
44 if standalone_mode:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
45 gauges_base_line = base_line + 10
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
46 elif mini_mode and root.display_graph:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
47 gauges_base_line = base_line + 7
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
48 else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
49 gauges_base_line = base_line + 6
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
50 tempdisp_line = gauges_base_line + (2 if root.display_gauges else 0)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
51 if mini_mode and root.display_graph:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
52 e_base_line = base_line + 3
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
53 else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
54 e_base_line = base_line + 2
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
55
48
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
56 lasercut_base_line = 11
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
57
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
58 pos_mapping = {
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
59 "htemp_label": (base_line + 0, 0),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
60 "htemp_off": (base_line + 0, 2),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
61 "htemp_val": (base_line + 0, 3),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
62 "htemp_set": (base_line + 0, 4),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
63 "btemp_label": (base_line + 1, 0),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
64 "btemp_off": (base_line + 1, 2),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
65 "btemp_val": (base_line + 1, 3),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
66 "btemp_set": (base_line + 1, 4),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
67 "ebuttons": (e_base_line + 0, 0),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
68 "esettings": (e_base_line + 1, 0),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
69 "speedcontrol": (e_base_line + 2, 0),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
70 "flowcontrol": (e_base_line + 3, 0),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
71 "htemp_gauge": (gauges_base_line + 0, 0),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
72 "btemp_gauge": (gauges_base_line + 1, 0),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
73 "tempdisp": (tempdisp_line, 0),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
74 "extrude": (3, 0),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
75 "reverse": (3, 2),
48
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
76 "lasercut_optionsbtn": (lasercut_base_line, 0),
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
77 "lasercut_printbtn": (lasercut_base_line, 2),
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
78 "lasercut_material_thickness": (lasercut_base_line+1, 4),
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
79 "lasercut_material_thickness_label": (lasercut_base_line+1, 0),
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
80 "lasercut_pass_count": (lasercut_base_line+2, 4),
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
81 "lasercut_pass_count_label": (lasercut_base_line+2, 0),
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
82 "lasercut_pass_zdiff": (lasercut_base_line+3, 4),
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
83 "lasercut_pass_zdiff_label": (lasercut_base_line+3, 0),
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
84 }
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
85
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
86 span_mapping = {
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
87 "htemp_label": (1, 2),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
88 "htemp_off": (1, 1),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
89 "htemp_val": (1, 1),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
90 "htemp_set": (1, 1 if root.display_graph else 2),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
91 "btemp_label": (1, 2),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
92 "btemp_off": (1, 1),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
93 "btemp_val": (1, 1),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
94 "btemp_set": (1, 1 if root.display_graph else 2),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
95 "ebuttons": (1, 5 if root.display_graph else 6),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
96 "esettings": (1, 5 if root.display_graph else 6),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
97 "speedcontrol": (1, 5 if root.display_graph else 6),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
98 "flowcontrol": (1, 5 if root.display_graph else 6),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
99 "htemp_gauge": (1, 5 if mini_mode else 6),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
100 "btemp_gauge": (1, 5 if mini_mode else 6),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
101 "tempdisp": (1, 5 if mini_mode else 6),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
102 "extrude": (1, 2),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
103 "reverse": (1, 3),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
104 }
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
105
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
106 if standalone_mode:
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
107 pos_mapping["tempgraph"] = (base_line + 6, 0)
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
108 span_mapping["tempgraph"] = (3, 2)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
109 elif mini_mode:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
110 pos_mapping["tempgraph"] = (base_line + 2, 0)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
111 span_mapping["tempgraph"] = (1, 5)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
112 else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
113 pos_mapping["tempgraph"] = (base_line + 0, 5)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
114 span_mapping["tempgraph"] = (5, 1)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
115
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
116 if mini_mode:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
117 pos_mapping["etool_label"] = (0, 0)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
118 pos_mapping["etool_val"] = (0, 1)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
119 pos_mapping["edist_label"] = (0, 2)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
120 pos_mapping["edist_val"] = (0, 3)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
121 pos_mapping["edist_unit"] = (0, 4)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
122 else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
123 pos_mapping["edist_label"] = (0, 0)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
124 pos_mapping["edist_val"] = (1, 0)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
125 pos_mapping["edist_unit"] = (1, 1)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
126 pos_mapping["efeed_label"] = (0, 2)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
127 pos_mapping["efeed_val"] = (1, 2)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
128 pos_mapping["efeed_unit"] = (1, 3)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
129
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
130 def add(name, widget, *args, **kwargs):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
131 kwargs["pos"] = pos_mapping[name]
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
132 if name in span_mapping:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
133 kwargs["span"] = span_mapping[name]
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
134 if "container" in kwargs:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
135 container = kwargs["container"]
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
136 del kwargs["container"]
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
137 else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
138 container = self
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
139 container.Add(widget, *args, **kwargs)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
140
48
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
141 # Lasercutter quick controls #
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
142
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
143 root.lc_optionsbtn = make_button(parentpanel, _("Lasercutter options"), lambda e: PronterOptions(root, "Laser"), _("Open Lasercutter options"), style = wx.BU_EXACTFIT)
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
144 root.printerControls.append(root.lc_optionsbtn)
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
145 add("lasercut_optionsbtn", root.lc_optionsbtn, flag = wx.EXPAND)
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
146
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
147 root.lc_printbtn = make_button(parentpanel, _("Start cutting"), root.on_lc_printfile, _("Start printjob with lasercutting features"), style = wx.BU_EXACTFIT)
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
148 root.printerControls.append(root.lc_printbtn)
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
149 add("lasercut_printbtn", root.lc_printbtn, flag = wx.EXPAND)
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
150
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
151
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
152 root.lc_pass_count = speed_spin = FloatSpin(parentpanel, -1, value = root.settings.lc_pass_count, min_val = 1, max_val = 10, digits = 0, style = wx.ALIGN_LEFT, size = (80, -1))
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
153 add("lasercut_pass_count", root.lc_pass_count)
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
154 add("lasercut_pass_count_label", wx.StaticText(parentpanel, -1, _("Number of cutting passes:")), flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
155
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
156 root.lc_pass_zdiff = speed_spin = FloatSpin(parentpanel, -1, increment = 0.1, value = root.settings.lc_pass_zdiff, min_val = -2, max_val = 2, digits = 1, style = wx.ALIGN_LEFT, size = (80, -1))
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
157 add("lasercut_pass_zdiff", root.lc_pass_zdiff)
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
158 add("lasercut_pass_zdiff_label", wx.StaticText(parentpanel, -1, _("Z movement after each cut:")), flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
159
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
160 root.lc_material_thickness = speed_spin = FloatSpin(parentpanel, -1, increment = 0.1, value = root.settings.lc_material_thickness, min_val = 0, max_val = 75, digits = 1, style = wx.ALIGN_LEFT, size = (80, -1))
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
161 add("lasercut_material_thickness", root.lc_material_thickness)
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
162 add("lasercut_material_thickness_label", wx.StaticText(parentpanel, -1, _("Material Thickness:")), flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
163
3c27b4ee6fec reimplemented lasercutter changes
mdd
parents: 46
diff changeset
164
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
165 # Hotend & bed temperatures #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
166
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
167 # Hotend temp
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
168 add("htemp_label", wx.StaticText(parentpanel, -1, _("Heat:")), flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
169
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
170 root.settoff = make_button(parentpanel, _("Off"), lambda e: root.do_settemp("off"), _("Switch Hotend Off"), size = (38, -1), style = wx.BU_EXACTFIT)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
171 root.printerControls.append(root.settoff)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
172 add("htemp_off", root.settoff)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
173
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
174 root.htemp = wx.ComboBox(parentpanel, style = wx.CB_DROPDOWN, size = (115, -1))
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
175 root.htemp.SetToolTip(wx.ToolTip(_("Select Temperature for [H]otend")))
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
176 root.htemp.Bind(wx.EVT_COMBOBOX, root.htemp_change)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
177
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
178 add("htemp_val", root.htemp)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
179 root.settbtn = make_button(parentpanel, _("Set"), root.do_settemp, _("Switch Hotend On"), size = (38, -1), style = wx.BU_EXACTFIT)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
180 root.printerControls.append(root.settbtn)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
181 add("htemp_set", root.settbtn, flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
182
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
183 # Bed temp
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
184 add("btemp_label", wx.StaticText(parentpanel, -1, _("Bed:")), flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
185
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
186 root.setboff = make_button(parentpanel, _("Off"), lambda e: root.do_bedtemp("off"), _("Switch Heated Bed Off"), size = (38, -1), style = wx.BU_EXACTFIT)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
187 root.printerControls.append(root.setboff)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
188 add("btemp_off", root.setboff)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
189
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
190 root.btemp = wx.ComboBox(parentpanel, style = wx.CB_DROPDOWN, size = (115, -1))
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
191 root.btemp.SetToolTip(wx.ToolTip(_("Select Temperature for Heated [B]ed")))
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
192 root.btemp.Bind(wx.EVT_COMBOBOX, root.btemp_change)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
193 add("btemp_val", root.btemp)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
194
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
195 root.setbbtn = make_button(parentpanel, _("Set"), root.do_bedtemp, _("Switch Heated Bed On"), size = (38, -1), style = wx.BU_EXACTFIT)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
196 root.printerControls.append(root.setbbtn)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
197 add("btemp_set", root.setbbtn, flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
198
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
199 def set_labeled(temp, choices, widget):
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
200 choices = [(float(p[1]), p[0]) for p in choices.items()]
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
201 if not next((1 for p in choices if p[0] == temp), False):
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
202 choices.append((temp, 'user'))
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
203
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
204 choices = sorted(choices)
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
205 widget.Items = ['%s (%s)'%tl for tl in choices]
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
206 widget.Selection = next((i for i, tl in enumerate(choices) if tl[0] == temp), -1)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
207
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
208 set_labeled(root.settings.last_bed_temperature, root.bedtemps, root.btemp)
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
209 set_labeled(root.settings.last_temperature, root.temps, root.htemp)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
210
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
211 # Speed control #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
212 speedpanel = root.newPanel(parentpanel)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
213 speedsizer = wx.BoxSizer(wx.HORIZONTAL)
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
214 speedsizer.Add(wx.StaticText(speedpanel, -1, _("Print speed:")), flag = wx.ALIGN_CENTER_VERTICAL)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
215
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
216 root.speed_slider = wx.Slider(speedpanel, -1, 100, 1, 300)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
217 speedsizer.Add(root.speed_slider, 1, flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
218
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
219 root.speed_spin = wx.SpinCtrlDouble(speedpanel, -1, initial = 100, min = 1, max = 300, style = wx.ALIGN_LEFT, size = (115, -1))
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
220 root.speed_spin.SetDigits(0)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
221 speedsizer.Add(root.speed_spin, 0, flag = wx.ALIGN_CENTER_VERTICAL)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
222 root.speed_label = wx.StaticText(speedpanel, -1, _("%"))
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
223 speedsizer.Add(root.speed_label, flag = wx.ALIGN_CENTER_VERTICAL)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
224
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
225 def speedslider_set(event):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
226 root.do_setspeed()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
227 root.speed_setbtn.SetBackgroundColour(wx.NullColour)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
228 root.speed_setbtn = make_button(speedpanel, _("Set"), speedslider_set, _("Set print speed factor"), size = (38, -1), style = wx.BU_EXACTFIT)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
229 root.printerControls.append(root.speed_setbtn)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
230 speedsizer.Add(root.speed_setbtn, flag = wx.ALIGN_CENTER)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
231 speedpanel.SetSizer(speedsizer)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
232 add("speedcontrol", speedpanel, flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
233
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
234 def speedslider_spin(event):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
235 value = root.speed_spin.GetValue()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
236 root.speed_setbtn.SetBackgroundColour("red")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
237 root.speed_slider.SetValue(value)
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
238 root.speed_spin.Bind(wx.EVT_SPINCTRLDOUBLE, speedslider_spin)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
239
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
240 def speedslider_scroll(event):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
241 value = root.speed_slider.GetValue()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
242 root.speed_setbtn.SetBackgroundColour("red")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
243 root.speed_spin.SetValue(value)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
244 root.speed_slider.Bind(wx.EVT_SCROLL, speedslider_scroll)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
245
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
246 # Flow control #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
247 flowpanel = root.newPanel(parentpanel)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
248 flowsizer = wx.BoxSizer(wx.HORIZONTAL)
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
249 flowsizer.Add(wx.StaticText(flowpanel, -1, _("Print flow:")), flag = wx.ALIGN_CENTER_VERTICAL)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
250
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
251 root.flow_slider = wx.Slider(flowpanel, -1, 100, 1, 300)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
252 flowsizer.Add(root.flow_slider, 1, flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
253
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
254 root.flow_spin = wx.SpinCtrlDouble(flowpanel, -1, initial = 100, min = 1, max = 300, style = wx.ALIGN_LEFT, size = (115, -1))
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
255 flowsizer.Add(root.flow_spin, 0, flag = wx.ALIGN_CENTER_VERTICAL)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
256 root.flow_label = wx.StaticText(flowpanel, -1, _("%"))
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
257 flowsizer.Add(root.flow_label, flag = wx.ALIGN_CENTER_VERTICAL)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
258
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
259 def flowslider_set(event):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
260 root.do_setflow()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
261 root.flow_setbtn.SetBackgroundColour(wx.NullColour)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
262 root.flow_setbtn = make_button(flowpanel, _("Set"), flowslider_set, _("Set print flow factor"), size = (38, -1), style = wx.BU_EXACTFIT)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
263 root.printerControls.append(root.flow_setbtn)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
264 flowsizer.Add(root.flow_setbtn, flag = wx.ALIGN_CENTER)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
265 flowpanel.SetSizer(flowsizer)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
266 add("flowcontrol", flowpanel, flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
267
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
268 def flowslider_spin(event):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
269 value = root.flow_spin.GetValue()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
270 root.flow_setbtn.SetBackgroundColour("red")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
271 root.flow_slider.SetValue(value)
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
272 root.flow_spin.Bind(wx.EVT_SPINCTRLDOUBLE, flowslider_spin)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
273
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
274 def flowslider_scroll(event):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
275 value = root.flow_slider.GetValue()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
276 root.flow_setbtn.SetBackgroundColour("red")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
277 root.flow_spin.SetValue(value)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
278 root.flow_slider.Bind(wx.EVT_SCROLL, flowslider_scroll)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
279
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
280 # Temperature gauges #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
281
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
282 if root.display_gauges:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
283 root.hottgauge = TempGauge(parentpanel, size = (-1, 24), title = _("Heater:"), maxval = 300, bgcolor = root.bgcolor)
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
284 root.hottgauge.SetTarget(root.settings.last_temperature)
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
285 # root.hsetpoint = root.settings.last_temperature
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
286 add("htemp_gauge", root.hottgauge, flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
287 root.bedtgauge = TempGauge(parentpanel, size = (-1, 24), title = _("Bed:"), maxval = 150, bgcolor = root.bgcolor)
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
288 root.bedtgauge.SetTarget(root.settings.last_bed_temperature)
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
289 # root.bsetpoint = root.settings.last_bed_temperature
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
290 add("btemp_gauge", root.bedtgauge, flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
291
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
292 def scroll_gauge(rot, cmd, setpoint):
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
293 if rot:
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
294 temp = setpoint + (1 if rot > 0 else -1)
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
295 cmd(str(max(0, temp)))
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
296
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
297 def hotend_handler(e):
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
298 scroll_gauge(e.WheelRotation, root.do_settemp, root.hsetpoint)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
299
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
300 def bed_handler(e):
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
301 scroll_gauge(e.WheelRotation, root.do_bedtemp, root.bsetpoint)
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
302 root.hottgauge.Bind(wx.EVT_MOUSEWHEEL, hotend_handler)
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
303 root.bedtgauge.Bind(wx.EVT_MOUSEWHEEL, bed_handler)
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
304
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
305 def updateGauge(e, gauge):
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
306 gauge.SetTarget(float(e.String.split()[0]))
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
307
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
308 root.htemp.Bind(wx.EVT_TEXT, lambda e: updateGauge(e, root.hottgauge))
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
309 root.btemp.Bind(wx.EVT_TEXT, lambda e: updateGauge(e, root.bedtgauge))
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
310
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
311 # Temperature (M105) feedback display #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
312 root.tempdisp = wx.StaticText(parentpanel, -1, "", style = wx.ST_NO_AUTORESIZE)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
313
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
314 def on_tempdisp_size(evt):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
315 root.tempdisp.Wrap(root.tempdisp.GetSize().width)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
316 root.tempdisp.Bind(wx.EVT_SIZE, on_tempdisp_size)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
317
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
318 def tempdisp_setlabel(label):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
319 wx.StaticText.SetLabel(root.tempdisp, label)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
320 root.tempdisp.Wrap(root.tempdisp.GetSize().width)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
321 root.tempdisp.SetSize((-1, root.tempdisp.GetBestSize().height))
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
322 root.tempdisp.SetLabel = tempdisp_setlabel
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
323 add("tempdisp", root.tempdisp, flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
324
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
325 # Temperature graph #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
326
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
327 if root.display_graph:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
328 root.graph = Graph(parentpanel, wx.ID_ANY, root)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
329 add("tempgraph", root.graph, flag = wx.EXPAND | wx.ALL, border = 5)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
330 root.graph.Bind(wx.EVT_LEFT_DOWN, root.graph.show_graph_window)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
331
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
332 # Extrusion controls #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
333
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
334 # Extrusion settings
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
335 esettingspanel = root.newPanel(parentpanel)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
336 esettingssizer = wx.GridBagSizer()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
337 esettingssizer.SetEmptyCellSize((0, 0))
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
338 root.edist = wx.SpinCtrlDouble(esettingspanel, -1, initial = root.settings.last_extrusion, min = 0, max = 1000, size = (135, -1))
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
339 root.edist.SetDigits(1)
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
340 root.edist.Bind(wx.EVT_SPINCTRLDOUBLE, root.setfeeds)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
341 root.edist.SetBackgroundColour((225, 200, 200))
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
342 root.edist.SetForegroundColour("black")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
343 root.edist.Bind(wx.EVT_TEXT, root.setfeeds)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
344 add("edist_label", wx.StaticText(esettingspanel, -1, _("Length:")), container = esettingssizer, flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT | wx.RIGHT | wx.LEFT, border = 5)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
345 add("edist_val", root.edist, container = esettingssizer, flag = wx.ALIGN_CENTER | wx.RIGHT, border = 5)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
346 unit_label = _("mm") if mini_mode else _("mm @")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
347 add("edist_unit", wx.StaticText(esettingspanel, -1, unit_label), container = esettingssizer, flag = wx.ALIGN_CENTER | wx.RIGHT, border = 5)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
348 root.edist.SetToolTip(wx.ToolTip(_("Amount to Extrude or Retract (mm)")))
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
349 if not mini_mode:
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
350 root.efeedc = wx.SpinCtrlDouble(esettingspanel, -1, initial = root.settings.e_feedrate, min = 0, max = 50000, size = (145, -1))
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
351 root.efeedc.SetDigits(1)
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
352 root.efeedc.Bind(wx.EVT_SPINCTRLDOUBLE, root.setfeeds)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
353 root.efeedc.SetToolTip(wx.ToolTip(_("Extrude / Retract speed (mm/min)")))
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
354 root.efeedc.SetBackgroundColour((225, 200, 200))
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
355 root.efeedc.SetForegroundColour("black")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
356 root.efeedc.Bind(wx.EVT_TEXT, root.setfeeds)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
357 add("efeed_val", root.efeedc, container = esettingssizer, flag = wx.ALIGN_CENTER | wx.RIGHT, border = 5)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
358 add("efeed_label", wx.StaticText(esettingspanel, -1, _("Speed:")), container = esettingssizer, flag = wx.ALIGN_LEFT)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
359 add("efeed_unit", wx.StaticText(esettingspanel, -1, _("mm/\nmin")), container = esettingssizer, flag = wx.ALIGN_CENTER)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
360 else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
361 root.efeedc = None
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
362 esettingspanel.SetSizer(esettingssizer)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
363 add("esettings", esettingspanel, flag = wx.ALIGN_LEFT)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
364
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
365 if not standalone_mode:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
366 ebuttonspanel = root.newPanel(parentpanel)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
367 ebuttonssizer = wx.BoxSizer(wx.HORIZONTAL)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
368 if root.settings.extruders > 1:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
369 etool_sel_panel = esettingspanel if mini_mode else ebuttonspanel
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
370 etool_label = wx.StaticText(etool_sel_panel, -1, _("Tool:"))
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
371 if root.settings.extruders == 2:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
372 root.extrudersel = wx.Button(etool_sel_panel, -1, "0", style = wx.BU_EXACTFIT)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
373 root.extrudersel.SetToolTip(wx.ToolTip(_("Click to switch current extruder")))
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
374
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
375 def extrudersel_cb(event):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
376 if root.extrudersel.GetLabel() == "1":
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
377 new = "0"
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
378 else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
379 new = "1"
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
380 root.extrudersel.SetLabel(new)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
381 root.tool_change(event)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
382 root.extrudersel.Bind(wx.EVT_BUTTON, extrudersel_cb)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
383 root.extrudersel.GetValue = root.extrudersel.GetLabel
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
384 root.extrudersel.SetValue = root.extrudersel.SetLabel
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
385 else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
386 choices = [str(i) for i in range(0, root.settings.extruders)]
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
387 root.extrudersel = wx.ComboBox(etool_sel_panel, -1, choices = choices,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
388 style = wx.CB_DROPDOWN | wx.CB_READONLY,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
389 size = (50, -1))
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
390 root.extrudersel.SetToolTip(wx.ToolTip(_("Select current extruder")))
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
391 root.extrudersel.SetValue(choices[0])
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
392 root.extrudersel.Bind(wx.EVT_COMBOBOX, root.tool_change)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
393 root.printerControls.append(root.extrudersel)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
394 if mini_mode:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
395 add("etool_label", etool_label, container = esettingssizer, flag = wx.ALIGN_CENTER)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
396 add("etool_val", root.extrudersel, container = esettingssizer)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
397 else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
398 ebuttonssizer.Add(etool_label, flag = wx.ALIGN_CENTER)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
399 ebuttonssizer.Add(root.extrudersel)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
400
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
401 for key in ["extrude", "reverse"]:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
402 desc = root.cpbuttons[key]
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
403 btn = make_custom_button(root, ebuttonspanel, desc,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
404 style = wx.BU_EXACTFIT)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
405 ebuttonssizer.Add(btn, 1, flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
406
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
407 ebuttonspanel.SetSizer(ebuttonssizer)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
408 add("ebuttons", ebuttonspanel, flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
409 else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
410 for key, btn in extra_buttons.items():
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
411 add(key, btn, flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
412
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
413 class ControlsSizer(wx.GridBagSizer):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
414
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
415 def __init__(self, root, parentpanel = None, standalone_mode = False, mini_mode = False):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
416 super(ControlsSizer, self).__init__()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
417 if not parentpanel: parentpanel = root.panel
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
418 if mini_mode: self.make_mini(root, parentpanel)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
419 else: self.make_standard(root, parentpanel, standalone_mode)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
420
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
421 def make_standard(self, root, parentpanel, standalone_mode):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
422 lltspanel = root.newPanel(parentpanel)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
423 llts = wx.BoxSizer(wx.HORIZONTAL)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
424 lltspanel.SetSizer(llts)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
425 self.Add(lltspanel, pos = (0, 0), span = (1, 6))
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
426 xyzpanel = root.newPanel(parentpanel)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
427 self.xyzsizer = XYZControlsSizer(root, xyzpanel)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
428 xyzpanel.SetSizer(self.xyzsizer)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
429 self.Add(xyzpanel, pos = (1, 0), span = (1, 6), flag = wx.ALIGN_CENTER)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
430
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
431 self.extra_buttons = {}
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
432 pos_mapping = {"extrude": (4, 0),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
433 "reverse": (4, 2),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
434 }
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
435 span_mapping = {"extrude": (1, 2),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
436 "reverse": (1, 3),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
437 }
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
438 for key, desc in root.cpbuttons.items():
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
439 if not standalone_mode and key in ["extrude", "reverse"]:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
440 continue
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
441 panel = lltspanel if key == "motorsoff" else parentpanel
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
442 btn = make_custom_button(root, panel, desc)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
443 if key == "motorsoff":
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
444 llts.Add(btn)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
445 elif not standalone_mode:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
446 self.Add(btn, pos = pos_mapping[key], span = span_mapping[key], flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
447 else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
448 self.extra_buttons[key] = btn
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
449
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
450 root.xyfeedc = wx.SpinCtrl(lltspanel, -1, str(root.settings.xy_feedrate), min = 0, max = 50000, size = (130, -1))
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
451 root.xyfeedc.SetToolTip(wx.ToolTip(_("Set Maximum Speed for X & Y axes (mm/min)")))
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
452 llts.Add(wx.StaticText(lltspanel, -1, _("XY:")), flag = wx.ALIGN_CENTER_VERTICAL)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
453 llts.Add(root.xyfeedc)
46
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
454 llts.Add(wx.StaticText(lltspanel, -1, _("mm/min Z:")), flag = wx.ALIGN_CENTER_VERTICAL)
cce0af6351f0 updated and added new files for printrun
mdd
parents: 34
diff changeset
455 root.zfeedc = wx.SpinCtrl(lltspanel, -1, str(root.settings.z_feedrate), min = 0, max = 50000, size = (130, -1))
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
456 root.zfeedc.SetToolTip(wx.ToolTip(_("Set Maximum Speed for Z axis (mm/min)")))
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
457 llts.Add(root.zfeedc,)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
458
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
459 root.xyfeedc.Bind(wx.EVT_SPINCTRL, root.setfeeds)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
460 root.zfeedc.Bind(wx.EVT_SPINCTRL, root.setfeeds)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
461 root.xyfeedc.Bind(wx.EVT_TEXT, root.setfeeds)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
462 root.zfeedc.Bind(wx.EVT_TEXT, root.setfeeds)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
463 root.zfeedc.SetBackgroundColour((180, 255, 180))
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
464 root.zfeedc.SetForegroundColour("black")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
465
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
466 if not standalone_mode:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
467 add_extra_controls(self, root, parentpanel, None)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
468
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
469 def make_mini(self, root, parentpanel):
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
470 root.xyb = XYButtonsMini(parentpanel, root.moveXY, root.homeButtonClicked,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
471 root.spacebarAction, root.bgcolor,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
472 zcallback = root.moveZ)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
473 self.Add(root.xyb, pos = (1, 0), span = (1, 4), flag = wx.ALIGN_CENTER)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
474 root.zb = ZButtonsMini(parentpanel, root.moveZ, root.bgcolor)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
475 self.Add(root.zb, pos = (0, 4), span = (2, 1), flag = wx.ALIGN_CENTER)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
476 wx.CallAfter(root.xyb.SetFocus)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
477
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
478 pos_mapping = {"motorsoff": (0, 0),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
479 }
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
480 span_mapping = {"motorsoff": (1, 4),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
481 }
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
482 btn = make_custom_button(root, parentpanel, root.cpbuttons["motorsoff"])
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
483 self.Add(btn, pos = pos_mapping["motorsoff"], span = span_mapping["motorsoff"], flag = wx.EXPAND)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
484
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
485 add_extra_controls(self, root, parentpanel, None, True)

mercurial