<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">Le lun. 26 févr. 2018 à 13:43, Phil Thompson <<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 26 Feb 2018, at 5:36 pm, Denis Rouzaud <<a href="mailto:denis.rouzaud@gmail.com" target="_blank">denis.rouzaud@gmail.com</a>> wrote:<br>
><br>
><br>
> Digging a bit more...<br>
> Sorry, I mixed things.<br>
> Signals indeed do not have Python docstrings but there is a structure containing the documentation that is written under %Docstring in the SIP file.<br>
<br>
Yes that confused me as well which is why I gave a misleading answer.<br>
<br>
> So all in all, my question can be resumed as, is there a way in Sphinx to display this signature?<br>
><br>
> Le lun. 26 févr. 2018 à 13:23, Denis Rouzaud <<a href="mailto:denis.rouzaud@gmail.com" target="_blank">denis.rouzaud@gmail.com</a>> a écrit :<br>
> Hi Phil,<br>
><br>
> I've been looking a bit more, and it seems signals do have docstring.<br>
> At least I set them in my code and Sphinx seems to pick them up:<br>
><br>
> See SIP code:<br>
> <a href="https://github.com/qgis/QGIS/blob/master/python/gui/qgsmapcanvas.sip.in#L912-L917" rel="noreferrer" target="_blank">https://github.com/qgis/QGIS/blob/master/python/gui/qgsmapcanvas.sip.in#L912-L917</a><br>
><br>
> Resulting doc:<br>
> <a href="http://python.qgis.org/api/gui/Map/QgsMapCanvas.html#qgis.gui.QgsMapCanvas.currentLayerChanged" rel="noreferrer" target="_blank">http://python.qgis.org/api/gui/Map/QgsMapCanvas.html#qgis.gui.QgsMapCanvas.currentLayerChanged</a><br>
><br>
> Is this expected to you?<br>
><br>
> If yes, would there be a way to add the signature in the Docstring? Shall we modify the sip gen to achieve this?<br>
> In Python, doing QgsMapCanvas.currentLayerChanged returns:<br>
> <unbound PYQT_SIGNAL currentLayerChanged(QgsMapLayer*)><br>
<br>
It should be possible, but may need changes in PyQt as well.<br></blockquote><div><br></div><div>Wouldn't it be sufficient to extend generateSignalTableEntry, test if we have prepend/append Docstring option and parse the arguments (sig->cppsig->args) to write them down?</div><div>As far as I see it, we won't have optional argument names from a signal, but at least it's something.</div><div>What do you think? <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Phil</blockquote></div></div>