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

Ortho/LightBox toolbars no longer use layouts module

parent fa6a96e8
No related branches found
No related tags found
No related merge requests found
...@@ -6,15 +6,16 @@ ...@@ -6,15 +6,16 @@
# #
import props
import fsl.fslview.toolbar as fsltoolbar import fsl.fslview.toolbar as fsltoolbar
import fsl.fslview.actions as actions
class LightBoxToolBar(fsltoolbar.FSLViewToolBar): class LightBoxToolBar(fsltoolbar.FSLViewToolBar):
def __init__(self, parent, overlayList, displayCtx, lb): def __init__(self, parent, overlayList, displayCtx, lb):
import fsl.fslview.layouts as layouts
actionz = {'more' : self.showMoreSettings} actionz = {'more' : self.showMoreSettings}
fsltoolbar.FSLViewToolBar.__init__( fsltoolbar.FSLViewToolBar.__init__(
...@@ -22,22 +23,13 @@ class LightBoxToolBar(fsltoolbar.FSLViewToolBar): ...@@ -22,22 +23,13 @@ class LightBoxToolBar(fsltoolbar.FSLViewToolBar):
self.lightBoxPanel = lb self.lightBoxPanel = lb
sceneOpts = lb.getSceneOptions() sceneOpts = lb.getSceneOptions()
toolSpecs = [
toolSpecs = layouts.layouts[self] actions.ActionButton(lb, 'screenshot'),
props .Widget( 'zax'),
# TODO this is dodgy - there needs to be a props .Widget( 'sliceSpacing', spin=False, showLimits=False),
# way to have this automatically set up. props .Widget( 'zrange', spin=False, showLimits=False),
# props .Widget( 'zoom', spin=False, showLimits=False),
# 1. Add the ability to associate arbitrary actions.ActionButton(self, 'more')]
# data with a toolspec (modify props.ViewItem
# to allow a value to be set)
#
# 2. Update layouts.widget and actions.ActionButton
# to set that value to the target class
#
# 3. Here, loop through the toolspecs, check
# the target class, and set the instance
# appropriately
targets = {'screenshot' : lb, targets = {'screenshot' : lb,
'zax' : sceneOpts, 'zax' : sceneOpts,
'sliceSpacing' : sceneOpts, 'sliceSpacing' : sceneOpts,
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
# #
import props
import fsl.fslview.toolbar as fsltoolbar import fsl.fslview.toolbar as fsltoolbar
import fsl.fslview.actions as actions
class OrthoToolBar(fsltoolbar.FSLViewToolBar): class OrthoToolBar(fsltoolbar.FSLViewToolBar):
...@@ -14,8 +17,6 @@ class OrthoToolBar(fsltoolbar.FSLViewToolBar): ...@@ -14,8 +17,6 @@ class OrthoToolBar(fsltoolbar.FSLViewToolBar):
def __init__(self, parent, overlayList, displayCtx, ortho): def __init__(self, parent, overlayList, displayCtx, ortho):
import fsl.fslview.layouts as layouts
actionz = {'more' : self.showMoreSettings} actionz = {'more' : self.showMoreSettings}
fsltoolbar.FSLViewToolBar.__init__( fsltoolbar.FSLViewToolBar.__init__(
...@@ -24,7 +25,15 @@ class OrthoToolBar(fsltoolbar.FSLViewToolBar): ...@@ -24,7 +25,15 @@ class OrthoToolBar(fsltoolbar.FSLViewToolBar):
orthoOpts = ortho.getSceneOptions() orthoOpts = ortho.getSceneOptions()
toolSpecs = layouts.layouts[self] toolSpecs = [
actions.ActionButton(ortho, 'screenshot'),
props .Widget( 'zoom', spin=False, showLimits=False),
props .Widget( 'layout'),
props .Widget( 'showXCanvas'),
props .Widget( 'showYCanvas'),
props .Widget( 'showZCanvas'),
actions.ActionButton(self, 'more')]
targets = {'screenshot' : ortho, targets = {'screenshot' : ortho,
'zoom' : orthoOpts, 'zoom' : orthoOpts,
'layout' : orthoOpts, 'layout' : orthoOpts,
...@@ -39,4 +48,4 @@ class OrthoToolBar(fsltoolbar.FSLViewToolBar): ...@@ -39,4 +48,4 @@ class OrthoToolBar(fsltoolbar.FSLViewToolBar):
def showMoreSettings(self, *a): def showMoreSettings(self, *a):
import canvassettingspanel import canvassettingspanel
self.orthoPanel.togglePanel( self.orthoPanel.togglePanel(
canvassettingspanel.CanvasSettingsPanel, True, self.orthoPanel) canvassettingspanel.CanvasSettingsPanel, True, self.orthoPanel)
...@@ -33,7 +33,9 @@ _TOOLBAR_PROPS = td.TypeDict({ ...@@ -33,7 +33,9 @@ _TOOLBAR_PROPS = td.TypeDict({
props.Widget('contrast', spin=False, showLimits=False)], props.Widget('contrast', spin=False, showLimits=False)],
'VolumeOpts' : [ 'VolumeOpts' : [
props.Widget('cmap')], props.Widget('cmap'),
props.Widget('displayRange', showLimits=False)],
'MaskOpts' : [ 'MaskOpts' : [
props.Widget('colour')], props.Widget('colour')],
...@@ -172,7 +174,7 @@ class OverlayDisplayToolBar(fsltoolbar.FSLViewToolBar): ...@@ -172,7 +174,7 @@ class OverlayDisplayToolBar(fsltoolbar.FSLViewToolBar):
more = props.buildGUI( more = props.buildGUI(
self, self,
self, self,
view=actions.ActionButton(type(self), 'more')) view=actions.ActionButton(self, 'more'))
tools .append(more) tools .append(more)
labels.append(None) labels.append(None)
......
...@@ -17,15 +17,6 @@ import fsl.fslview.actions as actions ...@@ -17,15 +17,6 @@ import fsl.fslview.actions as actions
from fsl.fslview.profiles.orthoviewprofile import OrthoViewProfile from fsl.fslview.profiles.orthoviewprofile import OrthoViewProfile
from fsl.fslview.profiles.orthoeditprofile import OrthoEditProfile from fsl.fslview.profiles.orthoeditprofile import OrthoEditProfile
from fsl.fslview.views import OrthoPanel
from fsl.fslview.views import LightBoxPanel
from fsl.fslview.controls import OrthoToolBar
from fsl.fslview.controls import LightBoxToolBar
from fsl.fslview.displaycontext import OrthoOpts
from fsl.fslview.displaycontext import LightBoxOpts
def widget(labelCls, name, *args, **kwargs): def widget(labelCls, name, *args, **kwargs):
...@@ -38,15 +29,6 @@ def widget(labelCls, name, *args, **kwargs): ...@@ -38,15 +29,6 @@ def widget(labelCls, name, *args, **kwargs):
######################################## ########################################
OrthoToolBarLayout = [
actions.ActionButton(OrthoPanel, 'screenshot'),
widget( OrthoOpts, 'zoom', spin=False, showLimits=False),
widget( OrthoOpts, 'layout'),
widget( OrthoOpts, 'showXCanvas'),
widget( OrthoOpts, 'showYCanvas'),
widget( OrthoOpts, 'showZCanvas'),
actions.ActionButton(OrthoToolBar, 'more')]
OrthoProfileToolBarViewLayout = [ OrthoProfileToolBarViewLayout = [
actions.ActionButton(OrthoViewProfile, 'resetZoom'), actions.ActionButton(OrthoViewProfile, 'resetZoom'),
...@@ -80,25 +62,8 @@ OrthoProfileToolBarEditLayout = [ ...@@ -80,25 +62,8 @@ OrthoProfileToolBarEditLayout = [
enabledWhen=lambda p: p.mode == 'selint')] enabledWhen=lambda p: p.mode == 'selint')]
#######################################
# LightBoxPanel control panels/toolbars
#######################################
LightBoxToolBarLayout = [
actions.ActionButton(LightBoxPanel, 'screenshot'),
widget( LightBoxOpts, 'zax'),
widget(LightBoxOpts, 'sliceSpacing', spin=False, showLimits=False),
widget(LightBoxOpts, 'zrange', spin=False, showLimits=False),
widget(LightBoxOpts, 'zoom', spin=False, showLimits=False),
actions.ActionButton(LightBoxToolBar, 'more')]
layouts = td.TypeDict({ layouts = td.TypeDict({
'OrthoToolBar' : OrthoToolBarLayout,
'LightBoxToolBar' : LightBoxToolBarLayout,
('OrthoProfileToolBar', 'view') : OrthoProfileToolBarViewLayout, ('OrthoProfileToolBar', 'view') : OrthoProfileToolBarViewLayout,
('OrthoProfileToolBar', 'edit') : OrthoProfileToolBarEditLayout, ('OrthoProfileToolBar', 'edit') : OrthoProfileToolBarEditLayout,
}) })
......
...@@ -216,7 +216,7 @@ class FSLViewToolBar(fslpanel._FSLViewPanel, wx.PyPanel): ...@@ -216,7 +216,7 @@ class FSLViewToolBar(fslpanel._FSLViewPanel, wx.PyPanel):
tool = props.buildGUI( tool = props.buildGUI(
self, targets[toolSpec.key], toolSpec, showUnlink=False) self, targets[toolSpec.key], toolSpec, showUnlink=False)
if isinstance(toolSpec, actions.ActionButton): if isinstance(toolSpec, props.Button):
label = None label = None
else: else:
......
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