documentation fixes / updates

This commit is contained in:
Luke Campagnola 2012-05-08 18:14:12 -04:00
parent aadd02f819
commit 2e03c9719f
6 changed files with 49 additions and 41 deletions

View File

@ -6,7 +6,7 @@ from pyqtgraph.Point import Point
__all__ = ['GridItem'] __all__ = ['GridItem']
class GridItem(UIGraphicsItem): class GridItem(UIGraphicsItem):
""" """
**Bases:** `UIGraphicsItem <pyqtgraph.UIGraphicsItem>' **Bases:** :class:`UIGraphicsItem <pyqtgraph.UIGraphicsItem>'
Displays a rectangular grid of lines indicating major divisions within a coordinate system. Displays a rectangular grid of lines indicating major divisions within a coordinate system.
Automatically determines what divisions to use. Automatically determines what divisions to use.

View File

@ -25,9 +25,10 @@ class HistogramLUTItem(GraphicsWidget):
""" """
This is a graphicsWidget which provides controls for adjusting the display of an image. This is a graphicsWidget which provides controls for adjusting the display of an image.
Includes: Includes:
- Image histogram
- Movable region over histogram to select black/white levels - Image histogram
- Gradient editor to define color lookup table for single-channel images - Movable region over histogram to select black/white levels
- Gradient editor to define color lookup table for single-channel images
""" """
sigLookupTableChanged = QtCore.Signal(object) sigLookupTableChanged = QtCore.Signal(object)
@ -201,4 +202,4 @@ class HistogramLUTItem(GraphicsWidget):
return self.region.getRegion() return self.region.getRegion()
def setLevels(self, mn, mx): def setLevels(self, mn, mx):
self.region.setRegion([mn, mx]) self.region.setRegion([mn, mx])

View File

@ -34,11 +34,15 @@ class LabelItem(GraphicsWidget):
def setText(self, text, **args): def setText(self, text, **args):
"""Set the text and text properties in the label. Accepts optional arguments for auto-generating """Set the text and text properties in the label. Accepts optional arguments for auto-generating
a CSS style string: a CSS style string:
color: string (example: 'CCFF00')
size: string (example: '8pt') ==================== ==============================
bold: boolean **Style Arguments:**
italic: boolean color (str) example: 'CCFF00'
""" size (str) example: '8pt'
bold (bool)
italic (bool)
==================== ==============================
"""
self.text = text self.text = text
opts = self.opts.copy() opts = self.opts.copy()
for k in args: for k in args:
@ -108,4 +112,4 @@ class LabelItem(GraphicsWidget):
#p.setPen(fn.mkPen('r')) #p.setPen(fn.mkPen('r'))
#p.drawRect(self.rect()) #p.drawRect(self.rect())
#p.drawRect(self.item.boundingRect()) #p.drawRect(self.item.boundingRect())

View File

@ -4,7 +4,8 @@ from GraphicsObject import GraphicsObject
__all__ = ['UIGraphicsItem'] __all__ = ['UIGraphicsItem']
class UIGraphicsItem(GraphicsObject): class UIGraphicsItem(GraphicsObject):
"""Base class for graphics items with boundaries relative to a GraphicsView or ViewBox. """
Base class for graphics items with boundaries relative to a GraphicsView or ViewBox.
The purpose of this class is to allow the creation of GraphicsItems which live inside The purpose of this class is to allow the creation of GraphicsItems which live inside
a scalable view, but whose boundaries will always stay fixed relative to the view's boundaries. a scalable view, but whose boundaries will always stay fixed relative to the view's boundaries.
For example: GridItem, InfiniteLine For example: GridItem, InfiniteLine
@ -19,10 +20,11 @@ class UIGraphicsItem(GraphicsObject):
def __init__(self, bounds=None, parent=None): def __init__(self, bounds=None, parent=None):
""" """
Initialization Arguments: ============== =============================================================================
#view: The view box whose bounds will be used as a reference vor this item's bounds **Arguments:**
bounds: QRectF with coordinates relative to view box. The default is QRectF(0,0,1,1), bounds QRectF with coordinates relative to view box. The default is QRectF(0,0,1,1),
which means the item will have the same bounds as the view. which means the item will have the same bounds as the view.
============== =============================================================================
""" """
GraphicsObject.__init__(self, parent) GraphicsObject.__init__(self, parent)
self.setFlag(self.ItemSendsScenePositionChanges) self.setFlag(self.ItemSendsScenePositionChanges)
@ -124,4 +126,4 @@ class UIGraphicsItem(GraphicsObject):
return self.mapFromDevice(ds2) return self.mapFromDevice(ds2)

View File

@ -3,18 +3,23 @@ from pyqtgraph.Qt import QtGui, QtCore
__all__ = ['ProgressDialog'] __all__ = ['ProgressDialog']
class ProgressDialog(QtGui.QProgressDialog): class ProgressDialog(QtGui.QProgressDialog):
"""Extends QProgressDialog for use in 'with' statements. """
Arguments: Extends QProgressDialog for use in 'with' statements.
labelText (required)
cancelText Text to display on cancel button, or None to disable it. ============== ================================================================
minimum **Arguments:**
maximum labelText (required)
parent cancelText Text to display on cancel button, or None to disable it.
wait Length of time (im ms) to wait before displaying dialog minimum
busyCursor If True, show busy cursor until dialog finishes maximum
parent
wait Length of time (im ms) to wait before displaying dialog
busyCursor If True, show busy cursor until dialog finishes
============== ================================================================
Example: Example::
with ProgressDialog("Processing..", minVal, maxVal) as dlg: with ProgressDialog("Processing..", minVal, maxVal) as dlg:
# do stuff # do stuff
dlg.setValue(i) ## could also use dlg += 1 dlg.setValue(i) ## could also use dlg += 1
@ -102,4 +107,4 @@ class ProgressDialog(QtGui.QProgressDialog):
if self.disabled: if self.disabled:
return 0 return 0
return QtGui.QProgressDialog.minimum(self) return QtGui.QProgressDialog.minimum(self)

View File

@ -11,18 +11,14 @@ except:
__all__ = ['TableWidget'] __all__ = ['TableWidget']
class TableWidget(QtGui.QTableWidget): class TableWidget(QtGui.QTableWidget):
"""Extends QTableWidget with some useful functions for automatic data handling """Extends QTableWidget with some useful functions for automatic data handling
and copy / export context menu. and copy / export context menu. Can automatically format and display:
Can automatically format and display:
numpy arrays - numpy arrays
numpy record arrays - numpy record arrays
metaarrays - metaarrays
list-of-lists [[1,2,3], [4,5,6]] - list-of-lists [[1,2,3], [4,5,6]]
dict-of-lists {'x': [1,2,3], 'y': [4,5,6]} - dict-of-lists {'x': [1,2,3], 'y': [4,5,6]}
list-of-dicts [ - list-of-dicts [{'x': 1, 'y': 4}, {'x': 2, 'y': 5}, ...]
{'x': 1, 'y': 4},
{'x': 2, 'y': 5},
{'x': 3, 'y': 6}
]
""" """
def __init__(self, *args): def __init__(self, *args):
@ -247,4 +243,4 @@ if __name__ == '__main__':
]} ]}
]) ])
t.setData(ma) t.setData(ma)