[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] [PATCH] Use provided docstrings for Qt signals
From: David Sansome <me () davidsansome ! com>
Date: 2011-02-18 13:13:02
Message-ID: AANLkTiktUQwdF8xRA1OXOcAA5uUUdt1Nud-B3uKF=125 () mail ! gmail ! com
[Download RAW message or body]
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
["signal-docstrings.patch" (text/x-patch)]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic