[PyQt] Docstrings for signals

Denis Rouzaud denis.rouzaud at gmail.com
Mon Feb 26 17:36:10 GMT 2018


Digging a bit more...
Sorry, I mixed things.
Signals indeed do not have Python docstrings but there is a structure
containing the documentation that is written under %Docstring in the SIP
file.

So all in all, my question can be resumed as, is there a way in Sphinx to
display this signature?

Le lun. 26 févr. 2018 à 13:23, Denis Rouzaud <denis.rouzaud at gmail.com> a
écrit :

> Hi Phil,
>
> I've been looking a bit more, and it seems signals do have docstring.
> At least I set them in my code and Sphinx seems to pick them up:
>
> See SIP code:
>
> https://github.com/qgis/QGIS/blob/master/python/gui/qgsmapcanvas.sip.in#L912-L917
>
> Resulting doc:
>
> http://python.qgis.org/api/gui/Map/QgsMapCanvas.html#qgis.gui.QgsMapCanvas.currentLayerChanged
>
> Is this expected to you?
>
> If yes, would there be a way to add the signature in the Docstring? Shall
> we modify the sip gen to achieve this?
> In Python, doing QgsMapCanvas.currentLayerChanged returns:
>
> <unbound PYQT_SIGNAL currentLayerChanged(QgsMapLayer*)>
>
> Cheers,
>
> Denis
>
> Le mar. 20 févr. 2018 à 08:27, Phil Thompson <phil at riverbankcomputing.com>
> a écrit :
>
>> On 20 Feb 2018, at 12:13 pm, Denis Rouzaud <denis.rouzaud at gmail.com>
>> wrote:
>> >
>> > Hi Phil,
>> >
>> > Another issue for Docstrings...
>> > Would it be possible to get a signature for signals too?
>> > They are listed as attribute (and not method in sphinx).
>>
>> Signals *are* attributes and attributes cannot have docstrings.
>>
>> Phil
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180226/63e5dfa9/attachment.html>


More information about the PyQt mailing list