some documentation improvements
This commit is contained in:
parent
240cdb1a41
commit
0e679edcf3
@ -25,8 +25,7 @@ Gradients = OrderedDict([
|
||||
])
|
||||
|
||||
def addGradientListToDocstring():
|
||||
### create a decorator so that we can add construct a list of the gradients defined above in a docstring
|
||||
### Adds the list of gradients to the end of the functions docstring
|
||||
"""Decorator to add list of current pre-defined gradients to the end of a function docstring."""
|
||||
def dec(fn):
|
||||
fn.__doc__ = fn.__doc__ + str(Gradients.keys()).strip('[').strip(']')
|
||||
return fn
|
||||
@ -482,7 +481,6 @@ class GradientEditorItem(TickSliderItem):
|
||||
def loadPreset(self, name):
|
||||
"""
|
||||
Load a predefined gradient. Currently defined gradients are:
|
||||
|
||||
"""## TODO: provide image with names of defined gradients
|
||||
|
||||
#global Gradients
|
||||
|
@ -26,6 +26,7 @@ from ..graphicsItems.ROI import *
|
||||
from ..graphicsItems.LinearRegionItem import *
|
||||
from ..graphicsItems.InfiniteLine import *
|
||||
from ..graphicsItems.ViewBox import *
|
||||
from ..graphicsItems.GradientEditorItem import addGradientListToDocstring
|
||||
from .. import ptime as ptime
|
||||
from .. import debug as debug
|
||||
from ..SignalProxy import SignalProxy
|
||||
@ -719,12 +720,19 @@ class ImageView(QtGui.QWidget):
|
||||
self.menu.popup(QtGui.QCursor.pos())
|
||||
|
||||
def setColorMap(self, colormap):
|
||||
"""Set the color map. *colormap* is an instance of ColorMap()"""
|
||||
"""Set the color map.
|
||||
|
||||
============= =========================================================
|
||||
**Arguments**
|
||||
colormap (A ColorMap() instance) The ColorMap to use for coloring
|
||||
images.
|
||||
============= =========================================================
|
||||
"""
|
||||
self.ui.histogram.gradient.setColorMap(colormap)
|
||||
|
||||
@addGradientListToDocstring()
|
||||
def setPredefinedGradient(self, name):
|
||||
"""Set one of the gradients defined in :class:`GradientEditorItem <pyqtgraph.graphicsItems.GradientEditorItem>`.
|
||||
For list of available gradients see :func:`GradientEditorItem.loadPreset() <pyqtgraph.graphicsItems.GradientEditorItem.loadPreset>`.
|
||||
|
||||
Currently available gradients are:
|
||||
"""
|
||||
self.ui.histogram.gradient.loadPreset(name)
|
||||
|
Loading…
Reference in New Issue
Block a user