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

All ViewPanels call FSLVIewPanel.destroy

parent bc3bfd3d
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,7 @@ class ColourBarCanvas(props.HasProperties):
for prop in ('cmap', 'vrange', 'label', 'orientation', 'labelSide'):
self.addListener(prop, self._name, self.__updateTexture)
def __updateTexture(self, *a):
self._genColourBarTexture()
self._refresh()
......@@ -85,6 +86,14 @@ class ColourBarCanvas(props.HasProperties):
self._genColourBarTexture()
def destroy(self):
"""Should be called when this ``ColourBarCanvas`` is no longer needed.
Destroys the :class:`.Texture2D` instance used to render the colour
bar.
"""
self._tex.destroy()
def _genColourBarTexture(self):
"""Generates a texture containing an image of the colour bar,
according to the current property values.
......
......@@ -73,7 +73,6 @@ class ColourBarPanel(fslpanel.FSLViewPanel):
context, and individual overlays.
"""
fslpanel.FSLViewPanel.destroy(self)
self._overlayList.removeListener('overlays', self._name)
self._displayCtx .removeListener('selectedOverlay', self._name)
......@@ -89,6 +88,9 @@ class ColourBarPanel(fslpanel.FSLViewPanel):
opts .removeListener('cmap', self._name)
opts .removeListener('displayRange', self._name)
self._cbPanel .destroy(self)
fslpanel.FSLViewPanel.destroy(self)
def _layout(self, *a):
"""
......
......@@ -406,7 +406,6 @@ class HistogramPanel(plotpanel.PlotPanel):
def destroy(self):
"""De-registers property listeners. """
plotpanel.PlotPanel.destroy(self)
self.removeListener('showCurrent', self._name)
self.removeListener('histType', self._name)
......@@ -419,6 +418,8 @@ class HistogramPanel(plotpanel.PlotPanel):
for hs in set(self.dataSeries[:] + self.__histCache.values()):
hs.destroy()
plotpanel.PlotPanel.destroy(self)
def __dataSeriesChanged(self, *a):
self.setConstraint('selectedSeries',
......
......@@ -167,7 +167,6 @@ class PlotPanel(viewpanel.ViewPanel):
def destroy(self):
viewpanel.ViewPanel.destroy(self)
self.removeListener('dataSeries', self.__name)
self.removeListener('limits', self.__name)
for propName in ['legend',
......@@ -180,6 +179,7 @@ class PlotPanel(viewpanel.ViewPanel):
'xlabel',
'ylabel']:
self.removeListener(propName, self._name)
viewpanel.ViewPanel.destroy(self)
def getFigure(self):
......
......@@ -491,7 +491,6 @@ class TimeSeriesPanel(plotpanel.PlotPanel):
def destroy(self):
plotpanel.PlotPanel.destroy(self)
self.removeListener('plotMode', self._name)
self.removeListener('usePixdim', self._name)
......@@ -501,6 +500,8 @@ class TimeSeriesPanel(plotpanel.PlotPanel):
self._displayCtx .removeListener('selectedOverlay', self._name)
self._displayCtx .removeListener('location', self._name)
plotpanel.PlotPanel.destroy(self)
def __overlaysChanged(self, *a):
......
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