Exemple #1
0
    def __init__(self, parent, overlayList, displayCtx, frame, plotPanel):
        """Create a ``PlotToolBar``.

        :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 plotPanel:   The :class:`.PlotPanel` instance.
        """

        ctrlpanel.ControlToolBar.__init__(self,
                                          parent,
                                          overlayList,
                                          displayCtx,
                                          frame,
                                          height=24,
                                          kbFocus=True)

        self.__plotPanel = plotPanel

        import_ = actions.ActionButton(
            'importDataSeries',
            icon=icons.findImageFile('importDataSeries24'),
            tooltip=tooltips.actions[plotPanel, 'importDataSeries'])
        export = actions.ActionButton(
            'exportDataSeries',
            icon=icons.findImageFile('exportDataSeries24'),
            tooltip=tooltips.actions[plotPanel, 'exportDataSeries'])
        add = actions.ActionButton('addDataSeries',
                                   icon=icons.findImageFile('add24'),
                                   tooltip=tooltips.actions[plotPanel,
                                                            'addDataSeries'])
        remove = actions.ActionButton(
            'removeDataSeries',
            icon=icons.findImageFile('remove24'),
            tooltip=tooltips.actions[plotPanel, 'removeDataSeries'])
        screenshot = actions.ActionButton(
            'screenshot',
            icon=icons.findImageFile('camera24'),
            tooltip=tooltips.actions[plotPanel, 'screenshot'])

        screenshot = props.buildGUI(self, plotPanel, screenshot)
        import_ = props.buildGUI(self, plotPanel, import_)
        export = props.buildGUI(self, plotPanel, export)
        add = props.buildGUI(self, plotPanel, add)
        remove = props.buildGUI(self, plotPanel, remove)

        self.__commonTools = [screenshot, import_, export, add, remove]
        self.__commonNav = [screenshot, import_, export, add, remove]

        self.SetTools([screenshot, import_, export, add, remove])
Exemple #2
0
 props.Widget('alpha',
              spin=False,
              showLimits=False,
              tooltip=_TOOLTIPS['Display.alpha']),
 'Display.brightness':
 props.Widget('brightness',
              spin=False,
              showLimits=False,
              tooltip=_TOOLTIPS['Display.brightness']),
 'Display.contrast':
 props.Widget('contrast',
              spin=False,
              showLimits=False,
              tooltip=_TOOLTIPS['Display.contrast']),
 'VolumeOpts.resetDisplayRange':
 actions.ActionButton('resetDisplayRange',
                      icon=icons.findImageFile('verticalReset32')),
 'VolumeOpts.displayRange':
 props.Widget('displayRange',
              slider=False,
              showLimits=False,
              spinWidth=10,
              tooltip=_TOOLTIPS['ColourMapOpts.displayRange'],
              labels=[
                  strings.choices['ColourMapOpts.displayRange.min'],
                  strings.choices['ColourMapOpts.displayRange.max']
              ]),
 'VolumeOpts.cmap':
 props.Widget('cmap',
              labels=fslcm.getColourMapLabel,
              tooltip=_TOOLTIPS['VolumeOpts.cmap']),
 'VolumeOpts.useNegativeCmap':
    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)
    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)
Exemple #5
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)
                                            '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',


    actions.ActionButton(
        'undo',
        icon=_ICONS['undo'],