Commit c71ee6ed authored by Luke Campagnola's avatar Luke Campagnola
Browse files

Minor documentation fixes

parent 4c3dfa8c
...@@ -21,6 +21,7 @@ Contents: ...@@ -21,6 +21,7 @@ Contents:
scatterplotitem scatterplotitem
isocurveitem isocurveitem
axisitem axisitem
textitem
arrowitem arrowitem
curvepoint curvepoint
curvearrow curvearrow
......
.. _api_widgets:
ParameterTree API Reference ParameterTree API Reference
=========================== ===========================
......
...@@ -75,7 +75,7 @@ class GraphicsLayout(GraphicsWidget): ...@@ -75,7 +75,7 @@ class GraphicsLayout(GraphicsWidget):
All extra keyword arguments are passed to :func:`LabelItem.__init__ <pyqtgraph.LabelItem.__init__>` All extra keyword arguments are passed to :func:`LabelItem.__init__ <pyqtgraph.LabelItem.__init__>`
Returns the created item. Returns the created item.
To create a vertical label, use *angle*=-90 To create a vertical label, use *angle* = -90.
""" """
text = LabelItem(text, **kargs) text = LabelItem(text, **kargs)
self.addItem(text, row, col, rowspan, colspan) self.addItem(text, row, col, rowspan, colspan)
......
...@@ -9,6 +9,7 @@ class TextItem(UIGraphicsItem): ...@@ -9,6 +9,7 @@ class TextItem(UIGraphicsItem):
""" """
def __init__(self, text='', color=(200,200,200), html=None, anchor=(0,0), border=None, fill=None): def __init__(self, text='', color=(200,200,200), html=None, anchor=(0,0), border=None, fill=None):
""" """
=========== =================================================================================
Arguments: Arguments:
*text* The text to display *text* The text to display
*color* The color of the text (any format accepted by pg.mkColor) *color* The color of the text (any format accepted by pg.mkColor)
...@@ -19,6 +20,7 @@ class TextItem(UIGraphicsItem): ...@@ -19,6 +20,7 @@ class TextItem(UIGraphicsItem):
sets the lower-right corner. sets the lower-right corner.
*border* A pen to use when drawing the border *border* A pen to use when drawing the border
*fill* A brush to use when filling within the border *fill* A brush to use when filling within the border
=========== =================================================================================
""" """
UIGraphicsItem.__init__(self) UIGraphicsItem.__init__(self)
self.textItem = QtGui.QGraphicsTextItem() self.textItem = QtGui.QGraphicsTextItem()
......
...@@ -358,9 +358,10 @@ class Parameter(QtCore.QObject): ...@@ -358,9 +358,10 @@ class Parameter(QtCore.QObject):
return self.insertChild(len(self.childs), child) return self.insertChild(len(self.childs), child)
def insertChild(self, pos, 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 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): if isinstance(child, dict):
child = Parameter.create(**child) child = Parameter.create(**child)
......
...@@ -5,10 +5,12 @@ class ParameterItem(QtGui.QTreeWidgetItem): ...@@ -5,10 +5,12 @@ class ParameterItem(QtGui.QTreeWidgetItem):
""" """
Abstract ParameterTree item. Abstract ParameterTree item.
Used to represent the state of a Parameter from within a ParameterTree. Used to represent the state of a Parameter from within a ParameterTree.
- Sets first column of item to name - Sets first column of item to name
- generates context menu if item is renamable or removable - generates context menu if item is renamable or removable
- handles child added / removed events - handles child added / removed events
- provides virtual functions for handling changes from parameter - provides virtual functions for handling changes from parameter
For more ParameterItem types, see ParameterTree.parameterTypes module. For more ParameterItem types, see ParameterTree.parameterTypes module.
""" """
......
...@@ -10,10 +10,12 @@ import os, collections ...@@ -10,10 +10,12 @@ import os, collections
class WidgetParameterItem(ParameterItem): class WidgetParameterItem(ParameterItem):
""" """
ParameterTree item with: ParameterTree item with:
- label in second column for displaying value - label in second column for displaying value
- simple widget for editing value (displayed instead of label when item is selected) - simple widget for editing value (displayed instead of label when item is selected)
- button that resets value to default - button that resets value to default
- provides SpinBox, CheckBox, LineEdit, and ColorButton types - provides SpinBox, CheckBox, LineEdit, and ColorButton types
This class can be subclassed by overriding makeWidget() to provide a custom widget. This class can be subclassed by overriding makeWidget() to provide a custom widget.
""" """
def __init__(self, param, depth): def __init__(self, param, depth):
...@@ -64,9 +66,13 @@ class WidgetParameterItem(ParameterItem): ...@@ -64,9 +66,13 @@ class WidgetParameterItem(ParameterItem):
""" """
Return a single widget that should be placed in the second tree column. Return a single widget that should be placed in the second tree column.
The widget must be given three attributes: 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. This is a good function to override in subclasses.
""" """
opts = self.param.opts opts = self.param.opts
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment