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

In the name of improving performance over SSH, SliceCanvas._refresh now

calls the _draw method directly, and LocationPanel calls
wx.Refresh/Update when its location changes.
parent 2cd6141a
No related branches found
No related tags found
No related merge requests found
...@@ -260,15 +260,14 @@ class LocationPanel(fslpanel.FSLViewPanel): ...@@ -260,15 +260,14 @@ class LocationPanel(fslpanel.FSLViewPanel):
wloc = transform.transform( wloc = transform.transform(
[dloc], display.getTransform('display', 'world'))[0] [dloc], display.getTransform('display', 'world'))[0]
import fsl.utils.trace as trace
trace.trace('LocationPanel')
log.debug('Updating location ({} -> vox {}, world {})'.format( log.debug('Updating location ({} -> vox {}, world {})'.format(
dloc, vloc, wloc)) dloc, vloc, wloc))
self .disableListener('voxelLocation', self._name) self .disableListener('voxelLocation', self._name)
self .disableListener('worldLocation', self._name) self .disableListener('worldLocation', self._name)
self._displayCtx.disableListener('location', self._name) self._displayCtx.disableListener('location', self._name)
self.Freeze()
self.voxelLocation.xyz = np.round(vloc) self.voxelLocation.xyz = np.round(vloc)
self.worldLocation.xyz = wloc self.worldLocation.xyz = wloc
...@@ -279,6 +278,10 @@ class LocationPanel(fslpanel.FSLViewPanel): ...@@ -279,6 +278,10 @@ class LocationPanel(fslpanel.FSLViewPanel):
self._updateVoxelValue() self._updateVoxelValue()
self.Thaw()
self.Refresh()
self.Update()
def _voxelLocationChanged(self, *a): def _voxelLocationChanged(self, *a):
""" """
......
...@@ -396,8 +396,13 @@ class WXGLCanvasTarget(object): ...@@ -396,8 +396,13 @@ class WXGLCanvasTarget(object):
def _refresh(self, *a): def _refresh(self, *a):
"""Triggers a redraw via the :mod:`wx` `Refresh` method.""" """Triggers a redraw via the :meth:`_draw` method."""
self.Refresh()
# NOTE I'm not drawing via wx.Refresh/Update
# because, when running over ssh under X11,
# this doesn't seem to force a redraw. Calling
# the draw code directly seems to do the trick
self._draw()
def _postDraw(self): def _postDraw(self):
......
...@@ -692,6 +692,10 @@ class SliceCanvas(props.HasProperties): ...@@ -692,6 +692,10 @@ class SliceCanvas(props.HasProperties):
:func:`fsl.fslview.gl.slicecanvas_draw.drawScene` function, which does :func:`fsl.fslview.gl.slicecanvas_draw.drawScene` function, which does
the actual drawing. the actual drawing.
""" """
width, height = self._getSize()
if width == 0 or height == 0:
return
self._setGLContext() self._setGLContext()
self._setViewport() self._setViewport()
......
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