From 6e374711e03069c7478b45560b1d7969ec3dc8e7 Mon Sep 17 00:00:00 2001 From: Justin Nesselrotte Date: Sat, 20 Dec 2014 14:00:13 -0600 Subject: [PATCH] Workaround for temperature control issue Also, removing a semicolon --- Cura/gui/configBase.py | 2 +- Cura/gui/printWindow.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Cura/gui/configBase.py b/Cura/gui/configBase.py index f1be2783..0c211c84 100644 --- a/Cura/gui/configBase.py +++ b/Cura/gui/configBase.py @@ -22,7 +22,7 @@ class configPanelBase(wx.Panel): return leftConfigPanel, rightConfigPanel def CreateConfigPanel(self, parent): - configPanel = wx.Panel(parent); + configPanel = wx.Panel(parent) leftConfigPanel = wx.Panel(configPanel) rightConfigPanel = wx.Panel(configPanel) diff --git a/Cura/gui/printWindow.py b/Cura/gui/printWindow.py index 2c905b72..13ac87f5 100644 --- a/Cura/gui/printWindow.py +++ b/Cura/gui/printWindow.py @@ -136,14 +136,23 @@ class printWindowPlugin(wx.Frame): x, y, w, h = self._getColoredRect(r, g, b) if x < 0: return + + def run_command(spinner): + value = spinner.GetValue() + if spinner.last_value != value: + if spinner.last_value != '' and value != 0: + spinner.command(spinner.data % value) + spinner.last_value = value + spinner = wx.SpinCtrl(self, -1, style=wx.TE_PROCESS_ENTER) spinner.SetRange(0, 300) spinner.SetPosition((x, y)) spinner.SetSize((w, h)) spinner.command = command spinner.data = data + spinner.last_value = '' self._buttonList.append(spinner) - self.Bind(wx.EVT_SPINCTRL, lambda e: command(data % (spinner.GetValue())), spinner) + self.Bind(wx.EVT_SPINCTRL, lambda e: run_command(spinner), spinner) def _getColoredRect(self, r, g, b): for x in xrange(0, self._mapImage.GetWidth()): -- 2.30.2