added setPredefinedGradient function to ImageView, and added documentation to GradientEditorItem.loadPreset

This commit is contained in:
Megan Kratz 2016-02-15 17:17:09 -05:00
parent 229fc6aec9
commit 74fad9e29a
2 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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 <pyqtgraph.graphicsItems.GradientEditorItem>`
Currently defined gradients are: 'thermal', 'flame', 'yellowy', 'bipolar',
'spectrum', 'cyclic', 'greyclip', and 'grey'.
"""
self.ui.histogram.gradient.loadPreset(name)