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)
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])
def __init__(self, parent, overlayList, displayCtx, frame, tsPanel): """Create a ``TimeSeriesToolBar``. :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 tsPanel: The :class:`.TimeSeriesPanel` instance. """ plottoolbar.PlotToolBar.__init__(self, parent, overlayList, displayCtx, frame, tsPanel) togControl = actions.ToggleActionButton( 'toggleTimeSeriesControl', actionKwargs={'floatPane': True}, icon=[ icons.findImageFile('spannerHighlight24'), icons.findImageFile('spanner24') ], tooltip=tooltips.actions[tsPanel, 'toggleTimeSeriesControl']) togList = actions.ToggleActionButton( 'togglePlotList', actionKwargs={'floatPane': True}, icon=[ icons.findImageFile('listHighlight24'), icons.findImageFile('list24') ], tooltip=tooltips.actions[tsPanel, 'togglePlotList']) mode = props.Widget('plotMode', labels=strings.choices[tsPanel, 'plotMode'], tooltip=tooltips.properties[tsPanel, 'plotMode']) togControl = props.buildGUI(self, tsPanel, togControl) togList = props.buildGUI(self, tsPanel, togList) mode = props.buildGUI(self, tsPanel, mode) lblMode = self.MakeLabelledTool( mode, strings.properties[tsPanel, 'plotMode']) self.InsertTools([togControl, togList], 0) self.AddTool(lblMode) nav = [togControl, togList] + self.getCommonNavOrder() + [mode] self.setNavOrder(nav)
'intensityThres': strings.properties[OrthoEditProfile, 'intensityThres'], 'searchRadius': strings.properties[OrthoEditProfile, 'searchRadius'], 'fillValue': strings.properties[OrthoEditProfile, 'fillValue'], 'targetImage': strings.properties[OrthoEditProfile, 'targetImage'], } """This dictionary contains labels for some :class:`OrthoEditToolBar` controls. It is referenced in the :attr:`_TOOLBAR_SPECS` dictionary. """ _ICONS = { 'drawMode': [ fslicons.findImageFile('drawModeHighlight24'), fslicons.findImageFile('drawMode24'), fslicons.findImageFile('selectModeHighlight24'), fslicons.findImageFile('selectMode24') ], 'mode': { 'nav': [ fslicons.findImageFile('addHighlight24'), fslicons.findImageFile('add24'), ], 'sel': [ fslicons.findImageFile('pencilHighlight24'), fslicons.findImageFile('pencil24'), ], 'desel': [ fslicons.findImageFile('eraserHighlight24'),
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
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)
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)
navWidget = widget if spec.label is not None: widget = self.MakeLabelledTool(widget, spec.label) tools.append(widget) nav .append(navWidget) self.SetTools(tools) self.setNavOrder(nav) _ICONS = { 'locationFollowsMouse' : [ fslicons.findImageFile('locationFollowsMouseHighlight24'), fslicons.findImageFile('locationFollowsMouse24')], 'showSelection' : [ fslicons.findImageFile('showSelectionHighlight24'), fslicons.findImageFile('showSelection24')], 'toggleEditPanel' : [fslicons.findImageFile('editSpannerHighlight24'), fslicons.findImageFile('editSpanner24')], 'undo' : fslicons.findImageFile('undo24'), 'redo' : fslicons.findImageFile('redo24'), 'createMask' : fslicons.findImageFile('new24'), 'clearSelection' : fslicons.findImageFile('clearSelection24'), 'fillSelection' : fslicons.findImageFile('fillSelection24'), 'eraseSelection' : fslicons.findImageFile('eraseSelection24'), 'copySelection' : fslicons.findImageFile('copySelection24'),