Skip to content

Commit

Permalink
add aggregation action in _Plot2dView
Browse files Browse the repository at this point in the history
  • Loading branch information
Edgar Gutierrez Fernandez committed Sep 25, 2024
1 parent 8725dcc commit df68c57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
17 changes: 13 additions & 4 deletions src/silx/gui/data/DataViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from silx.gui.colors import Colormap
from silx.gui.dialog.ColormapDialog import ColormapDialog
from silx.gui.plot.actions.image import ImageDataAggregated
from silx.gui.plot.actions.image import AggregationModeAction
from silx._utils import NP_OPTIONAL_COPY

__authors__ = ["V. Valls", "P. Knobel"]
Expand Down Expand Up @@ -1068,16 +1069,24 @@ def createWidget(self, parent):
widget.setDefaultColormap(self.defaultColormap())
widget.getColormapAction().setColormapDialog(self.defaultColorDialog())
widget.getIntensityHistogramAction().setVisible(True)
widget.getAggregationModeAction().setVisible(True)
widget.getAggregationModeAction().sigAggregationModeChanged.connect(
self._aggregationModeChanged
)

self.__aggregationModeAction = AggregationModeAction(parent=widget)
widget.toolBar().addAction(self.__aggregationModeAction)
self.__aggregationModeAction.setVisible(True)

widget.setKeepDataAspectRatio(True)
widget.getXAxis().setLabel("X")
widget.getYAxis().setLabel("Y")
maskToolsWidget = widget.getMaskToolsDockWidget().widget()
maskToolsWidget.setItemMaskUpdated(True)
return widget

def getAggregationModeAction(self):
"""Action toggling the aggregation mode action
:rtype: actions.PlotAction
"""
return self.__aggregationModeAction

def _aggregationModeChanged(self):
plot = self.getWidget()
Expand Down
12 changes: 0 additions & 12 deletions src/silx/gui/plot/PlotWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,6 @@ def __init__(
)
self._intensityHistoAction.setVisible(False)

self.__aggregationModeAction = self.group.addAction(
actions.image.AggregationModeAction(parent=self)
)
self.__aggregationModeAction.setVisible(False)

self._medianFilter2DAction = self.group.addAction(
actions_medfilt.MedianFilter2DAction(self, parent=self)
)
Expand Down Expand Up @@ -814,13 +809,6 @@ def getIntensityHistogramAction(self):
:rtype: actions.PlotAction
"""
return self._intensityHistoAction

def getAggregationModeAction(self):
"""Action toggling the aggregation mode action
:rtype: actions.PlotAction
"""
return self.__aggregationModeAction

def getCopyAction(self):
"""Action to copy plot snapshot to clipboard
Expand Down

0 comments on commit df68c57

Please sign in to comment.