Skip to content
Snippets Groups Projects
Commit fca22f1e authored by Paul McCarthy's avatar Paul McCarthy
Browse files

AtlasOverlayPanel was generating region lists twice. Simplified

font colour/weight  changing on atlas state - no longer dependent
on region lists being generated; instead, the region filter is tested
against the atlas descriptions (all of which have been loaded).
parent d1b0f875
No related branches found
No related tags found
No related merge requests found
......@@ -139,28 +139,31 @@ class AtlasOverlayPanel(fslpanel.FSLViewPanel):
def __onRegionFilter(self, ev):
filterStr = self.__regionFilter.GetValue().lower()
filterStr = self.__regionFilter.GetValue().lower().strip()
for i, listBox in enumerate(self.__regionLists):
if listBox is None:
continue
listBox.ApplyFilter(filterStr, ignoreCase=True)
self.__updateAtlasState(i)
if listBox is not None:
listBox.ApplyFilter(filterStr, ignoreCase=True)
def __updateAtlasState(self, atlasIdx):
listBox = self.__regionLists[atlasIdx]
if listBox is None:
weight = wx.FONTWEIGHT_LIGHT
colour = '#a0a0a0'
elif listBox.VisibleItemCount() == 0:
filterStr = self.__regionFilter.GetValue().lower().strip()
atlasDesc = self.__atlasList.GetItemData(atlasIdx)
if filterStr == '':
nhits = 0
else:
nhits = len(filter(
lambda l: filterStr in l.name.lower(),
atlasDesc.labels))
if nhits == 0:
weight = wx.FONTWEIGHT_LIGHT
colour = '#303030'
colour = '#404040'
else:
weight = wx.FONTWEIGHT_BOLD
colour = '#000000'
......@@ -202,7 +205,7 @@ class AtlasOverlayPanel(fslpanel.FSLViewPanel):
label.index)
regionList.SetItemWidget(i, widget)
filterStr = self.__regionFilter.GetValue().lower()
filterStr = self.__regionFilter.GetValue().lower().strip()
regionList.ApplyFilter(filterStr, ignoreCase=True)
self.__updateAtlasState(atlasIdx)
......@@ -210,7 +213,6 @@ class AtlasOverlayPanel(fslpanel.FSLViewPanel):
msgdlg.ProcessingDialog(
strings.messages[self, 'loadRegions'].format(atlasDesc.name),
buildRegionList).Run()
buildRegionList()
log.debug('Showing region list for {} ({})'.format(
atlasDesc.atlasID, id(regionList)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment