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

LocationPanel volume widget was misbehaving

parent ee195ef6
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,8 @@ import numpy as np ...@@ -24,6 +24,8 @@ import numpy as np
import props import props
import pwidgets.floatspin as floatspin
import fsl.utils.transform as transform import fsl.utils.transform as transform
import fsl.data.image as fslimage import fsl.data.image as fslimage
import fsl.data.constants as constants import fsl.data.constants as constants
...@@ -117,8 +119,9 @@ class LocationPanel(fslpanel.FSLEyesPanel): ...@@ -117,8 +119,9 @@ class LocationPanel(fslpanel.FSLEyesPanel):
self.voxelX = voxelX self.voxelX = voxelX
self.voxelY = voxelY self.voxelY = voxelY
self.voxelZ = voxelZ self.voxelZ = voxelZ
self.volume = wx.SpinCtrl(self.column2) self.volume = floatspin.FloatSpinCtrl(
self.volume.SetValue(0) self.column2,
style=floatspin.FSC_MOUSEWHEEL | floatspin.FSC_INTEGER)
self.column1Sizer = wx.BoxSizer(wx.VERTICAL) self.column1Sizer = wx.BoxSizer(wx.VERTICAL)
self.column2Sizer = wx.BoxSizer(wx.VERTICAL) self.column2Sizer = wx.BoxSizer(wx.VERTICAL)
...@@ -364,11 +367,11 @@ class LocationPanel(fslpanel.FSLEyesPanel): ...@@ -364,11 +367,11 @@ class LocationPanel(fslpanel.FSLEyesPanel):
props.unbindWidget(self.volume, props.unbindWidget(self.volume,
self.volumeTarget, self.volumeTarget,
'volume', 'volume',
(wx.EVT_SPIN, wx.EVT_SPINCTRL)) floatspin.EVT_FLOATSPIN)
self.volume.Unbind(wx.EVT_MOUSEWHEEL)
self.volumeTarget = None self.volumeTarget = None
self.volume.SetValue(0) self.volume.SetValue(0)
self.volume.SetRange(0, 0)
# Enable/disable the volume widget if the # Enable/disable the volume widget if the
# overlay is a 4D image, and bind/unbind # overlay is a 4D image, and bind/unbind
...@@ -378,19 +381,11 @@ class LocationPanel(fslpanel.FSLEyesPanel): ...@@ -378,19 +381,11 @@ class LocationPanel(fslpanel.FSLEyesPanel):
opts = self._displayCtx.getOpts(refImage) opts = self._displayCtx.getOpts(refImage)
self.volumeTarget = opts self.volumeTarget = opts
def onMouse(ev):
if not self.volume.IsEnabled():
return
wheelDir = ev.GetWheelRotation()
if wheelDir < 0: opts.volume -= 1
elif wheelDir > 0: opts.volume += 1
props.bindWidget( props.bindWidget(
self.volume, opts, 'volume', (wx.EVT_SPIN, wx.EVT_SPINCTRL)) self.volume, opts, 'volume', floatspin.EVT_FLOATSPIN)
self.volume.Bind(wx.EVT_MOUSEWHEEL, onMouse) self.volume.SetRange(0, refImage.shape[3] - 1)
self.volume.SetValue(opts.volume)
self.volume .Enable() self.volume .Enable()
self.volumeLabel.Enable() self.volumeLabel.Enable()
......
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