Minor documentation fixes

This commit is contained in:
Luke Campagnola 2012-08-23 11:17:40 -04:00
parent 4c3dfa8c97
commit c71ee6ed6f
7 changed files with 35 additions and 25 deletions

View File

@ -21,6 +21,7 @@ Contents:
scatterplotitem
isocurveitem
axisitem
textitem
arrowitem
curvepoint
curvearrow

View File

@ -1,5 +1,3 @@
.. _api_widgets:
ParameterTree API Reference
===========================

View File

@ -75,7 +75,7 @@ class GraphicsLayout(GraphicsWidget):
All extra keyword arguments are passed to :func:`LabelItem.__init__ <pyqtgraph.LabelItem.__init__>`
Returns the created item.
To create a vertical label, use *angle*=-90
To create a vertical label, use *angle* = -90.
"""
text = LabelItem(text, **kargs)
self.addItem(text, row, col, rowspan, colspan)

View File

@ -9,16 +9,18 @@ class TextItem(UIGraphicsItem):
"""
def __init__(self, text='', color=(200,200,200), html=None, anchor=(0,0), border=None, fill=None):
"""
=========== =================================================================================
Arguments:
*text* The text to display
*color* The color of the text (any format accepted by pg.mkColor)
*html* If specified, this overrides both *text* and *color*
*anchor* A QPointF or (x,y) sequence indicating what region of the text box will
be anchored to the item's position. A value of (0,0) sets the upper-left corner
of the text box to be at the position specified by setPos(), while a value of (1,1)
sets the lower-right corner.
*border* A pen to use when drawing the border
*fill* A brush to use when filling within the border
*text* The text to display
*color* The color of the text (any format accepted by pg.mkColor)
*html* If specified, this overrides both *text* and *color*
*anchor* A QPointF or (x,y) sequence indicating what region of the text box will
be anchored to the item's position. A value of (0,0) sets the upper-left corner
of the text box to be at the position specified by setPos(), while a value of (1,1)
sets the lower-right corner.
*border* A pen to use when drawing the border
*fill* A brush to use when filling within the border
=========== =================================================================================
"""
UIGraphicsItem.__init__(self)
self.textItem = QtGui.QGraphicsTextItem()

View File

@ -358,9 +358,10 @@ class Parameter(QtCore.QObject):
return self.insertChild(len(self.childs), child)
def insertChild(self, pos, child):
"""Insert a new child at pos.
"""
Insert a new child at pos.
If pos is a Parameter, then insert at the position of that Parameter.
If child is a dict, then a parameter is constructed as Parameter(**child)
If child is a dict, then a parameter is constructed as Parameter(\*\*child)
"""
if isinstance(child, dict):
child = Parameter.create(**child)

View File

@ -5,10 +5,12 @@ class ParameterItem(QtGui.QTreeWidgetItem):
"""
Abstract ParameterTree item.
Used to represent the state of a Parameter from within a ParameterTree.
- Sets first column of item to name
- generates context menu if item is renamable or removable
- handles child added / removed events
- provides virtual functions for handling changes from parameter
- Sets first column of item to name
- generates context menu if item is renamable or removable
- handles child added / removed events
- provides virtual functions for handling changes from parameter
For more ParameterItem types, see ParameterTree.parameterTypes module.
"""

View File

@ -10,10 +10,12 @@ import os, collections
class WidgetParameterItem(ParameterItem):
"""
ParameterTree item with:
- label in second column for displaying value
- simple widget for editing value (displayed instead of label when item is selected)
- button that resets value to default
- provides SpinBox, CheckBox, LineEdit, and ColorButton types
- label in second column for displaying value
- simple widget for editing value (displayed instead of label when item is selected)
- button that resets value to default
- provides SpinBox, CheckBox, LineEdit, and ColorButton types
This class can be subclassed by overriding makeWidget() to provide a custom widget.
"""
def __init__(self, param, depth):
@ -64,9 +66,13 @@ class WidgetParameterItem(ParameterItem):
"""
Return a single widget that should be placed in the second tree column.
The widget must be given three attributes:
sigChanged -- a signal that is emitted when the widget's value is changed
value -- a function that returns the value
setValue -- a function that sets the value
========== ============================================================
sigChanged a signal that is emitted when the widget's value is changed
value a function that returns the value
setValue a function that sets the value
========== ============================================================
This is a good function to override in subclasses.
"""
opts = self.param.opts