fsleyes.profiles.profilemap

This module is used by the Profile and ProfileManager classes.

It defines a few dictionaries which define the profile type to use for each ViewPanel type, temporary mouse/keyboard interaction modes, and alternate mode handlers for the profiles contained in the profiles package.

profiles

This dictionary is used by the ProfileManager to figure out which profiles are available for each ViewPanel.

profileHandlers

This dictionary is used by the ProfileManager class to figure out which Profile sub-class to create for a given ViewPanel instance and profile identifier.

tempModeMap

The tempModeMap dictionary defines temporary modes, for each Profile sub-class which, when in a given mode, can be accessed with a keyboard modifer (e.g.

altHandlerMap

The altHandlerMap dictionary defines alternate handlers for a given mode and event type.

fsleyes.profiles.profilemap.profiles = {<class 'fsleyes.views.orthopanel.OrthoPanel'>: ['view', 'edit', 'crop'], <class 'fsleyes.views.lightboxpanel.LightBoxPanel'>: ['view'], <class 'fsleyes.views.timeseriespanel.TimeSeriesPanel'>: ['view'], <class 'fsleyes.views.histogrampanel.HistogramPanel'>: ['view'], <class 'fsleyes.views.powerspectrumpanel.PowerSpectrumPanel'>: ['view'], <class 'fsleyes.views.scene3dpanel.Scene3DPanel'>: ['view']}

This dictionary is used by the ProfileManager to figure out which profiles are available for each ViewPanel. They are added as options to the ViewPanel.profile property.

fsleyes.profiles.profilemap.profileHandlers = {(<class 'fsleyes.views.orthopanel.OrthoPanel'>, 'view'): <class 'fsleyes.profiles.orthoviewprofile.OrthoViewProfile'>, (<class 'fsleyes.views.orthopanel.OrthoPanel'>, 'edit'): <class 'fsleyes.profiles.orthoeditprofile.OrthoEditProfile'>, (<class 'fsleyes.views.orthopanel.OrthoPanel'>, 'crop'): <class 'fsleyes.profiles.orthocropprofile.OrthoCropProfile'>, (<class 'fsleyes.views.lightboxpanel.LightBoxPanel'>, 'view'): <class 'fsleyes.profiles.lightboxviewprofile.LightBoxViewProfile'>, (<class 'fsleyes.views.timeseriespanel.TimeSeriesPanel'>, 'view'): <class 'fsleyes.profiles.timeseriesprofile.TimeSeriesProfile'>, (<class 'fsleyes.views.histogrampanel.HistogramPanel'>, 'view'): <class 'fsleyes.profiles.histogramprofile.HistogramProfile'>, (<class 'fsleyes.views.powerspectrumpanel.PowerSpectrumPanel'>, 'view'): <class 'fsleyes.profiles.plotprofile.PlotProfile'>, (<class 'fsleyes.views.scene3dpanel.Scene3DPanel'>, 'view'): <class 'fsleyes.profiles.scene3dviewprofile.Scene3DViewProfile'>}

This dictionary is used by the ProfileManager class to figure out which Profile sub-class to create for a given ViewPanel instance and profile identifier.

fsleyes.profiles.profilemap.tempModeMap = {<class 'fsleyes.profiles.orthoviewprofile.OrthoViewProfile'>: OrderedDict([(('nav', <MagicMock name='mock.WXK_CONTROL' id='140225885535488'>), 'zoom'), (('nav', <MagicMock name='mock.WXK_ALT' id='140225884645264'>), 'pan'), (('nav', <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>), 'slice'), (('nav', (<MagicMock name='mock.WXK_CONTROL' id='140225885535488'>, <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>)), 'bricon')]), <class 'fsleyes.profiles.orthoeditprofile.OrthoEditProfile'>: OrderedDict([(('sel', <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>), 'slice'), (('desel', <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>), 'slice'), (('selint', <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>), 'slice'), (('fill', <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>), 'slice'), (('sel', <MagicMock name='mock.WXK_ALT' id='140225884645264'>), 'pan'), (('desel', <MagicMock name='mock.WXK_ALT' id='140225884645264'>), 'pan'), (('selint', <MagicMock name='mock.WXK_ALT' id='140225884645264'>), 'pan'), (('fill', <MagicMock name='mock.WXK_ALT' id='140225884645264'>), 'pan'), (('sel', <MagicMock name='mock.WXK_CONTROL' id='140225885535488'>), 'zoom'), (('desel', <MagicMock name='mock.WXK_CONTROL' id='140225885535488'>), 'zoom'), (('selint', <MagicMock name='mock.WXK_CONTROL' id='140225885535488'>), 'zoom'), (('fill', <MagicMock name='mock.WXK_CONTROL' id='140225885535488'>), 'zoom'), (('sel', (<MagicMock name='mock.WXK_CONTROL' id='140225885535488'>, <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>)), 'chsize'), (('desel', (<MagicMock name='mock.WXK_CONTROL' id='140225885535488'>, <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>)), 'chsize'), (('selint', (<MagicMock name='mock.WXK_CONTROL' id='140225885535488'>, <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>)), 'chthres'), (('selint', (<MagicMock name='mock.WXK_ALT' id='140225884645264'>, <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>)), 'chrad')]), <class 'fsleyes.profiles.orthocropprofile.OrthoCropProfile'>: OrderedDict([(('crop', <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>), 'nav'), (('crop', <MagicMock name='mock.WXK_CONTROL' id='140225885535488'>), 'zoom'), (('crop', <MagicMock name='mock.WXK_ALT' id='140225884645264'>), 'pan'), (('crop', (<MagicMock name='mock.WXK_CONTROL' id='140225885535488'>, <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>)), 'slice')]), <class 'fsleyes.profiles.lightboxviewprofile.LightBoxViewProfile'>: OrderedDict([(('view', <MagicMock name='mock.WXK_CONTROL' id='140225885535488'>), 'zoom')]), <class 'fsleyes.profiles.timeseriesprofile.TimeSeriesProfile'>: OrderedDict([(('panzoom', <MagicMock name='mock.WXK_CONTROL' id='140225885535488'>), 'volume')]), <class 'fsleyes.profiles.histogramprofile.HistogramProfile'>: OrderedDict([(('panzoom', <MagicMock name='mock.WXK_CONTROL' id='140225885535488'>), 'overlayRange')]), <class 'fsleyes.profiles.scene3dviewprofile.Scene3DViewProfile'>: OrderedDict([(('rotate', <MagicMock name='mock.WXK_CONTROL' id='140225885535488'>), 'zoom'), (('rotate', <MagicMock name='mock.WXK_ALT' id='140225884645264'>), 'pan'), (('rotate', <MagicMock name='mock.WXK_SHIFT' id='140225884652784'>), 'pick')])}

The tempModeMap dictionary defines temporary modes, for each Profile sub-class which, when in a given mode, can be accessed with a keyboard modifer (e.g. Control, Shift, etc). For example, a temporary mode map of:

('view', wx.WXK_SHIFT) : 'zoom'

states that when the Profile is in 'view' mode, and the shift key is held down, the Profile should temporarily switch to 'zoom' mode.

fsleyes.profiles.profilemap.altHandlerMap = {<class 'fsleyes.profiles.orthoviewprofile.OrthoViewProfile'>: OrderedDict([(('nav', 'LeftMouseDown'), ('nav', 'LeftMouseDrag')), (('nav', 'MiddleMouseDrag'), ('pan', 'LeftMouseDrag')), (('nav', 'RightMouseDown'), ('zoom', 'RightMouseDown')), (('nav', 'RightMouseDrag'), ('zoom', 'RightMouseDrag')), (('nav', 'RightMouseUp'), ('zoom', 'RightMouseUp')), (('slice', 'LeftMouseDown'), ('pick', 'LeftMouseDown')), (('slice', 'LeftMouseDrag'), ('pick', 'LeftMouseDrag')), (('slice', 'MiddleMouseDrag'), ('pan', 'LeftMouseDrag')), (('slice', 'RightMouseDown'), ('zoom', 'RightMouseDown')), (('slice', 'RightMouseDrag'), ('zoom', 'RightMouseDrag')), (('slice', 'RightMouseUp'), ('zoom', 'RightMouseUp')), (('zoom', 'RightMouseDown'), ('zoom', 'RightMouseDrag')), (('zoom', 'LeftMouseDown'), ('nav', 'LeftMouseDown')), (('zoom', 'LeftMouseDrag'), ('nav', 'LeftMouseDrag')), (('zoom', 'MiddleMouseDrag'), ('pan', 'LeftMouseDrag')), (('pick', 'LeftMouseDown'), ('pick', 'LeftMouseDrag'))]), <class 'fsleyes.profiles.orthoeditprofile.OrthoEditProfile'>: OrderedDict([(('sel', 'Char'), ('nav', 'Char')), (('desel', 'Char'), ('nav', 'Char')), (('selint', 'Char'), ('nav', 'Char')), (('fill', 'Char'), ('nav', 'Char')), (('sel', 'RightMouseDown'), ('desel', 'LeftMouseDown')), (('sel', 'RightMouseDrag'), ('desel', 'LeftMouseDrag')), (('sel', 'RightMouseUp'), ('desel', 'LeftMouseUp')), (('desel', 'RightMouseDown'), ('sel', 'LeftMouseDown')), (('desel', 'RightMouseDrag'), ('sel', 'LeftMouseDrag')), (('desel', 'RightMouseUp'), ('sel', 'LeftMouseUp')), (('fill', 'RightMouseDown'), ('desel', 'LeftMouseDown')), (('fill', 'RightMouseDrag'), ('desel', 'LeftMouseDrag')), (('fill', 'RightMouseUp'), ('desel', 'LeftMouseUp')), (('selint', 'RightMouseDown'), ('desel', 'LeftMouseDown')), (('selint', 'RightMouseDrag'), ('desel', 'LeftMouseDrag')), (('selint', 'RightMouseUp'), ('desel', 'LeftMouseUp')), (('desel', 'MouseMove'), ('sel', 'MouseMove')), (('sel', 'MiddleMouseDrag'), ('pan', 'LeftMouseDrag')), (('desel', 'MiddleMouseDrag'), ('pan', 'LeftMouseDrag')), (('selint', 'MiddleMouseDrag'), ('pan', 'LeftMouseDrag'))]), <class 'fsleyes.profiles.orthocropprofile.OrthoCropProfile'>: OrderedDict([(('crop', 'MiddleMouseDrag'), ('pan', 'LeftMouseDrag'))]), <class 'fsleyes.profiles.lightboxviewprofile.LightBoxViewProfile'>: OrderedDict([(('view', 'LeftMouseDown'), ('view', 'LeftMouseDrag'))]), <class 'fsleyes.profiles.scene3dviewprofile.Scene3DViewProfile'>: OrderedDict([(('rotate', 'MiddleMouseDown'), ('pan', 'LeftMouseDown')), (('rotate', 'MiddleMouseDrag'), ('pan', 'LeftMouseDrag')), (('rotate', 'MiddleMouseUp'), ('pan', 'LeftMouseUp'))])}

The altHandlerMap dictionary defines alternate handlers for a given mode and event type. Entries in this dictionary allow a Profile sub-class to define a handler for a single mode and event type, but to re-use that handler for other modes and event types. For example, the following alternate handler mapping:

('zoom', 'MiddleMouseDrag'), ('pan',  'LeftMouseDrag'))

states that when the Profile is in 'zoom' mode, and a MiddleMouseDrag event occurs, the LeftMouseDrag handler for the 'pan' mode should be called.

Note

Event bindings defined in the altHandlerMap take precdence over the event bindings defined in the Profile sub-class. So you can use the altHandlerMap to override the default behaviour of a Profile.

fsleyes.profiles.profilemap.fallbackHandlerMap = {<class 'fsleyes.profiles.orthoviewprofile.OrthoViewProfile'>: {('pick', 'LeftMouseDown'): ('nav', 'LeftMouseDown'), ('pick', 'LeftMouseDrag'): ('nav', 'LeftMouseDrag')}}

The fallbackHandlerMap dictionary defines handlers for a given mode and event type which will be called if the handler for that mode/event type returns a value of False, indicating that it has not been handled.