Skip to content

Commit

Permalink
fixed missing FloatSpin (close #133)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Müller committed Sep 30, 2015
1 parent b9bcdea commit a306055
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
6 changes: 4 additions & 2 deletions pycorrfit/tools/parmrange.py
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
32 changes: 7 additions & 25 deletions pycorrfit/tools/simulation.py
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

0 comments on commit a306055

Please sign in to comment.