Skip to content

Commit 217f102

Browse files
committed
docs: render Google-style docstrings and document datetime scale classes
The documentation build reported 3 errors and 1 warning: the docstrings of the qwt.qtdesigner module follow the Google style (Args/Returns), which Sphinx does not understand without the napoleon extension. Besides, QwtDateTimeScaleDraw and QwtDateTimeScaleEngine were missing from the reference documentation. - doc/conf.py: enable sphinx.ext.napoleon. - Add QwtDateTimeScaleDraw and QwtDateTimeScaleEngine to the module documentation of qwt.scale_draw and qwt.scale_engine. - QwtDateTimeScaleDraw.get_format/label: drop the return types from the Returns sections (already in the signatures), as "QwtText" was an ambiguous cross-reference. - QwtPlotLayout.expandLineBreaks: move its "Returns:" list into the `:return:` field, which napoleon would otherwise misinterpret. - Changelog entry. `sphinx -b html doc ... -W` now succeeds without any warning. Compared with a build without napoleon, only the qtdesigner, scale and plot_layout reference pages change. Refs #115 Assisted-by: Claude Opus 5.5
1 parent b8ecfea commit 217f102

5 files changed

Lines changed: 17 additions & 6 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
### Other changes
2525

2626
- The source distribution now includes the Qt Designer plugin (`qtdesigner/qwtplugin.py`, see the "Qt Designer" section of the documentation) and this changelog ([Issue #115](https://github.com/PlotPyStack/PythonQwt/issues/115))
27+
- Documentation: the reference of the `qwt.qtdesigner` module, whose docstrings follow the Google style, is now rendered properly (it produced formatting errors), and `QwtDateTimeScaleDraw` and `QwtDateTimeScaleEngine` are now documented ([Issue #115](https://github.com/PlotPyStack/PythonQwt/issues/115))
2728

2829
## Version 0.16.3
2930

‎doc/conf.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
# Add any Sphinx extension module names here, as strings. They can be extensions
2121
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
22-
extensions = ["sphinx.ext.autodoc"]
22+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon"]
2323
try:
2424
import sphinx.ext.viewcode # noqa: F401
2525

‎qwt/plot_layout.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,7 @@ def expandLineBreaks(self, options, rect):
746746
747747
:param options: Options how to layout the legend
748748
:param QRectF rect: Bounding rectangle for title, footer, axes and canvas.
749-
:return: tuple `(dimTitle, dimFooter, dimAxes)`
750-
751-
Returns:
749+
:return: tuple `(dimTitle, dimFooter, dimAxes)`, where:
752750
753751
* `dimTitle`: Expanded height of the title widget
754752
* `dimFooter`: Expanded height of the footer widget

‎qwt/scale_draw.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
1818
.. autoclass:: QwtScaleDraw
1919
:members:
20+
21+
QwtDateTimeScaleDraw
22+
--------------------
23+
24+
.. autoclass:: QwtDateTimeScaleDraw
25+
:members:
2026
"""
2127

2228
import math
@@ -1294,7 +1300,7 @@ def get_format(self) -> str:
12941300
"""Get the current datetime format string
12951301
12961302
Returns:
1297-
str: Format string
1303+
Format string
12981304
"""
12991305
return self._format
13001306

@@ -1313,7 +1319,7 @@ def label(self, value: float) -> QwtText:
13131319
value: Unix timestamp (seconds since epoch)
13141320
13151321
Returns:
1316-
QwtText: Formatted label
1322+
Formatted label
13171323
"""
13181324
try:
13191325
dt = datetime.fromtimestamp(value)

‎qwt/scale_engine.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
2424
.. autoclass:: QwtLogScaleEngine
2525
:members:
26+
27+
QwtDateTimeScaleEngine
28+
----------------------
29+
30+
.. autoclass:: QwtDateTimeScaleEngine
31+
:members:
2632
"""
2733

2834
import math

0 commit comments

Comments
 (0)