# HG changeset patch # User mbayer # Date 1465046286 -7200 # Node ID 5c98c7e24b02a54c52a5ef2aabc548410c90cdd6 # Parent 0e3e7fbf0bc6dc2a8737744b773ba8d364194f54 Add quick access button to laser options diff -r 0e3e7fbf0bc6 -r 5c98c7e24b02 printrun-src/printrun/gui/controls.py --- a/printrun-src/printrun/gui/controls.py Sat Jun 04 14:27:06 2016 +0200 +++ b/printrun-src/printrun/gui/controls.py Sat Jun 04 15:18:06 2016 +0200 @@ -23,6 +23,8 @@ from .utils import make_button, make_custom_button +from .widgets import PronterOptions + class XYZControlsSizer(wx.GridBagSizer): def __init__(self, root, parentpanel = None): @@ -50,6 +52,8 @@ else: e_base_line = base_line + 2 + lasercut_base_line = 11 + pos_mapping = { "htemp_label": (base_line + 0, 0), "htemp_off": (base_line + 0, 2), @@ -68,6 +72,7 @@ "tempdisp": (tempdisp_line, 0), "extrude": (3, 0), "reverse": (3, 2), + "lasercut": (lasercut_base_line, 0), } span_mapping = { @@ -299,6 +304,13 @@ add("tempgraph", root.graph, flag = wx.EXPAND | wx.ALL, border = 5) root.graph.Bind(wx.EVT_LEFT_DOWN, root.graph.show_graph_window) + # Lasercutter quick controls # + + root.lc_optionsbtn = make_button(parentpanel, _("Lasercutter options"), lambda e: PronterOptions(root, "Laser"), _("Open Lasercutter options"), style = wx.BU_EXACTFIT) + root.printerControls.append(root.lc_optionsbtn) + add("lasercut", root.lc_optionsbtn, flag = wx.EXPAND) + + # Extrusion controls # # Extrusion settings diff -r 0e3e7fbf0bc6 -r 5c98c7e24b02 printrun-src/printrun/gui/widgets.py --- a/printrun-src/printrun/gui/widgets.py Sat Jun 04 14:27:06 2016 +0200 +++ b/printrun-src/printrun/gui/widgets.py Sat Jun 04 15:18:06 2016 +0200 @@ -135,7 +135,7 @@ all_settings = pronterface.settings._all_settings() group_list = [] groups = {} - for group in ["Printer", "UI", "Viewer", "Colors", "External"]: + for group in ["Printer", "UI", "Viewer", "Colors", "External", "Laser"]: group_list.append(group) groups[group] = [] for setting in all_settings: @@ -179,8 +179,18 @@ self.SetSizerAndFit(topsizer) self.SetMinSize(self.GetSize()) -def PronterOptions(pronterface): + self.notebook = notebook + self.group_list = group_list + + def setPage(self, name): + self.notebook.ChangeSelection(self.group_list.index(name)) + +def PronterOptions(pronterface, defaulttab = None): dialog = PronterOptionsDialog(pronterface) + if defaulttab: + # set the active tab before open dialog + dialog.setPage(defaulttab) + if dialog.ShowModal() == wx.ID_OK: for setting in pronterface.settings._all_settings(): old_value = setting.value