Skip to content

Commit a58155c

Browse files
committed
Added docstrings for legend_data, painter, ..., plot (except QwtPlotItem)
1 parent 7dd5615 commit a58155c

File tree

15 files changed

+1440
-304
lines changed

15 files changed

+1440
-304
lines changed

doc/reference/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ Main `python-qwt` classes:
1010
graphic
1111
interval
1212
legend
13+
legend_data
14+
legend_label
15+
plot

doc/reference/legend_data.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.. automodule:: qwt.legend_data
2+
:members:

doc/reference/legend_label.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.. automodule:: qwt.legend_label
2+
:members:

doc/reference/plot.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.. automodule:: qwt.plot
2+
:members:

qwt/color_map.py

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,11 @@ def __init__(self, format_=None):
163163

164164
def color(self, interval, value):
165165
"""
166-
.. py:method:: color(interval, value)
166+
Map a value into a color
167167
168-
Map a value into a color
169-
170-
:param qwt.interval.QwtInterval interval: valid interval for value
171-
:param float value: value
172-
:return: the color corresponding to value
168+
:param qwt.interval.QwtInterval interval: valid interval for value
169+
:param float value: value
170+
:return: the color corresponding to value
173171
174172
.. warning ::
175173
@@ -188,12 +186,10 @@ def format(self):
188186

189187
def colorTable(self, interval):
190188
"""
191-
.. py:method:: colorTable(interval)
189+
Build and return a color map of 256 colors
192190
193-
Build and return a color map of 256 colors
194-
195-
:param qwt.interval.QwtInterval interval: range for the values
196-
:return: a color table, that can be used for a `QImage`
191+
:param qwt.interval.QwtInterval interval: range for the values
192+
:return: a color table, that can be used for a `QImage`
197193
198194
The color table is needed for rendering indexed images in combination
199195
with using `colorIndex()`.
@@ -257,11 +253,9 @@ def __init__(self, *args):
257253

258254
def setMode(self, mode):
259255
"""
260-
.. py:method:: setMode(mode)
261-
262-
Set the mode of the color map
263-
264-
:param int mode: :py:data:`QwtLinearColorMap.FixedColors` or :py:data:`QwtLinearColorMap.ScaledColors`
256+
Set the mode of the color map
257+
258+
:param int mode: :py:data:`QwtLinearColorMap.FixedColors` or :py:data:`QwtLinearColorMap.ScaledColors`
265259
266260
`FixedColors` means the color is calculated from the next lower color
267261
stop. `ScaledColors` means the color is calculated by interpolating
@@ -271,7 +265,7 @@ def setMode(self, mode):
271265

272266
def mode(self):
273267
"""
274-
Return the mode of the color map
268+
:return: the mode of the color map
275269
276270
.. seealso ::
277271
@@ -343,19 +337,17 @@ def __init__(self, color):
343337

344338
def setColor(self, color):
345339
"""
346-
.. py:method:: setColor(color)
347-
348-
Set the color of the map
349-
350-
:param QColor color: color of the map
340+
Set the color of the map
341+
342+
:param QColor color: color of the map
351343
"""
352344
self.__data.color = color
353345
self.__data.rgb = color.rgb() & qRgba(255, 255, 255, 0)
354346
self.__data.rgbMax = self.__data.rgb | ( 255 << 24 )
355347

356348
def color(self):
357349
"""
358-
Return the color of the map
350+
:return: the color of the map
359351
360352
.. seealso ::
361353

qwt/graphic.py

Lines changed: 57 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class QwtGraphic(QwtNullPaintDevice):
250250
251251
Copy constructor
252252
253-
:param: QwtGraphic other: Source
253+
:param qwt.graphic.QwtGraphic other: Source
254254
"""
255255

256256
# enum RenderHint
@@ -298,13 +298,11 @@ def testRenderHint(self, hint):
298298

299299
def boundingRect(self):
300300
"""
301-
.. py:method:: boundingRect()
301+
The bounding rectangle is the :py:meth:`controlPointRect`
302+
extended by the areas needed for rendering the outlines
303+
with unscaled pens.
302304
303-
The bounding rectangle is the :py:meth:`controlPointRect`
304-
extended by the areas needed for rendering the outlines
305-
with unscaled pens.
306-
307-
:return: Bounding rectangle of the graphic
305+
:return: Bounding rectangle of the graphic
308306
309307
.. seealso::
310308
@@ -316,13 +314,11 @@ def boundingRect(self):
316314

317315
def controlPointRect(self):
318316
"""
319-
.. py:method:: controlPointRect()
320-
321-
The control point rectangle is the bounding rectangle
322-
of all control points of the paths and the target
323-
rectangles of the images/pixmaps.
317+
The control point rectangle is the bounding rectangle
318+
of all control points of the paths and the target
319+
rectangles of the images/pixmaps.
324320
325-
:return: Control point rectangle
321+
:return: Control point rectangle
326322
327323
.. seealso::
328324
@@ -334,13 +330,11 @@ def controlPointRect(self):
334330

335331
def scaledBoundingRect(self, sx, sy):
336332
"""
337-
.. py:method:: scaledBoundingRect(sx, sy)
333+
Calculate the target rectangle for scaling the graphic
338334
339-
Calculate the target rectangle for scaling the graphic
340-
341-
:param: float sx: Horizontal scaling factor
342-
:param: float sy: Vertical scaling factor
343-
:return: Scaled bounding rectangle
335+
:param float sx: Horizontal scaling factor
336+
:param float sy: Vertical scaling factor
337+
:return: Scaled bounding rectangle
344338
345339
.. note::
346340
@@ -369,14 +363,12 @@ def sizeMetrics(self):
369363

370364
def setDefaultSize(self, size):
371365
"""
372-
.. py:method:: setDefaultSize(size)
366+
The default size is used in all methods rendering the graphic,
367+
where no size is explicitly specified. Assigning an empty size
368+
means, that the default size will be calculated from the bounding
369+
rectangle.
373370
374-
The default size is used in all methods rendering the graphic,
375-
where no size is explicitly specified. Assigning an empty size
376-
means, that the default size will be calculated from the bounding
377-
rectangle.
378-
379-
:param: QSizeF size: Default size
371+
:param QSizeF size: Default size
380372
381373
.. seealso::
382374
@@ -388,16 +380,14 @@ def setDefaultSize(self, size):
388380

389381
def defaultSize(self):
390382
"""
391-
.. py:method:: defaultSize()
392-
393-
When a non empty size has been assigned by setDefaultSize() this
394-
size will be returned. Otherwise the default size is the size
395-
of the bounding rectangle.
383+
When a non empty size has been assigned by setDefaultSize() this
384+
size will be returned. Otherwise the default size is the size
385+
of the bounding rectangle.
396386
397-
The default size is used in all methods rendering the graphic,
398-
where no size is explicitly specified.
399-
400-
:return: Default size
387+
The default size is used in all methods rendering the graphic,
388+
where no size is explicitly specified.
389+
390+
:return: Default size
401391
402392
.. seealso::
403393
@@ -413,7 +403,7 @@ def render(self, *args):
413403
414404
Replay all recorded painter commands
415405
416-
:param: QPainter painter: Qt painter
406+
:param QPainter painter: Qt painter
417407
418408
.. py:method:: render(painter, size, aspectRatioMode)
419409
@@ -422,19 +412,19 @@ def render(self, *args):
422412
The graphic is scaled to fit into the rectangle
423413
of the given size starting at ( 0, 0 ).
424414
425-
:param: QPainter painter: Qt painter
426-
:param: QSizeF size: Size for the scaled graphic
427-
:param: Qt.AspectRatioMode aspectRatioMode: Mode how to scale
415+
:param QPainter painter: Qt painter
416+
:param QSizeF size: Size for the scaled graphic
417+
:param Qt.AspectRatioMode aspectRatioMode: Mode how to scale
428418
429419
.. py:method:: render(painter, rect, aspectRatioMode)
430420
431421
Replay all recorded painter commands
432422
433423
The graphic is scaled to fit into the given rectangle
434424
435-
:param: QPainter painter: Qt painter
436-
:param: QRectF rect: Rectangle for the scaled graphic
437-
:param: Qt.AspectRatioMode aspectRatioMode: Mode how to scale
425+
:param QPainter painter: Qt painter
426+
:param QRectF rect: Rectangle for the scaled graphic
427+
:param Qt.AspectRatioMode aspectRatioMode: Mode how to scale
438428
439429
.. py:method:: render(painter, pos, aspectRatioMode)
440430
@@ -443,9 +433,9 @@ def render(self, *args):
443433
The graphic is scaled to the :py:meth:`defaultSize()` and aligned
444434
to a position.
445435
446-
:param: QPainter painter: Qt painter
447-
:param: QPointF pos: Reference point, where to render
448-
:param: Qt.AspectRatioMode aspectRatioMode: Mode how to scale
436+
:param QPainter painter: Qt painter
437+
:param QPointF pos: Reference point, where to render
438+
:param Qt.AspectRatioMode aspectRatioMode: Mode how to scale
449439
"""
450440
if len(args) == 1:
451441
painter, = args
@@ -536,17 +526,15 @@ def render(self, *args):
536526

537527
def toPixmap(self, *args):
538528
"""
539-
.. py:method:: toPixmap()
540-
541-
Convert the graphic to a `QPixmap`
529+
Convert the graphic to a `QPixmap`
542530
543-
All pixels of the pixmap get initialized by `Qt.transparent`
544-
before the graphic is scaled and rendered on it.
531+
All pixels of the pixmap get initialized by `Qt.transparent`
532+
before the graphic is scaled and rendered on it.
545533
546-
The size of the pixmap is the default size ( ceiled to integers )
547-
of the graphic.
548-
549-
:return: The graphic as pixmap in default size
534+
The size of the pixmap is the default size ( ceiled to integers )
535+
of the graphic.
536+
537+
:return: The graphic as pixmap in default size
550538
551539
.. seealso::
552540
@@ -603,8 +591,8 @@ def toImage(self, *args):
603591
604592
The format of the image is `QImage.Format_ARGB32_Premultiplied`.
605593
606-
:param: QSize size: Size of the image
607-
:param: `Qt.AspectRatioMode` aspectRatioMode: Aspect ratio how to scale the graphic
594+
:param QSize size: Size of the image
595+
:param `Qt.AspectRatioMode` aspectRatioMode: Aspect ratio how to scale the graphic
608596
:return: The graphic as image
609597
610598
.. seealso::
@@ -638,11 +626,9 @@ def toImage(self, *args):
638626

639627
def drawPath(self, path):
640628
"""
641-
.. py:method:: drawPath(path)
629+
Store a path command in the command list
642630
643-
Store a path command in the command list
644-
645-
:param: QPainterPath path: Painter path
631+
:param QPainterPath path: Painter path
646632
647633
.. seealso::
648634
@@ -666,13 +652,11 @@ def drawPath(self, path):
666652

667653
def drawPixmap(self, rect, pixmap, subRect):
668654
"""
669-
.. py:method:: drawPixmap(rect, pixmap, subRect)
655+
Store a pixmap command in the command list
670656
671-
Store a pixmap command in the command list
672-
673-
:param: QRectF rect: target rectangle
674-
:param: QPixmap pixmap: Pixmap to be painted
675-
:param: QRectF subRect: Reactangle of the pixmap to be painted
657+
:param QRectF rect: target rectangle
658+
:param QPixmap pixmap: Pixmap to be painted
659+
:param QRectF subRect: Reactangle of the pixmap to be painted
676660
677661
.. seealso::
678662
@@ -688,14 +672,12 @@ def drawPixmap(self, rect, pixmap, subRect):
688672

689673
def drawImage(self, rect, image, subRect, flags):
690674
"""
691-
.. py:method:: drawImage(rect, image, subRect, flags)
675+
Store a image command in the command list
692676
693-
Store a image command in the command list
694-
695-
:param: QRectF rect: target rectangle
696-
:param: QImage image: Pixmap to be painted
697-
:param: QRectF subRect: Reactangle of the pixmap to be painted
698-
:param: Qt.ImageConversionFlags flags: Pixmap to be painted
677+
:param QRectF rect: target rectangle
678+
:param QImage image: Pixmap to be painted
679+
:param QRectF subRect: Reactangle of the pixmap to be painted
680+
:param Qt.ImageConversionFlags flags: Pixmap to be painted
699681
700682
.. seealso::
701683
@@ -711,11 +693,9 @@ def drawImage(self, rect, image, subRect, flags):
711693

712694
def updateState(self, state):
713695
"""
714-
.. py:method:: updateState(state)
696+
Store a state command in the command list
715697
716-
Store a state command in the command list
717-
718-
:param: QPaintEngineState state: State to be stored
698+
:param QPaintEngineState state: State to be stored
719699
720700
.. seealso::
721701

0 commit comments

Comments
 (0)