Ejemplo n.º 1
0
    def __init__(self, parent, overlayList, displayCtx, frame, psPanel):
        """Create a ``PowerSpectrumToolBar``.

        :arg parent:      The :mod:`wx` parent object.
        :arg overlayList: The :class:`.OverlayList` instance.
        :arg displayCtx:  The :class:`.DisplayContext` instance.
        :arg frame:       The :class:`.FSLeyesFrame` instance.
        :arg psPanel:     The :class:`.PowerSpectrumPanel` instance.
        """

        plottoolbar.PlotToolBar.__init__(
            self, parent, overlayList, displayCtx, frame, psPanel)

        togControl = actions.ToggleActionButton(
            'togglePowerSpectrumControl',
            actionKwargs={'floatPane' : True},
            icon=[icons.findImageFile('spannerHighlight24'),
                  icons.findImageFile('spanner24')],
            tooltip=tooltips.actions[psPanel, 'togglePowerSpectrumControl'])

        togList = actions.ToggleActionButton(
            'togglePlotList',
            actionKwargs={'floatPane' : True},
            icon=[icons.findImageFile('listHighlight24'),
                  icons.findImageFile('list24')],
            tooltip=tooltips.actions[psPanel, 'togglePlotList'])

        togControl = props.buildGUI(self, psPanel, togControl)
        togList    = props.buildGUI(self, psPanel, togList)

        self.InsertTools([togControl, togList], 0)

        nav = [togControl, togList] + self.getCommonNavOrder()

        self.setNavOrder(nav)
Ejemplo n.º 2
0
    def __init__(self, parent, overlayList, displayCtx, frame, histPanel):
        """Create a ``HistogramToolBar``.

        :arg parent:      The :mod:`wx` parent object.
        :arg overlayList: The :class:`.OverlayList` instance.
        :arg displayCtx:  The :class:`.DisplayContext` instance.
        :arg frame:       The :class:`.FSLeyesFrame` instance.
        :arg histPanel:   The :class:`.HistogramPanel` instance.
        """

        plottoolbar.PlotToolBar.__init__(self, parent, overlayList, displayCtx,
                                         frame, histPanel)

        togControl = actions.ToggleActionButton(
            'toggleHistogramControl',
            actionKwargs={'floatPane': True},
            icon=[
                icons.findImageFile('spannerHighlight24'),
                icons.findImageFile('spanner24')
            ],
            tooltip=tooltips.actions[histPanel, 'toggleHistogramControl'])

        togList = actions.ToggleActionButton(
            'togglePlotList',
            actionKwargs={'floatPane': True},
            icon=[
                icons.findImageFile('listHighlight24'),
                icons.findImageFile('list24')
            ],
            tooltip=tooltips.actions[histPanel, 'togglePlotList'])

        togOverlay = actions.ToggleActionButton(
            'toggleHistogramOverlay',
            icon=[
                icons.findImageFile('histogramOverlayHighlight24'),
                icons.findImageFile('histogramOverlay24')
            ])

        mode = props.Widget('histType',
                            labels=strings.choices[histPanel, 'histType'],
                            tooltip=tooltips.properties[histPanel, 'histType'])

        togControl = props.buildGUI(self, histPanel, togControl)
        togList = props.buildGUI(self, histPanel, togList)
        togOverlay = props.buildGUI(self, histPanel, togOverlay)
        mode = props.buildGUI(self, histPanel, mode)

        lblMode = self.MakeLabelledTool(
            mode, strings.properties[histPanel, 'histType'])

        self.InsertTools([togControl, togList], 0)
        self.AddTool(togOverlay)
        self.AddTool(lblMode)


        nav = [togControl, togList]    + \
              self.getCommonNavOrder() + \
              [togOverlay, mode]

        self.setNavOrder(nav)
Ejemplo n.º 3
0
    def __makeDisplayTools(self, display):
        """Creates and returns a collection of controls for editing properties
        of the given :class:`.Display` instance.
        """

        viewPanel = self.__viewPanel

        # Display settings
        nameSpec = _TOOLBAR_PROPS[display, 'name']
        typeSpec = _TOOLBAR_PROPS[display, 'overlayType']
        alphaSpec = _TOOLBAR_PROPS[display, 'alpha']
        briSpec = _TOOLBAR_PROPS[display, 'brightness']
        conSpec = _TOOLBAR_PROPS[display, 'contrast']

        # Buttons which toggle overlay
        # info and display panel
        panelSpec = actions.ToggleActionButton(
            'toggleDisplayPanel',
            actionKwargs={'floatPane': True},
            icon=[
                icons.findImageFile('gearHighlight24'),
                icons.findImageFile('gear24')
            ],
            tooltip=fsltooltips.actions[viewPanel, 'toggleDisplayPanel'])

        infoSpec = actions.ToggleActionButton(
            'toggleOverlayInfo',
            actionKwargs={'floatPane': True},
            icon=[
                icons.findImageFile('informationHighlight24'),
                icons.findImageFile('information24')
            ],
            tooltip=fsltooltips.actions[viewPanel, 'toggleOverlayInfo'])

        # Name/overlay type and brightness/contrast
        # are respectively placed together
        nameTypePanel = wx.Panel(self)
        briconPanel = wx.Panel(self)
        nameTypeSizer = wx.BoxSizer(wx.VERTICAL)
        briconSizer = wx.FlexGridSizer(2, 2, 0, 0)

        briconSizer.AddGrowableCol(1)

        nameTypePanel.SetSizer(nameTypeSizer)
        briconPanel.SetSizer(briconSizer)

        panelWidget = props.buildGUI(self, viewPanel, panelSpec)
        infoWidget = props.buildGUI(self, viewPanel, infoSpec)
        nameWidget = props.buildGUI(nameTypePanel, display, nameSpec)
        typeWidget = props.buildGUI(nameTypePanel, display, typeSpec)
        briWidget = props.buildGUI(briconPanel, display, briSpec)
        conWidget = props.buildGUI(briconPanel, display, conSpec)
        alphaWidget = props.buildGUI(self, display, alphaSpec)

        briLabel = wx.StaticText(briconPanel)
        conLabel = wx.StaticText(briconPanel)

        briLabel.SetLabel(strings.properties[display, 'brightness'])
        conLabel.SetLabel(strings.properties[display, 'contrast'])

        # name/type panel
        nameTypeSizer.Add(nameWidget, flag=wx.EXPAND)
        nameTypeSizer.Add(typeWidget, flag=wx.EXPAND)

        # opacity is given a label
        alphaPanel = self.MakeLabelledTool(
            alphaWidget, strings.properties[display, 'alpha'])

        # bricon panel
        briconSizer.Add(briLabel)
        briconSizer.Add(briWidget)
        briconSizer.Add(conLabel)
        briconSizer.Add(conWidget)

        tools = [
            panelWidget, infoWidget, nameTypePanel, alphaPanel, briconPanel
        ]
        nav = [
            panelWidget, infoWidget, nameWidget, typeWidget, alphaWidget,
            briWidget, conWidget
        ]

        return tools, nav
Ejemplo n.º 4
0
    def __init__(self, parent, overlayList, displayCtx, frame, lb):
        """Create a ``LightBoxToolBar``.

        :arg parent:      The :mod:`wx` parent object.
        :arg overlayList: The :class:`.OverlayList` instance.
        :arg displayCtx:  The :class:`.DisplayContext` instance.
        :arg frame:       The :class:`.FSLeyesFrame` instance.
        :arg lb:          The :class:`.LightBoxPanel` instance.
        """

        fsltoolbar.FSLeyesToolBar.__init__(self,
                                           parent,
                                           overlayList,
                                           displayCtx,
                                           frame,
                                           height=24,
                                           kbFocus=True)

        self.lightBoxPanel = lb

        lbOpts = lb.sceneOpts

        if BUM_MODE: coronalIcon = 'coronalBumSlice24'
        else: coronalIcon = 'coronalSlice24'
        if BUM_MODE: coronalHighlightIcon = 'coronalBumSliceHighlight24'
        else: coronalHighlightIcon = 'coronalSliceHighlight24'

        icons = {
            'screenshot':
            fslicons.findImageFile('camera24'),
            'movieMode': [
                fslicons.findImageFile('movieHighlight24'),
                fslicons.findImageFile('movie24')
            ],
            'toggleCanvasSettingsPanel': [
                fslicons.findImageFile('spannerHighlight24'),
                fslicons.findImageFile('spanner24')
            ],
            'zax': {
                0: [
                    fslicons.findImageFile('sagittalSliceHighlight24'),
                    fslicons.findImageFile('sagittalSlice24')
                ],
                1: [
                    fslicons.findImageFile(coronalHighlightIcon),
                    fslicons.findImageFile(coronalIcon)
                ],
                2: [
                    fslicons.findImageFile('axialSliceHighlight24'),
                    fslicons.findImageFile('axialSlice24')
                ],
            }
        }

        tooltips = {
            'screenshot':
            fsltooltips.actions[lb, 'screenshot'],
            'movieMode':
            fsltooltips.properties[lb, 'movieMode'],
            'zax':
            fsltooltips.properties[lbOpts, 'zax'],
            'sliceSpacing':
            fsltooltips.properties[lbOpts, 'sliceSpacing'],
            'zrange':
            fsltooltips.properties[lbOpts, 'zrange'],
            'zoom':
            fsltooltips.properties[lbOpts, 'zoom'],
            'toggleCanvasSettingsPanel':
            fsltooltips.actions[lb, 'toggleCanvasSettingsPanel'],
        }

        specs = {
            'toggleCanvasSettingsPanel':
            actions.ToggleActionButton(
                'toggleCanvasSettingsPanel',
                actionKwargs={'floatPane': True},
                icon=icons['toggleCanvasSettingsPanel'],
                tooltip=tooltips['toggleCanvasSettingsPanel']),
            'screenshot':
            actions.ActionButton('screenshot',
                                 icon=icons['screenshot'],
                                 tooltip=tooltips['screenshot']),
            'movieMode':
            props.Widget('movieMode',
                         icon=icons['movieMode'],
                         tooltip=tooltips['movieMode']),
            'zax':
            props.Widget('zax', icons=icons['zax'], tooltip=tooltips['zax']),
            'sliceSpacing':
            props.Widget('sliceSpacing',
                         spin=False,
                         showLimits=False,
                         tooltip=tooltips['sliceSpacing']),
            'zrange':
            props.Widget('zrange',
                         spin=False,
                         showLimits=False,
                         tooltip=tooltips['zrange'],
                         labels=[
                             strings.choices[lbOpts, 'zrange', 'min'],
                             strings.choices[lbOpts, 'zrange', 'max']
                         ]),
            'zoom':
            props.Widget('zoom',
                         spin=False,
                         showLimits=False,
                         tooltip=tooltips['zoom']),
        }

        # Slice spacing and zoom go on a single panel
        panel = wx.Panel(self)
        sizer = wx.FlexGridSizer(2, 2, 0, 0)
        panel.SetSizer(sizer)

        more = props.buildGUI(self, lb, specs['toggleCanvasSettingsPanel'])
        screenshot = props.buildGUI(self, lb, specs['screenshot'])
        movieMode = props.buildGUI(self, lb, specs['movieMode'])
        zax = props.buildGUI(self, lbOpts, specs['zax'])
        zrange = props.buildGUI(self, lbOpts, specs['zrange'])
        zoom = props.buildGUI(panel, lbOpts, specs['zoom'])
        spacing = props.buildGUI(panel, lbOpts, specs['sliceSpacing'])
        zoomLabel = wx.StaticText(panel)
        spacingLabel = wx.StaticText(panel)

        zoomLabel.SetLabel(strings.properties[lbOpts, 'zoom'])
        spacingLabel.SetLabel(strings.properties[lbOpts, 'sliceSpacing'])

        sizer.Add(zoomLabel)
        sizer.Add(zoom, flag=wx.EXPAND)
        sizer.Add(spacingLabel)
        sizer.Add(spacing, flag=wx.EXPAND)

        tools = [
            more, screenshot,
            fsltoolbar.ToolBarDivider(self, height=24,
                                      orient=wx.VERTICAL), zax,
            fsltoolbar.ToolBarDivider(self, height=24, orient=wx.VERTICAL),
            movieMode, zrange, panel
        ]
        nav = [more, screenshot, zax, movieMode, zrange, zoom, spacing]

        self.SetTools(tools)
        self.setNavOrder(nav)
Ejemplo n.º 5
0
    def __makeTools(self, *a):
        """Called by :meth:`__init__`, and whenever the
        :attr:`.ViewPanel.profile` property changes.

        Re-creates all tools shown on this ``OrthoToolBar``.
        """

        ortho = self.orthoPanel
        orthoOpts = ortho.sceneOpts
        profile = ortho.getCurrentProfile()

        coronalIcon = 'coronalSlice24'
        coronalHighlightIcon = 'coronalSliceHighlight24'

        icons = {
            'screenshot':
            fslicons.findImageFile('camera24'),
            'resetDisplay':
            fslicons.findImageFile('resetZoom24'),
            'showCursorAndLabels': [
                fslicons.findImageFile('addHighlight24'),
                fslicons.findImageFile('add24')
            ],
            'movieMode': [
                fslicons.findImageFile('movieHighlight24'),
                fslicons.findImageFile('movie24')
            ],
            'showXCanvas': [
                fslicons.findImageFile('sagittalSliceHighlight24'),
                fslicons.findImageFile('sagittalSlice24')
            ],
            'showYCanvas': [
                fslicons.findImageFile(coronalHighlightIcon),
                fslicons.findImageFile(coronalIcon)
            ],
            'showZCanvas': [
                fslicons.findImageFile('axialSliceHighlight24'),
                fslicons.findImageFile('axialSlice24')
            ],
            'toggleCanvasSettingsPanel': [
                fslicons.findImageFile('spannerHighlight24'),
                fslicons.findImageFile('spanner24')
            ],
            'layout': {
                'horizontal': [
                    fslicons.findImageFile('horizontalLayoutHighlight24'),
                    fslicons.findImageFile('horizontalLayout24')
                ],
                'vertical': [
                    fslicons.findImageFile('verticalLayoutHighlight24'),
                    fslicons.findImageFile('verticalLayout24')
                ],
                'grid': [
                    fslicons.findImageFile('gridLayoutHighlight24'),
                    fslicons.findImageFile('gridLayout24')
                ]
            }
        }

        tooltips = {
            'screenshot':
            fsltooltips.actions[ortho, 'screenshot'],
            'resetDisplay':
            fsltooltips.actions[profile, 'resetDisplay'],
            'movieMode':
            fsltooltips.properties[ortho, 'movieMode'],
            'showCursorAndLabels':
            fsltooltips.properties[self, 'showCursorAndLabels'],
            'zoom':
            fsltooltips.properties[orthoOpts, 'zoom'],
            'layout':
            fsltooltips.properties[orthoOpts, 'layout'],
            'showXCanvas':
            fsltooltips.properties[orthoOpts, 'showXCanvas'],
            'showYCanvas':
            fsltooltips.properties[orthoOpts, 'showYCanvas'],
            'showZCanvas':
            fsltooltips.properties[orthoOpts, 'showZCanvas'],
            'toggleCanvasSettingsPanel':
            fsltooltips.actions[ortho, 'toggleCanvasSettingsPanel'],
        }

        targets = {
            'screenshot': ortho,
            'movieMode': ortho,
            'showCursorAndLabels': self,
            'resetDisplay': profile,
            'zoom': orthoOpts,
            'layout': orthoOpts,
            'showXCanvas': orthoOpts,
            'showYCanvas': orthoOpts,
            'showZCanvas': orthoOpts,
            'toggleCanvasSettingsPanel': ortho
        }

        toolSpecs = [
            actions.ToggleActionButton(
                'toggleCanvasSettingsPanel',
                actionKwargs={'floatPane': True},
                icon=icons['toggleCanvasSettingsPanel'],
                tooltip=tooltips['toggleCanvasSettingsPanel']),
            actions.ActionButton('screenshot',
                                 icon=icons['screenshot'],
                                 tooltip=tooltips['screenshot']),
            'div',
            props.Widget('showXCanvas',
                         icon=icons['showXCanvas'],
                         tooltip=tooltips['showXCanvas']),
            props.Widget('showYCanvas',
                         icon=icons['showYCanvas'],
                         tooltip=tooltips['showYCanvas']),
            props.Widget('showZCanvas',
                         icon=icons['showZCanvas'],
                         tooltip=tooltips['showZCanvas']),
            'div',
            props.Widget('layout',
                         icons=icons['layout'],
                         tooltip=tooltips['layout']),
            'div',
            props.Widget('movieMode',
                         icon=icons['movieMode'],
                         tooltip=tooltips['movieMode']),
            props.Widget('showCursorAndLabels',
                         icon=icons['showCursorAndLabels'],
                         tooltip=tooltips['showCursorAndLabels']),
            actions.ActionButton('resetDisplay',
                                 icon=icons['resetDisplay'],
                                 tooltip=tooltips['resetDisplay']),
            props.Widget('zoom',
                         spin=True,
                         slider=True,
                         showLimits=False,
                         spinWidth=5,
                         tooltip=tooltips['zoom']),
        ]

        tools = []
        nav = []

        for spec in toolSpecs:

            if spec == 'div':
                tools.append(
                    fsltoolbar.ToolBarDivider(self,
                                              height=24,
                                              orient=wx.VERTICAL))
                continue

            widget = props.buildGUI(self, targets[spec.key], spec)
            navWidget = widget

            if spec.key in ('zoom', ):
                widget = self.MakeLabelledTool(
                    widget, strings.properties[targets[spec.key], spec.key])

            tools.append(widget)
            nav.append(navWidget)

        self.SetTools(tools, destroy=True)
        self.setNavOrder(nav)
Ejemplo n.º 6
0
    def __makeTools(self):
        """Called by :meth:`__init__`. Creates the toolbar widgets. """

        panel = self.panel
        opts = panel.sceneOpts
        profile = panel.getCurrentProfile()

        icons = {
            'screenshot':
            fslicons.findImageFile('camera24'),
            'resetDisplay':
            fslicons.findImageFile('resetZoom24'),
            'showCursorAndLegend': [
                fslicons.findImageFile('addHighlight24'),
                fslicons.findImageFile('add24')
            ],
            'movieMode': [
                fslicons.findImageFile('movieHighlight24'),
                fslicons.findImageFile('movie24')
            ],
            'toggleCanvasSettingsPanel': [
                fslicons.findImageFile('spannerHighlight24'),
                fslicons.findImageFile('spanner24')
            ],
        }

        tooltips = {
            'screenshot':
            fsltooltips.actions[panel, 'screenshot'],
            'resetDisplay':
            fsltooltips.actions[profile, 'resetDisplay'],
            'movieMode':
            fsltooltips.properties[panel, 'movieMode'],
            'showCursorAndLegend':
            fsltooltips.properties[self, 'showCursorAndLegend'],
            'zoom':
            fsltooltips.properties[opts, 'zoom'],
            'toggleCanvasSettingsPanel':
            fsltooltips.actions[panel, 'toggleCanvasSettingsPanel'],
        }

        targets = {
            'screenshot': panel,
            'resetDisplay': profile,
            'movieMode': panel,
            'showCursorAndLegend': self,
            'zoom': opts,
            'toggleCanvasSettingsPanel': panel,
        }

        toolSpecs = [
            actions.ToggleActionButton(
                'toggleCanvasSettingsPanel',
                actionKwargs={'floatPane': True},
                icon=icons['toggleCanvasSettingsPanel'],
                tooltip=tooltips['toggleCanvasSettingsPanel']),
            actions.ActionButton('screenshot',
                                 icon=icons['screenshot'],
                                 tooltip=tooltips['screenshot']),
            'div',
            props.Widget('movieMode',
                         icon=icons['movieMode'],
                         tooltip=tooltips['movieMode']),
            props.Widget('showCursorAndLegend',
                         icon=icons['showCursorAndLegend'],
                         tooltip=tooltips['showCursorAndLegend']),
            actions.ActionButton('resetDisplay',
                                 icon=icons['resetDisplay'],
                                 tooltip=tooltips['resetDisplay']),
            props.Widget('zoom',
                         spin=True,
                         slider=True,
                         showLimits=False,
                         spinWidth=5,
                         tooltip=tooltips['zoom']),
        ]

        tools = []
        nav = []

        for spec in toolSpecs:

            if spec == 'div':
                tools.append(
                    fsltoolbar.ToolBarDivider(self,
                                              height=24,
                                              orient=wx.VERTICAL))
                continue

            widget = props.buildGUI(self, targets[spec.key], spec)
            navWidget = widget

            if spec.key in ('zoom', ):
                widget = self.MakeLabelledTool(
                    widget, strings.properties[targets[spec.key], spec.key])

            tools.append(widget)
            nav.append(navWidget)

        self.SetTools(tools, destroy=True)
        self.setNavOrder(nav)
Ejemplo n.º 7
0
                                            'clearSelection'],
    'fillSelection'   : fsltooltips.actions['OrthoEditProfile.'
                                            'fillSelection'],
    'eraseSelection'  : fsltooltips.actions['OrthoEditProfile.'
                                            'eraseSelection'],
    'copySelection'   : fsltooltips.actions['OrthoEditProfile.'
                                            'copySelection'],
    'pasteSelection'  : fsltooltips.actions['OrthoEditProfile.'
                                            'pasteSelection'],
}

_TOOLBAR_SPECS = [

    actions.ToggleActionButton(
        'toggleEditPanel',
        actionKwargs={'floatPane' : True},
        icon=_ICONS['toggleEditPanel'],
        tooltip=_TOOLTIPS['toggleEditPanel']),
    actions.ActionButton(
        'createMask',
        icon=_ICONS['createMask'],
        tooltip=_TOOLTIPS['createMask']),

    'div',

    props.Widget(
        'locationFollowsMouse',
        icon=_ICONS['locationFollowsMouse'],
        tooltip=_TOOLTIPS['locationFollowsMouse']),

    'div',