chiark / gitweb /
Workaround for temperature control issue
authorJustin Nesselrotte <jnesselr@harding.edu>
Sat, 20 Dec 2014 20:00:13 +0000 (14:00 -0600)
committerJustin Nesselrotte <jnesselr@harding.edu>
Sat, 20 Dec 2014 20:00:13 +0000 (14:00 -0600)
Also, removing a semicolon

Cura/gui/configBase.py
Cura/gui/printWindow.py

index f1be27831bbd1ea4912bd81dd2d098b062eb3ae8..0c211c845c1f0e2d4d71d08c7d9ffbef6a5e8827 100644 (file)
@@ -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)
 
index 2c905b72be19e007b4da88025dc92c9f0f383164..13ac87f57ae21660f2219297bc81193632718922 100644 (file)
@@ -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()):