From a3060555df16ff9d4c315f56465a8f31fe8579cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20M=C3=BCller?= Date: Wed, 30 Sep 2015 18:25:38 +0200 Subject: [PATCH] fixed missing FloatSpin (close #133) --- pycorrfit/tools/parmrange.py | 6 ++++-- pycorrfit/tools/simulation.py | 32 +++++++------------------------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/pycorrfit/tools/parmrange.py b/pycorrfit/tools/parmrange.py index c1d45d38..d0df4f1f 100644 --- a/pycorrfit/tools/parmrange.py +++ b/pycorrfit/tools/parmrange.py @@ -8,8 +8,10 @@ import wx +from wx.lib.agw import floatspin import numpy as np + from .. import edclasses # edited floatspin from .. import models as mdls @@ -55,8 +57,8 @@ def FillPanel(self): # = wx.BoxSizer(wx.VERTICAL) self.WXboxsizer = wx.FlexGridSizer(rows=len(labels), cols=4, vgap=5, hgap=5) for i in range(len(labels)): - left = edclasses.FloatSpin(self.panel, digits=7, increment=.1) - right = edclasses.FloatSpin(self.panel, digits=7, increment=.1) + left = floatspin.FloatSpin(self.panel, digits=7, increment=.1) + right = floatspin.FloatSpin(self.panel, digits=7, increment=.1) left.SetValue(self.parameter_range[i][0]) right.SetValue(self.parameter_range[i][1]) left.Bind(wx.EVT_SPINCTRL, self.OnSetParmRange) diff --git a/pycorrfit/tools/simulation.py b/pycorrfit/tools/simulation.py index 79c75f9d..b6c37ca7 100644 --- a/pycorrfit/tools/simulation.py +++ b/pycorrfit/tools/simulation.py @@ -9,9 +9,9 @@ import wx +from wx.lib.agw import floatspin import numpy as np -from .. import edclasses # edited floatspin from .. import models as mdls # Menu entry name @@ -76,45 +76,39 @@ def __init__(self, parent): slidesizer = wx.FlexGridSizer(rows=3, cols=5, vgap=5, hgap=5) self.textstartA = wx.StaticText(self.panel, label=self.labelA) slidesizer.Add(self.textstartA) - self.startspinA = edclasses.FloatSpin(self.panel, digits=7, - increment=.1) + self.startspinA = floatspin.FloatSpin(self.panel, digits=7) slidesizer.Add(self.startspinA) self.sliderA = wx.Slider(self.panel, -1, self.slidestart, 0, self.slidemax, wx.DefaultPosition, (250, -1), wx.SL_HORIZONTAL) slidesizer.Add(self.sliderA) - self.endspinA = edclasses.FloatSpin(self.panel, digits=7, - increment=.1) + self.endspinA = floatspin.FloatSpin(self.panel, digits=7) slidesizer.Add(self.endspinA) self.textvalueA = wx.StaticText(self.panel, label= "%.5e" % self.valueA) slidesizer.Add(self.textvalueA) # Parameter B self.textstartB = wx.StaticText(self.panel, label=self.labelB) slidesizer.Add(self.textstartB) - self.startspinB = edclasses.FloatSpin(self.panel, digits=7, - increment=.1) + self.startspinB = floatspin.FloatSpin(self.panel, digits=7) slidesizer.Add(self.startspinB) self.sliderB = wx.Slider(self.panel, -1, self.slidestart, 0, self.slidemax, wx.DefaultPosition, (250, -1), wx.SL_HORIZONTAL) slidesizer.Add(self.sliderB) - self.endspinB = edclasses.FloatSpin(self.panel, digits=7, - increment=.1) + self.endspinB = floatspin.FloatSpin(self.panel, digits=7) slidesizer.Add(self.endspinB) self.textvalueB = wx.StaticText(self.panel, label= "%.5e" % self.valueB) slidesizer.Add(self.textvalueB) # Result of operation self.textstartOp = wx.StaticText(self.panel, label=self.labelOp) slidesizer.Add(self.textstartOp) - self.startspinOp = edclasses.FloatSpin(self.panel, digits=7, - increment=.1) + self.startspinOp = floatspin.FloatSpin(self.panel, digits=7) slidesizer.Add(self.startspinOp) self.sliderOp = wx.Slider(self.panel, -1, self.slidestart, 0, self.slidemax, wx.DefaultPosition, (250, -1), wx.SL_HORIZONTAL) slidesizer.Add(self.sliderOp) - self.endspinOp = edclasses.FloatSpin(self.panel, digits=7, - increment=.1) + self.endspinOp = floatspin.FloatSpin(self.panel, digits=7) slidesizer.Add(self.endspinOp) self.textvalueOp = wx.StaticText(self.panel, label= "%.5e" % self.valueOp) @@ -182,16 +176,6 @@ def CalcFct(self, A, B, C): return B, C - def Increment(self): - # Set the correct increment for each spinctrl - self.startspinA.increment() - self.startspinB.increment() - self.startspinOp.increment() - self.endspinA.increment() - self.endspinB.increment() - self.endspinOp.increment() - - def FillOpDict(self): # Dictionaries: [Calculate C, Calculate B) self.opdict["A/B"] = [lambda A,B: A/B, lambda A,C: A/C] @@ -330,7 +314,6 @@ def OnSlider(self, event=None): self.valueOp) self.textvalueB.SetLabel( "%.5e" % self.valueB) self.textvalueOp.SetLabel( "%.5e" % self.valueOp) - self.Increment() self.SetResult() self.OnSize() @@ -442,6 +425,5 @@ def SetValues(self, event=None): self.textvalueA.SetLabel( "%.5e" % self.valueA) self.textvalueB.SetLabel( "%.5e" % self.valueB) self.textvalueOp.SetLabel( "%.5e" % self.valueOp) - self.Increment() self.SetResult()