From 2e03c9719f74545d9edca6f6ccfc0b14d41d7400 Mon Sep 17 00:00:00 2001 From: Luke Campagnola <> Date: Tue, 8 May 2012 18:14:12 -0400 Subject: [PATCH] documentation fixes / updates --- graphicsItems/GridItem.py | 2 +- graphicsItems/HistogramLUTItem.py | 9 +++++---- graphicsItems/LabelItem.py | 16 ++++++++++------ graphicsItems/UIGraphicsItem.py | 14 ++++++++------ widgets/ProgressDialog.py | 27 ++++++++++++++++----------- widgets/TableWidget.py | 22 +++++++++------------- 6 files changed, 49 insertions(+), 41 deletions(-) diff --git a/graphicsItems/GridItem.py b/graphicsItems/GridItem.py index 92843b64..3f626944 100644 --- a/graphicsItems/GridItem.py +++ b/graphicsItems/GridItem.py @@ -6,7 +6,7 @@ from pyqtgraph.Point import Point __all__ = ['GridItem'] class GridItem(UIGraphicsItem): """ - **Bases:** `UIGraphicsItem ' + **Bases:** :class:`UIGraphicsItem ' Displays a rectangular grid of lines indicating major divisions within a coordinate system. Automatically determines what divisions to use. diff --git a/graphicsItems/HistogramLUTItem.py b/graphicsItems/HistogramLUTItem.py index 87eafe94..8978370e 100644 --- a/graphicsItems/HistogramLUTItem.py +++ b/graphicsItems/HistogramLUTItem.py @@ -25,9 +25,10 @@ class HistogramLUTItem(GraphicsWidget): """ This is a graphicsWidget which provides controls for adjusting the display of an image. Includes: - - Image histogram - - Movable region over histogram to select black/white levels - - Gradient editor to define color lookup table for single-channel images + + - Image histogram + - Movable region over histogram to select black/white levels + - Gradient editor to define color lookup table for single-channel images """ sigLookupTableChanged = QtCore.Signal(object) @@ -201,4 +202,4 @@ class HistogramLUTItem(GraphicsWidget): return self.region.getRegion() def setLevels(self, mn, mx): - self.region.setRegion([mn, mx]) \ No newline at end of file + self.region.setRegion([mn, mx]) diff --git a/graphicsItems/LabelItem.py b/graphicsItems/LabelItem.py index b27e79c6..f5ab74e4 100644 --- a/graphicsItems/LabelItem.py +++ b/graphicsItems/LabelItem.py @@ -34,11 +34,15 @@ class LabelItem(GraphicsWidget): def setText(self, text, **args): """Set the text and text properties in the label. Accepts optional arguments for auto-generating a CSS style string: - color: string (example: 'CCFF00') - size: string (example: '8pt') - bold: boolean - italic: boolean - """ + + ==================== ============================== + **Style Arguments:** + color (str) example: 'CCFF00' + size (str) example: '8pt' + bold (bool) + italic (bool) + ==================== ============================== + """ self.text = text opts = self.opts.copy() for k in args: @@ -108,4 +112,4 @@ class LabelItem(GraphicsWidget): #p.setPen(fn.mkPen('r')) #p.drawRect(self.rect()) #p.drawRect(self.item.boundingRect()) - \ No newline at end of file + diff --git a/graphicsItems/UIGraphicsItem.py b/graphicsItems/UIGraphicsItem.py index 3bef29e3..c1a2d47c 100644 --- a/graphicsItems/UIGraphicsItem.py +++ b/graphicsItems/UIGraphicsItem.py @@ -4,7 +4,8 @@ from GraphicsObject import GraphicsObject __all__ = ['UIGraphicsItem'] 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 a scalable view, but whose boundaries will always stay fixed relative to the view's boundaries. For example: GridItem, InfiniteLine @@ -19,10 +20,11 @@ class UIGraphicsItem(GraphicsObject): 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 - 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. + ============== ============================================================================= + **Arguments:** + 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. + ============== ============================================================================= """ GraphicsObject.__init__(self, parent) self.setFlag(self.ItemSendsScenePositionChanges) @@ -124,4 +126,4 @@ class UIGraphicsItem(GraphicsObject): return self.mapFromDevice(ds2) - \ No newline at end of file + diff --git a/widgets/ProgressDialog.py b/widgets/ProgressDialog.py index d5f8a2ca..da92920c 100644 --- a/widgets/ProgressDialog.py +++ b/widgets/ProgressDialog.py @@ -3,18 +3,23 @@ from pyqtgraph.Qt import QtGui, QtCore __all__ = ['ProgressDialog'] class ProgressDialog(QtGui.QProgressDialog): - """Extends QProgressDialog for use in 'with' statements. - Arguments: - labelText (required) - cancelText Text to display on cancel button, or None to disable it. - minimum - maximum - parent - wait Length of time (im ms) to wait before displaying dialog - busyCursor If True, show busy cursor until dialog finishes + """ + Extends QProgressDialog for use in 'with' statements. + + ============== ================================================================ + **Arguments:** + labelText (required) + cancelText Text to display on cancel button, or None to disable it. + minimum + 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: # do stuff dlg.setValue(i) ## could also use dlg += 1 @@ -102,4 +107,4 @@ class ProgressDialog(QtGui.QProgressDialog): if self.disabled: return 0 return QtGui.QProgressDialog.minimum(self) - \ No newline at end of file + diff --git a/widgets/TableWidget.py b/widgets/TableWidget.py index c860fded..00376240 100644 --- a/widgets/TableWidget.py +++ b/widgets/TableWidget.py @@ -11,18 +11,14 @@ except: __all__ = ['TableWidget'] class TableWidget(QtGui.QTableWidget): """Extends QTableWidget with some useful functions for automatic data handling - and copy / export context menu. - Can automatically format and display: - numpy arrays - numpy record arrays - metaarrays - list-of-lists [[1,2,3], [4,5,6]] - dict-of-lists {'x': [1,2,3], 'y': [4,5,6]} - list-of-dicts [ - {'x': 1, 'y': 4}, - {'x': 2, 'y': 5}, - {'x': 3, 'y': 6} - ] + and copy / export context menu. Can automatically format and display: + + - numpy arrays + - numpy record arrays + - metaarrays + - list-of-lists [[1,2,3], [4,5,6]] + - dict-of-lists {'x': [1,2,3], 'y': [4,5,6]} + - list-of-dicts [{'x': 1, 'y': 4}, {'x': 2, 'y': 5}, ...] """ def __init__(self, *args): @@ -247,4 +243,4 @@ if __name__ == '__main__': ]} ]) t.setData(ma) - \ No newline at end of file +