Skip to content
This repository has been archived by the owner on Nov 5, 2020. It is now read-only.

Commit

Permalink
preparations for issue #11
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis CI committed Sep 6, 2015
1 parent d418a4b commit 83d8945
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 17 deletions.
3 changes: 2 additions & 1 deletion appveyor.yml
Expand Up @@ -77,7 +77,8 @@ install:
- "conda install --yes statsmodels"
- "pip install nptdms"
# prevent pip from installing later scipy versions
- "pip install dclab --no-deps"
- "pip install git+git://github.com/ZellMechanik-Dresden/dclab.git --no-deps"
#- "pip install dclab --no-deps"
- "pip install simplejson"

# Patch libraries
Expand Down
6 changes: 6 additions & 0 deletions config/dclab.cfg
Expand Up @@ -21,6 +21,12 @@ Area Ratio Max = 0.0
# lateral postition of cell in channel
#Pos Lat Min = -1
#Pos Lat Max = 27
# Limit the analyzed data points
#Datapoint Limit = 2000
Datapoint Limit = 0
# Automatically set data point limit to common minimum,
# such that all data sets have same number of points.
Datapoint Limit Auto = False

[General]
# Channel width in um
Expand Down
81 changes: 65 additions & 16 deletions shapeout/controls.py
Expand Up @@ -263,7 +263,8 @@ def _create_type_wx_controls(self, analysis, key, item):
c.SetValue(unicode(item[1]))
stemp.Add(a)
stemp.Add(c)
elif tlabwrap.dfn.GetParameterDtype(key, item[0]) == bool:
elif (tlabwrap.dfn.GetParameterDtype(key, item[0]) == bool or
str(item[1]).capitalize() in ["True", "False"]):
a = wx.CheckBox(self, label=_(item[0]), name=item[0])
a.SetValue(item[1])
stemp.Add(a)
Expand Down Expand Up @@ -307,7 +308,57 @@ def __init__(self, parent, *args, **kwargs):
self.config = ConfigurationFile()
self.key = "Filtering"

def _box_from_cfg_filter(self, analysis, key):
def _box_rest_filter(self, analysis, key):
"""
Display rest like datapoint limit
"""
gen = wx.StaticBox(self, label=_("Box Filters"))

hbox = wx.StaticBoxSizer(gen, wx.VERTICAL)

items = analysis.GetParameters(key).items()

sortfunc = lambda x: (x[0].replace("Max", "2")
.replace("Min", "1"))
items.sort(key=sortfunc)


sgen = wx.FlexGridSizer(len(items), 1)

excludeend = ["Min", "Max"]
excludeis = ["Enable Filters"]
excludestart = ["Polygon"]

#sgen = wx.BoxSizer(wx.VERTICAL)
for item in items:
ins = True
for it in excludeend:
if item[0].endswith(it):
ins = False
for it in excludeis:
if item[0] == it:
ins = False
for it in excludestart:
if item[0].startswith(it):
ins = False
if not ins:
continue

print(item[0])

stemp = self._create_type_wx_controls(analysis,
key, item)
sgen.Add(stemp)

sgen.Layout()
hbox.Add(sgen)
return hbox


def _box_minmax_filter(self, analysis, key):
"""
Display everything with Min/Max
"""
gen = wx.StaticBox(self, label=_("Box Filters"))

hbox = wx.StaticBoxSizer(gen, wx.VERTICAL)
Expand All @@ -329,16 +380,11 @@ def _box_from_cfg_filter(self, analysis, key):
if "Defo" in analysis.GetPlotAxes():
display_circ = False

# Remove filtering from these items
excluded = ["Enable Filters", "Polygon Filters"]

for item in items:
if item[0].startswith("Circ") and display_circ is False:
pass
elif item[0].startswith("Defo") and display_circ is True:
pass
elif item[0] in excluded:
pass
elif item[0].endswith("Min"):
if item[0][:-4] in analysis.GetUnusableAxes():
# ignore this item
Expand All @@ -356,14 +402,11 @@ def _box_from_cfg_filter(self, analysis, key):
sgen.Add(stemp)

elif item[0].endswith("Max"):
# did that before
pass
else:
stemp = self._create_type_wx_controls(analysis,
key, item)
sgen.Add(stemp)
sgen.Add(wx.Size())
pass


sgen.Layout()
hbox.Add(sgen)

Expand Down Expand Up @@ -579,11 +622,17 @@ def Update(self, analysis=None):
self.RemoveChild(item)
item.Destroy()

# Box filters
sizer = wx.BoxSizer(wx.HORIZONTAL)
fbox = self._box_from_cfg_filter(analysis, "Filtering")
sizer.Add(fbox)


sizerv = wx.BoxSizer(wx.VERTICAL)
sizer.Add(sizerv)
# Box filters
fbox = self._box_minmax_filter(analysis, "Filtering")
sizerv.Add(fbox)
# Rest filters:
rbox = self._box_rest_filter(analysis, "Filtering")
sizerv.Add(rbox)

# Polygon filters
polysizer = self._box_polygon_filter(analysis)
sizer.Add(polysizer)
Expand Down

0 comments on commit 83d8945

Please sign in to comment.