I noticed that sip was ignoring my %Docstring directives for Qt
signals (methods and everything else work fine), and using its
automatically generated ones instead.

For example:

class SomeClass {
  signals:
    void SomeSignal();
%Docstring
Foo
%End
};

>>> SomeClass.SomeSignal.__doc__
'SomeClass.SomeSignal() [signal]'

I've attached a patch that fixes this and makes it use the docstring
from the %Docstring block instead if it's present (otherwise it will
fall back to the automatically generated one as before).

>>> SomeClass.SomeSignal.__doc__
'Foo [signal]'

David
diff -r 111436ade941 sipgen/gencode.c
--- a/sipgen/gencode.c	Thu Dec 23 17:40:20 2010 +0000
+++ b/sipgen/gencode.c	Fri Feb 18 13:07:53 2011 +0000
@@ -9875,12 +9875,20 @@
 
     if (docstrings)
     {
-        fprintf(fp, "\"\\1");
-        prScopedPythonName(fp, cd->ecd, cd->pyname->text);
-        fprintf(fp, ".%s", md->pyname->text);
-        prPythonSignature(pt, fp, &sig->pysig, FALSE, FALSE, FALSE, FALSE,
-                TRUE);
-        fprintf(fp, "\", ");
+        if (md->docstring != NULL)
+        {
+            generateExplicitDocstring(md->docstring, fp);
+            fprintf(fp, ", ");
+        }
+        else
+        {
+            fprintf(fp, "\"\\1");
+            prScopedPythonName(fp, cd->ecd, cd->pyname->text);
+            fprintf(fp, ".%s", md->pyname->text);
+            prPythonSignature(pt, fp, &sig->pysig, FALSE, FALSE, FALSE, FALSE,
+                    TRUE);
+            fprintf(fp, "\", ");
+        }
     }
     else
     {
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to