diff --git a/fsl/fsleyes/views/canvaspanel.py b/fsl/fsleyes/views/canvaspanel.py index f6b0a1b96e8419b6145fe94f6028c26ebbc039a3..caeb48767be5107cbc339c18b080ad10dc859901 100644 --- a/fsl/fsleyes/views/canvaspanel.py +++ b/fsl/fsleyes/views/canvaspanel.py @@ -317,9 +317,7 @@ class CanvasPanel(viewpanel.ViewPanel): """Toggles an :class:`.OverlayListPanel`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel(overlaylistpanel.OverlayListPanel, - location=wx.BOTTOM, - action=self.toggleOverlayList) + self.togglePanel(overlaylistpanel.OverlayListPanel, location=wx.BOTTOM) @actions.toggleControlAction(overlayinfopanel.OverlayInfoPanel) @@ -327,9 +325,7 @@ class CanvasPanel(viewpanel.ViewPanel): """Toggles an :class:`.OverlayInfoPanel`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel(overlayinfopanel.OverlayInfoPanel, - location=wx.LEFT, - action=self.toggleOverlayInfo) + self.togglePanel(overlayinfopanel.OverlayInfoPanel, location=wx.LEFT) @actions.toggleControlAction(atlaspanel.AtlasPanel) @@ -337,9 +333,7 @@ class CanvasPanel(viewpanel.ViewPanel): """Toggles an :class:`.AtlasPanel`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel(atlaspanel.AtlasPanel, - location=wx.BOTTOM, - action=self.toggleAtlasPanel) + self.togglePanel(atlaspanel.AtlasPanel, location=wx.BOTTOM) @actions.toggleControlAction(overlaydisplaytoolbar.OverlayDisplayToolBar) @@ -348,8 +342,7 @@ class CanvasPanel(viewpanel.ViewPanel): :meth:`.ViewPanel.togglePanel`. """ self.togglePanel(overlaydisplaytoolbar.OverlayDisplayToolBar, - viewPanel=self, - action=self.toggleDisplayToolBar) + viewPanel=self) @actions.toggleControlAction(overlaydisplaypanel.OverlayDisplayPanel) @@ -359,8 +352,7 @@ class CanvasPanel(viewpanel.ViewPanel): """ self.togglePanel(overlaydisplaypanel.OverlayDisplayPanel, floatPane=floatPane, - location=wx.LEFT, - action=self.toggleDisplayToolBar) + location=wx.LEFT) @actions.toggleControlAction(canvassettingspanel.CanvasSettingsPanel) @@ -371,8 +363,7 @@ class CanvasPanel(viewpanel.ViewPanel): self.togglePanel(canvassettingspanel.CanvasSettingsPanel, canvasPanel=self, floatPane=floatPane, - location=wx.LEFT, - action=self.toggleDisplayToolBar) + location=wx.LEFT) @actions.toggleControlAction(locationpanel.LocationPanel) @@ -380,9 +371,7 @@ class CanvasPanel(viewpanel.ViewPanel): """Toggles a :class:`.LocationPanel`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel(locationpanel.LocationPanel, - location=wx.BOTTOM, - action=self.toggleLocationPanel) + self.togglePanel(locationpanel.LocationPanel, location=wx.BOTTOM) @actions.toggleControlAction(clusterpanel.ClusterPanel) @@ -390,9 +379,7 @@ class CanvasPanel(viewpanel.ViewPanel): """Toggles a :class:`.ClusterPanel`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel(clusterpanel.ClusterPanel, - location=wx.TOP, - action=self.toggleClusterPanel) + self.togglePanel(clusterpanel.ClusterPanel, location=wx.TOP) @actions.toggleControlAction(lookuptablepanel.LookupTablePanel) @@ -400,9 +387,7 @@ class CanvasPanel(viewpanel.ViewPanel): """Toggles a :class:`.LookupTablePanel`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel(lookuptablepanel.LookupTablePanel, - location=wx.TOP, - action=self.toggleLookupTablePanel) + self.togglePanel(lookuptablepanel.LookupTablePanel, location=wx.TOP) @actions.toggleControlAction(melclasspanel.MelodicClassificationPanel) def toggleClassificationPanel(self): @@ -410,8 +395,7 @@ class CanvasPanel(viewpanel.ViewPanel): :meth:`.ViewPanel.togglePanel`. """ self.togglePanel(melclasspanel.MelodicClassificationPanel, - location=wx.RIGHT, - action=self.toggleClassificationPanel) + location=wx.RIGHT) @actions.toggleControlAction(shellpanel.ShellPanel) @@ -419,10 +403,7 @@ class CanvasPanel(viewpanel.ViewPanel): """Toggles a :class:`.ShellPanel`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel(shellpanel.ShellPanel, - self, - location=wx.BOTTOM, - action=self.toggleShell) + self.togglePanel(shellpanel.ShellPanel, self, location=wx.BOTTOM) def getSceneOptions(self): diff --git a/fsl/fsleyes/views/histogrampanel.py b/fsl/fsleyes/views/histogrampanel.py index 03d9479b9c1713d5c09c1fd26ffaa30a593a9cdd..b33a1db5da6060a48366233a18d509da45f76005 100644 --- a/fsl/fsleyes/views/histogrampanel.py +++ b/fsl/fsleyes/views/histogrampanel.py @@ -105,10 +105,7 @@ class HistogramPanel(plotpanel.OverlayPlotPanel): """Shows/hides a :class:`.PlotListPanel`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel(plotlistpanel.PlotListPanel, - self, - location=wx.TOP, - action=self.toggleHistogramList) + self.togglePanel(plotlistpanel.PlotListPanel, self, location=wx.TOP) @actions.toggleControlAction(histogramcontrolpanel.HistogramControlPanel) @@ -117,10 +114,7 @@ class HistogramPanel(plotpanel.OverlayPlotPanel): :meth:`.ViewPanel.togglePanel`. """ self.togglePanel( - histogramcontrolpanel.HistogramControlPanel, - self, - location=wx.TOP, - action=self.toggleHistogramControl) + histogramcontrolpanel.HistogramControlPanel, self, location=wx.TOP) def getActions(self): diff --git a/fsl/fsleyes/views/lightboxpanel.py b/fsl/fsleyes/views/lightboxpanel.py index b6042148e3f6b39a6946baeb0d0bc38a837e3f0c..9ab54b1b6c75ecb5cc487ddf120574728d8870aa 100644 --- a/fsl/fsleyes/views/lightboxpanel.py +++ b/fsl/fsleyes/views/lightboxpanel.py @@ -172,9 +172,7 @@ class LightBoxPanel(canvaspanel.CanvasPanel): """Shows/hides a :class:`.LightBoxToolBar`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel(lightboxtoolbar.LightBoxToolBar, - lb=self, - action=self.toggleLightBoxToolBar) + self.togglePanel(lightboxtoolbar.LightBoxToolBar, lb=self) def getActions(self): diff --git a/fsl/fsleyes/views/orthopanel.py b/fsl/fsleyes/views/orthopanel.py index bfa1234cf9322122a4bdceb888706947dc9efea9..11c5255cd030e4be66d8ffe42cb9ca129edcee5d 100644 --- a/fsl/fsleyes/views/orthopanel.py +++ b/fsl/fsleyes/views/orthopanel.py @@ -254,9 +254,7 @@ class OrthoPanel(canvaspanel.CanvasPanel): """Shows/hides an :class:`.OrthoToolBar`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel(orthotoolbar.OrthoToolBar, - ortho=self, - action=self.toggleOrthoToolBar) + self.togglePanel(orthotoolbar.OrthoToolBar, ortho=self) @actions.toggleControlAction(orthoedittoolbar.OrthoEditToolBar) @@ -264,9 +262,7 @@ class OrthoPanel(canvaspanel.CanvasPanel): """Shows/hides an :class:`.OrthoEditToolBar`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel(orthoedittoolbar.OrthoEditToolBar, - ortho=self, - action=self.toggleEditToolBar) + self.togglePanel(orthoedittoolbar.OrthoEditToolBar, ortho=self) def getActions(self): diff --git a/fsl/fsleyes/views/powerspectrumpanel.py b/fsl/fsleyes/views/powerspectrumpanel.py index b5e0460237eeb36ebdc5916cf0587f2d4892bcf4..7b0fc151199897ece4863ecfe86d14730399ab7a 100644 --- a/fsl/fsleyes/views/powerspectrumpanel.py +++ b/fsl/fsleyes/views/powerspectrumpanel.py @@ -114,11 +114,9 @@ class PowerSpectrumPanel(plotpanel.OverlayPlotPanel): """Shows/hides a :class:`.PowerSpectrumControlPanel`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel( - pscontrol.PowerSpectrumControlPanel, - self, - location=wx.TOP, - action=self.togglePowerSpectrumControl) + self.togglePanel(pscontrol.PowerSpectrumControlPanel, + self, + location=wx.TOP) @actions.toggleControlAction(plotlistpanel.PlotListPanel) @@ -128,8 +126,7 @@ class PowerSpectrumPanel(plotpanel.OverlayPlotPanel): """ self.togglePanel(plotlistpanel.PlotListPanel, self, - location=wx.TOP, - action=self.togglePowerSpectrumList) + location=wx.TOP) def getActions(self): diff --git a/fsl/fsleyes/views/timeseriespanel.py b/fsl/fsleyes/views/timeseriespanel.py index e60da78e95b0bb15d52a770aa49ac84a5ca11a81..616cbc4b1168f4460b0f2f48114e6a33989c262f 100644 --- a/fsl/fsleyes/views/timeseriespanel.py +++ b/fsl/fsleyes/views/timeseriespanel.py @@ -161,10 +161,7 @@ class TimeSeriesPanel(plotpanel.OverlayPlotPanel): """Shows/hides a :class:`.PlotListPanel`. See :meth:`.ViewPanel.togglePanel`. """ - self.togglePanel(plotlistpanel.PlotListPanel, - self, - location=wx.TOP, - action=self.toggleTimeSeriesList) + self.togglePanel(plotlistpanel.PlotListPanel, self, location=wx.TOP) @actions.toggleControlAction(timeseriescontrolpanel.TimeSeriesControlPanel) @@ -174,8 +171,7 @@ class TimeSeriesPanel(plotpanel.OverlayPlotPanel): """ self.togglePanel(timeseriescontrolpanel.TimeSeriesControlPanel, self, - location=wx.TOP, - action=self.toggleTimeSeriesControl) + location=wx.TOP) def getActions(self): diff --git a/fsl/fsleyes/views/viewpanel.py b/fsl/fsleyes/views/viewpanel.py index 4737220a5484d832060e3a620d0c8b7b24ecc225..fb514c61192477871348a5c2a5e8b93e4ae7222a 100644 --- a/fsl/fsleyes/views/viewpanel.py +++ b/fsl/fsleyes/views/viewpanel.py @@ -17,7 +17,6 @@ import wx.lib.agw.aui as aui import props import fsl.fsleyes.panel as fslpanel -import fsl.fsleyes.actions as actions import fsl.fsleyes.toolbar as fsltoolbar import fsl.fsleyes.profiles as profiles import fsl.fsleyes.displaycontext as fsldisplay @@ -109,14 +108,8 @@ class ViewPanel(fslpanel.FSLEyesPanel): # of {type : instance} mappings of active # FSLeyes control panels that are contained # in this view panel. - # - # The panelActions dict contains a collection - # of {type : Action} mappings, but only if the - # control panel was opened as a result of an - # Action on this view panel. - self.__centrePanel = None - self.__panels = {} - self.__panelActions = {} + self.__centrePanel = None + self.__panels = {} self.__auiMgr = aui.AuiManager( self, @@ -240,14 +233,6 @@ class ViewPanel(fslpanel.FSLEyesPanel): :arg location: If ``floatPane=False``, the initial dock position of the panel - either ``wx.TOP``, ``wx.BOTTOM``, ``wx.LEFT``, or ``wx.RIGHT. Defaults to ``wx.BOTTOM``. - - :arg action: If this method has been called as the result of - execution of a :class:`.ToggleAction`, the - ``ToggleAction`` instance may be passed to this - method. This is so that, if the control panel is - closed directly by the user (as opposed to - re-executing the ``ToggleAction`), the ``toggled`` - state of the action can be updated. :arg kwargs: All keyword arguments, apart from ``floatPane`` and ``location``, are passed to the ``panelType`` @@ -265,14 +250,13 @@ class ViewPanel(fslpanel.FSLEyesPanel): .. warning:: Do not define a control (a.k.a. secondary) panel constructor to accept arguments with the names - ``floatPane``, ``action`` or ``location``, as - arguments with those names will get eaten by this - method before they can be passed to the constructor. + ``floatPane`` or ``location``, as arguments with those + names will get eaten by this method before they can be + passed to the constructor. """ location = kwargs.pop('location', wx.BOTTOM) floatPane = kwargs.pop('floatPane', False) - action = kwargs.pop('action', None) if location not in (wx.TOP, wx.BOTTOM, wx.LEFT, wx.RIGHT): raise ValueError('Invalid value for location') @@ -358,8 +342,7 @@ class ViewPanel(fslpanel.FSLEyesPanel): .FloatingPosition(panePos) self.__auiMgr.AddPane(window, paneInfo) - self.__panels[ panelType] = window - self.__panelActions[panelType] = action + self.__panels[panelType] = window self.__auiMgrUpdate() @@ -574,19 +557,12 @@ class ViewPanel(fslpanel.FSLEyesPanel): if isinstance(panel, (fslpanel .FSLEyesPanel, fsltoolbar.FSLEyesToolBar)): - self .__panels .pop(type(panel)) - action = self.__panelActions.pop(type(panel), None) + self.__panels.pop(type(panel)) # calling fslpanel.FSLEyesPanel.destroy() # here - wx.Destroy is done below panel.destroy() - # If this panel was opened through - # a ToggleAction, make sure that - # its toggled state is correct - if action is not None and isinstance(action, actions.ToggleAction): - action.toggled = False - # Even when the user closes a pane, # AUI does not detach said pane - # we have to do it manually