From 0e679edcf3f16958d2e95763983557e67befcf14 Mon Sep 17 00:00:00 2001 From: Megan Kratz Date: Fri, 25 Mar 2016 12:36:49 -0400 Subject: [PATCH] some documentation improvements --- pyqtgraph/graphicsItems/GradientEditorItem.py | 4 +--- pyqtgraph/imageview/ImageView.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pyqtgraph/graphicsItems/GradientEditorItem.py b/pyqtgraph/graphicsItems/GradientEditorItem.py index b1824174..6ce06b61 100644 --- a/pyqtgraph/graphicsItems/GradientEditorItem.py +++ b/pyqtgraph/graphicsItems/GradientEditorItem.py @@ -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 diff --git a/pyqtgraph/imageview/ImageView.py b/pyqtgraph/imageview/ImageView.py index 59d1863d..27e64c4c 100644 --- a/pyqtgraph/imageview/ImageView.py +++ b/pyqtgraph/imageview/ImageView.py @@ -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 `. - For list of available gradients see :func:`GradientEditorItem.loadPreset() `. - + Currently available gradients are: """ self.ui.histogram.gradient.loadPreset(name)