From 74fad9e29aa6a2e248290650f6ca953afdc87b2a Mon Sep 17 00:00:00 2001 From: Megan Kratz Date: Mon, 15 Feb 2016 17:17:09 -0500 Subject: [PATCH] added setPredefinedGradient function to ImageView, and added documentation to GradientEditorItem.loadPreset --- pyqtgraph/graphicsItems/GradientEditorItem.py | 3 ++- pyqtgraph/imageview/ImageView.py | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pyqtgraph/graphicsItems/GradientEditorItem.py b/pyqtgraph/graphicsItems/GradientEditorItem.py index 5a7ca211..d57576c8 100644 --- a/pyqtgraph/graphicsItems/GradientEditorItem.py +++ b/pyqtgraph/graphicsItems/GradientEditorItem.py @@ -473,7 +473,8 @@ class GradientEditorItem(TickSliderItem): def loadPreset(self, name): """ - Load a predefined gradient. + Load a predefined gradient. Currently defined gradients are: 'thermal', + 'flame', 'yellowy', 'bipolar', 'spectrum', 'cyclic', 'greyclip', and 'grey'. """ ## TODO: provide image with names of defined gradients #global Gradients diff --git a/pyqtgraph/imageview/ImageView.py b/pyqtgraph/imageview/ImageView.py index 466b4bcf..6832f316 100644 --- a/pyqtgraph/imageview/ImageView.py +++ b/pyqtgraph/imageview/ImageView.py @@ -721,4 +721,10 @@ class ImageView(QtGui.QWidget): def setColorMap(self, colormap): """Set the color map. *colormap* is an instance of ColorMap()""" self.ui.histogram.gradient.setColorMap(colormap) - + + def setPredefinedGradient(self, name): + """Set one of the gradients defined in :class:`GradientEditorItem ` + Currently defined gradients are: 'thermal', 'flame', 'yellowy', 'bipolar', + 'spectrum', 'cyclic', 'greyclip', and 'grey'. + """ + self.ui.histogram.gradient.loadPreset(name)