From b45c99458ffa6046625298cb2b42e9daf5a62d4e Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauld.mccarthy@gmail.com> Date: Wed, 25 Mar 2015 14:10:11 +0000 Subject: [PATCH] Image display toolbar simplified - image select buttons removed, enabled checkbox removed --- fsl/data/strings.py | 3 +- fsl/fslview/controls/imagedisplaytoolbar.py | 37 +++++++++++++------- fsl/fslview/displaycontext/display.py | 3 -- fsl/fslview/displaycontext/displaycontext.py | 3 +- fsl/fslview/displaycontext/volumeopts.py | 1 - fsl/fslview/layouts.py | 5 +-- 6 files changed, 28 insertions(+), 24 deletions(-) diff --git a/fsl/data/strings.py b/fsl/data/strings.py index 89ffe6f1d..6c7ddd4ed 100644 --- a/fsl/data/strings.py +++ b/fsl/data/strings.py @@ -144,7 +144,7 @@ properties = TypeDict({ 'Profile.mode' : 'Mode', 'CanvasPanel.syncLocation' : 'Sync location', - 'CanvasPanel.syncImageOrder' : 'Sync image order', + 'CanvasPanel.syncImageOrder' : 'Sync overlay order', 'CanvasPanel.syncVolume' : 'Sync volume', 'CanvasPanel.profile' : 'Profile', @@ -193,7 +193,6 @@ properties = TypeDict({ 'Display.interpolation' : 'Interpolation', 'Display.resolution' : 'Resolution', 'Display.volume' : 'Volume', - 'Display.syncVolume' : 'Synchronise volume', 'Display.transform' : 'Image transform', 'Display.imageType' : 'Image data type', diff --git a/fsl/fslview/controls/imagedisplaytoolbar.py b/fsl/fslview/controls/imagedisplaytoolbar.py index c97b44eb2..b67ff4a5f 100644 --- a/fsl/fslview/controls/imagedisplaytoolbar.py +++ b/fsl/fslview/controls/imagedisplaytoolbar.py @@ -14,7 +14,6 @@ log = logging.getLogger(__name__) import fsl.fslview.toolbar as fsltoolbar -import imageselectpanel as imageselect import imagedisplaypanel as imagedisplay @@ -27,9 +26,6 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): fsltoolbar.FSLViewToolBar.__init__( self, parent, imageList, displayCtx, actionz) - self._imageSelect = imageselect.ImageSelectPanel( - self, imageList, displayCtx, False) - self._viewPanel = viewPanel self._imageTools = {} self._currentImage = None @@ -54,8 +50,6 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): """Deregisters property listeners. """ fsltoolbar.FSLViewToolBar.destroy(self) - self._imageSelect.destroy() - self._imageList .removeListener('images', self._name) self._displayCtx.removeListener('selectedImage', self._name) self._displayCtx.removeListener('imageOrder', self._name) @@ -99,6 +93,12 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): for tool, _ in oldOptsTools: tool.Destroy() + + def _toggleEnabled(self, *a): + image = self._displayCtx.getSelectedImage() + display = self._displayCtx.getDisplayProperties(image) + + self.Enable(display.enabled) def _selectedImageChanged(self, *a): @@ -111,9 +111,23 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): if image is None: self.ClearTools() return - + + display = self._displayCtx.getDisplayProperties(image) + + # Call _toggleEnabled when + # the image is enabled/disabled + for i in self._imageList: + if i == image: + display.addListener('enabled', + self._name, + self._toggleEnabled, + overwrite=True) + else: + display.removeListener('enabled', self._name) + + # Build/refresh the toolbar widgets for this image tools = self._imageTools.get(image, None) - + if tools is None: displayTools = self._makeDisplayWidgets(image, self) optsTools = self._makeOptsWidgets( image, self) @@ -137,8 +151,7 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): tools = self.GetTools() for widget in tools: - if widget is not self._imageSelect: - widget.Show(False) + widget.Show(False) self.ClearTools(postevent=False) @@ -150,8 +163,8 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): dispTools, dispLabels = zip(*dispTools) optsTools, optsLabels = zip(*optsTools) - tools = [self._imageSelect] + list(dispTools) + list(optsTools) - labels = [None] + list(dispLabels) + list(optsLabels) + tools = list(dispTools) + list(optsTools) + labels = list(dispLabels) + list(optsLabels) for tool in tools: tool.Show(True) diff --git a/fsl/fslview/displaycontext/display.py b/fsl/fslview/displaycontext/display.py index 64e698fda..95f830122 100644 --- a/fsl/fslview/displaycontext/display.py +++ b/fsl/fslview/displaycontext/display.py @@ -70,9 +70,6 @@ class Display(props.SyncableHasProperties): """If a 4D image, the current volume to display.""" - syncVolume = props.Boolean(default=True) - - transform = props.Choice( ('affine', 'pixdim', 'id'), labels=[strings.choices['Display.transform.affine'], diff --git a/fsl/fslview/displaycontext/displaycontext.py b/fsl/fslview/displaycontext/displaycontext.py index 081f686fe..86b152f3f 100644 --- a/fsl/fslview/displaycontext/displaycontext.py +++ b/fsl/fslview/displaycontext/displaycontext.py @@ -377,8 +377,7 @@ class DisplayContext(props.SyncableHasProperties): # be clamped to the possible value for that # image, so we don't need to check if the # current volume value is valid for each image - if display.syncVolume: - display.volume = self.volume + display.volume = self.volume def _boundsChanged(self, *a): diff --git a/fsl/fslview/displaycontext/volumeopts.py b/fsl/fslview/displaycontext/volumeopts.py index a06df9b38..786d50b6c 100644 --- a/fsl/fslview/displaycontext/volumeopts.py +++ b/fsl/fslview/displaycontext/volumeopts.py @@ -82,7 +82,6 @@ class VolumeOpts(fsldisplay.DisplayOpts): 'each displayed real world location', 'resolution' : 'Data resolution in voxels', 'volume' : 'Volume number (for 4D images)', - 'syncVolume' : 'Synchronise to global volume number', 'transform' : 'The transformation matrix which specifies the ' 'conversion from voxel coordinates to a real ' 'world location', diff --git a/fsl/fslview/layouts.py b/fsl/fslview/layouts.py index 4b33eea7a..639327326 100644 --- a/fsl/fslview/layouts.py +++ b/fsl/fslview/layouts.py @@ -95,8 +95,7 @@ CanvasPanelLayout = props.VGroup(( 'profile', visibleWhen=lambda i: len(i.getProp('profile').getChoices(i)) > 1), widget(CanvasPanel, 'syncImageOrder'), - widget(CanvasPanel, 'syncLocation'), - widget(CanvasPanel, 'syncVolume'))) + widget(CanvasPanel, 'syncLocation'))) SceneOptsLayout = props.VGroup(( widget(SceneOpts, 'showCursor'), @@ -145,7 +144,6 @@ LightBoxPanelLayout = props.VGroup(( DisplayToolBarLayout = [ - widget(Display, 'enabled'), widget(Display, 'name'), widget(Display, 'imageType'), widget(Display, 'alpha', spin=False, showLimits=False), @@ -175,7 +173,6 @@ DisplayLayout = props.VGroup( widget(Display, 'transform'), widget(Display, 'interpolation'), widget(Display, 'volume', editLimits=False), - widget(Display, 'syncVolume'), widget(Display, 'enabled'), widget(Display, 'alpha', showLimits=False, editLimits=False), widget(Display, 'brightness', showLimits=False, editLimits=False), -- GitLab