Skip to content

Commit

Permalink
Merge pull request #1046 from vasole/histogram
Browse files Browse the repository at this point in the history
[GUI] Add silx histogram action
  • Loading branch information
vasole authored Nov 2, 2023
2 parents 1852f8b + 7f3b14c commit 0974e47
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion PyMca5/PyMcaGui/io/hdf5/Hdf5NodeView.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,17 @@ def __init__(self, parent=None):
method="getPlugin2DInstance",
directoryList=PLUGINS_DIR)
self._toolbar.addWidget(pluginsToolButton)
if hasattr(self, "getIntensityHistogramAction"):
self.getIntensityHistogramAction().setVisible(True)
else:
print("Plot2D getIntensityHistogramAction missing")


class Plot2DViewWithPlugins(DataViews._Plot2dView):
def createWidget(self, parent):
widget = Plot2DWithPlugins(parent=parent)
widget.setDefaultColormap(self.defaultColormap())
widget.getColormapAction().setColorDialog(self.defaultColorDialog())
widget.getIntensityHistogramAction().setVisible(True)
widget.setKeepDataAspectRatio(False)
widget.getXAxis().setLabel('X')
widget.getYAxis().setLabel('Y')
Expand Down
9 changes: 7 additions & 2 deletions PyMca5/PyMcaGui/plotting/SilxMaskImageWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,11 @@ def __init__(self, parent=None):
PlotActions.ColormapAction(plot=self.plot, parent=self))
self.addAction(self.colormapAction)

self.pixelIntensitiesHistoAction = self.group.addAction(
PlotActions.PixelIntensitiesHistoAction(plot=self.plot, parent=self))
self.addAction(self.pixelIntensitiesHistoAction)
self.pixelIntensitiesHistoAction.setVisible(True)

self.copyAction = self.group.addAction(
PlotActions.CopyAction(plot=self.plot, parent=self))
self.addAction(self.copyAction)
Expand Down Expand Up @@ -675,8 +680,8 @@ def _createToolBar(self, title, parent):
index = objects.index(self.colormapAction)
objects.insert(index + 1, self.keepDataAspectRatioButton)
objects.insert(index + 2, self.yAxisInvertedButton)
objects.insert(index + 3, self.saveToolbutton)
objects.insert(index + 4, self.backgroundButton)
objects.insert(index + 4, self.saveToolbutton)
objects.insert(index + 5, self.backgroundButton)
for obj in objects:
if isinstance(obj, qt.QAction):
toolbar.addAction(obj)
Expand Down
2 changes: 1 addition & 1 deletion PyMca5/PyMcaGui/pymca/PyMcaImageWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _addImageClicked(self):
self._connectCorrelator()
if self._imageData is None:
return
if self._imageData == []:
if len(self._imageData) == 0:
return

if not RGBImageCalculator.RGBImageCalculator._addImageClicked(self):
Expand Down
2 changes: 1 addition & 1 deletion PyMca5/PyMcaGui/pymca/RGBImageCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def _addImageClicked(self):
_logger.debug("Add image clicked")
if self._imageData is None:
return
if self._imageData == []:
if len(self._imageData) == 0:
return
text = "%s" % self.name.text()
if not len(text):
Expand Down

0 comments on commit 0974e47

Please sign in to comment.