merge with dev branch repository

This commit is contained in:
Luke Campagnola 2012-08-31 17:23:19 -04:00
commit 5a4fd82cd9
8 changed files with 43 additions and 25 deletions

View File

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

View File

@ -0,0 +1,8 @@
TextItem
========
.. autoclass:: pyqtgraph.TextItem
:members:
.. automethod:: pyqtgraph.TextItem.__init__

View File

@ -1,5 +1,3 @@
.. _api_widgets:
ParameterTree API Reference 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__>` 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)

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): 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)
*html* If specified, this overrides both *text* and *color* *html* If specified, this overrides both *text* and *color*
*anchor* A QPointF or (x,y) sequence indicating what region of the text box will *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 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) of the text box to be at the position specified by setPos(), while a value of (1,1)
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()

View File

@ -364,9 +364,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)

View File

@ -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
- generates context menu if item is renamable or removable - Sets first column of item to name
- handles child added / removed events - generates context menu if item is renamable or removable
- provides virtual functions for handling changes from parameter - handles child added / removed events
- provides virtual functions for handling changes from parameter
For more ParameterItem types, see ParameterTree.parameterTypes module. For more ParameterItem types, see ParameterTree.parameterTypes module.
""" """

View File

@ -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
- simple widget for editing value (displayed instead of label when item is selected) - label in second column for displaying value
- button that resets value to default - simple widget for editing value (displayed instead of label when item is selected)
- provides SpinBox, CheckBox, LineEdit, and ColorButton types - 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. 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):
""" """
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