Skip to content

Commit 6c13d5f

Browse files
committed
Added docstrings for symbol/series_store modules + removed QwtAbstractSeriesStore
1 parent dc4c57d commit 6c13d5f

File tree

11 files changed

+567
-40
lines changed

11 files changed

+567
-40
lines changed

doc/images/symbol_path_example.png

6.8 KB
Loading

doc/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Contents:
77
:maxdepth: 2
88

99
overview
10-
limitations
1110
installation
1211
examples/index
1312
reference/index

doc/overview.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,23 @@ only plot items needed by `guiqwt`): `QwtPlotItem` (base class),
2626
`QwtPlotCurve`.
2727

2828
The `HistogramItem` object implemented in PyQwt's HistogramDemo.py is not
29-
available here as a similar item is already implemented in `guiqwt`. As a
29+
available here (a similar item is already implemented in `guiqwt`). As a
3030
consequence, the following classes are not implemented: `QwtPlotHistogram`,
3131
`QwtIntervalSeriesData`, `QwtIntervalSample`.
3232

33-
The following data structure objects are not implemented as they seemed not
34-
relevant with Python and NumPy: `QwtCPointerData` (As a consequence, method
33+
The following data structure objects are not implemented as they seemed
34+
irrelevant with Python and NumPy: `QwtCPointerData` (as a consequence, method
3535
`QwtPlot.setRawSamples` is not implemented), `QwtSyntheticPointData`.
3636

3737
The following sample data type objects are not implemented as they seemed
3838
quite specific: `QwtSetSample`, `QwtOHLCSample`. For similar reasons, the
3939
`QwtPointPolar` class and the following sample iterator objects are not
40-
implemented: `QwtSetSeriesData`, `QwtTradingChartData`,
41-
`QwtPoint3DSeriesData`, `QwtArraySeriesData`, `QwtPointSeriesData`.
40+
implemented: `QwtSetSeriesData`, `QwtTradingChartData` and
41+
`QwtPoint3DSeriesData`.
42+
43+
The following classes are not implemented because they seem inappropriate in
44+
the Python/NumPy context: `QwtArraySeriesData`, `QwtPointSeriesData`,
45+
`QwtAbstractSeriesStore`.
4246

4347
Threads:
4448

doc/reference/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ Main `python-qwt` classes:
2626
scale_engine
2727
scale_widget
2828
series_data
29+
series_store
30+
symbol
2931
toqimage

doc/reference/series_store.rst

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

doc/reference/symbol.rst

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

qwt/plot_curve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def symbol(self):
374374

375375
def setPen(self, *args):
376376
"""
377-
Build and/or assigna a pen, depending on the arguments.
377+
Build and/or assign a pen, depending on the arguments.
378378
379379
.. py:method:: setPen(color, width, style)
380380

qwt/plot_seriesitem.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
from qwt.plot import QwtPlotItem, QwtPlotItem_PrivateData
1717
from qwt.text import QwtText
18-
from qwt.series_store import QwtAbstractSeriesStore
1918

2019
from qwt.qt.QtCore import Qt, QRectF
2120

@@ -26,12 +25,11 @@ def __init__(self):
2625
self.orientation = Qt.Vertical
2726

2827

29-
class QwtPlotSeriesItem(QwtPlotItem, QwtAbstractSeriesStore):
28+
class QwtPlotSeriesItem(QwtPlotItem):
3029
"""
3130
Base class for plot items representing a series of samples
3231
"""
3332
def __init__(self, title):
34-
QwtAbstractSeriesStore.__init__(self)
3533
if not isinstance(title, QwtText):
3634
title = QwtText(title)
3735
QwtPlotItem.__init__(self, title)

qwt/scale_engine.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,8 @@ class QwtLogScaleEngine(QwtScaleEngine):
621621
"""
622622
A scale engine for logarithmic scales
623623
624-
The step size is measured in *decades*
625-
and the major step size will be adjusted to fit the pattern
626-
\f$\left\{ 1,2,3,5\right\} \cdot 10^{n}\f$, where n is a natural number
624+
The step size is measured in *decades* and the major step size will be
625+
adjusted to fit the pattern {1,2,3,5}.10**n, where n is a natural number
627626
including zero.
628627
629628
.. warning::

qwt/series_store.py

Lines changed: 66 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,103 @@
55
# Copyright (c) 2015 Pierre Raybaut, for the Python translation/optimization
66
# (see LICENSE file for more details)
77

8-
from qwt.qt.QtCore import QRectF
8+
"""
9+
QwtSeriesStore
10+
--------------
911
12+
.. autoclass:: QwtSeriesStore
13+
:members:
14+
"""
1015

11-
class QwtAbstractSeriesStore(object):
12-
def dataChanged(self):
13-
raise NotImplementedError
14-
15-
def dataSize(self):
16-
raise NotImplementedError
17-
18-
def dataRect(self):
19-
raise NotImplementedError
20-
21-
def setRectOfInterest(self, rect):
22-
raise NotImplementedError
16+
from qwt.qt.QtCore import QRectF
2317

2418

25-
class QwtSeriesStore(QwtAbstractSeriesStore):
19+
class QwtSeriesStore(object):
20+
"""
21+
Class storing a `QwtSeriesData` object
22+
23+
`QwtSeriesStore` and `QwtPlotSeriesItem` are intended as base classes for
24+
all plot items iterating over a series of samples.
25+
"""
2626
def __init__(self):
2727
self.__series = None
2828

29+
def setData(self, series):
30+
"""
31+
Assign a series of samples
32+
33+
:param qwt.series_data.QwtSeriesData series: Data
34+
35+
.. warning::
36+
37+
The item takes ownership of the data object, deleting it
38+
when its not used anymore.
39+
"""
40+
if self.__series != series:
41+
self.__series = series
42+
self.dataChanged()
43+
2944
def data(self):
45+
"""
46+
:return: the series data
47+
"""
3048
return self.__series
3149

3250
def sample(self, index):
51+
"""
52+
:param int index: Index
53+
:return: Sample at position index
54+
"""
3355
if self.__series:
3456
return self.__series.sample(index)
3557
else:
36-
#TODO: not implemented!
3758
return
3859

39-
def setData(self, series):
40-
if self.__series != series:
41-
self.__series = series
42-
self.dataChanged()
43-
4460
def dataSize(self):
61+
"""
62+
:return: Number of samples of the series
63+
64+
.. seealso::
65+
66+
:py:meth:`setData()`,
67+
:py:meth:`qwt.series_data.QwtSeriesData.size()`
68+
"""
4569
if self.__series is None:
4670
return 0
4771
return self.__series.size()
4872

4973
def dataRect(self):
74+
"""
75+
:return: Bounding rectangle of the series or an invalid rectangle, when no series is stored
76+
77+
.. seealso::
78+
79+
:py:meth:`qwt.series_data.QwtSeriesData.boundingRect()`
80+
"""
5081
if self.__series is None or self.dataSize() == 0:
5182
return QRectF(1.0, 1.0, -2.0, -2.0)
5283
return self.__series.boundingRect()
5384

5485
def setRectOfInterest(self, rect):
86+
"""
87+
Set a the "rect of interest" for the series
88+
89+
:param QRectF rect: Rectangle of interest
90+
91+
.. seealso::
92+
93+
:py:meth:`qwt.series_data.QwtSeriesData.setRectOfInterest()`
94+
"""
5595
if self.__series:
5696
self.__series.setRectOfInterest(rect)
5797

5898
def swapData(self, series):
99+
"""
100+
Replace a series without deleting the previous one
101+
102+
:param qwt.series_data.QwtSeriesData series: New series
103+
:return: Previously assigned series
104+
"""
59105
swappedSeries = self.__series
60106
self.__series = series
61107
return swappedSeries

0 commit comments

Comments
 (0)