[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] SIP template
From:       Shaheed Haque <srhaque () theiet ! org>
Date:       2017-08-14 10:13:29
Message-ID: CAHAc2jf0ZYcHSAJOG07wDKbW1JohUw799C69wWMVfZQqvJ70vQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On 8 August 2017 at 22:12, Shaheed Haque <srhaque@theiet.org> wrote:

> On 8 August 2017 at 17:23, Phil Thompson <phil@riverbankcomputing.com>
> wrote:
> > On 2 Aug 2017, at 9:21 am, Shaheed Haque <srhaque@theiet.org> wrote:
> >>
> >> Hi,
> >>
> >> On 18 May 2017 at 13:14, Denis Rouzaud <denis.rouzaud@gmail.com> wrote:
> >>>
> >>> Sorry, for the noise.
> >>>
> >>> I missed the second typedef in the ModuleHeaderCode, it works!
> >>> Thanks to David, Phil and Shaheed for the hints!
> >>
> >> Is there a variation on this technique that works for nested classes?
> >> It turns out that in all 17 places this affects PyKF5 involve nested
> >> classes, and attempting to modify this SIP:
> >>
> >> =============
> >> namespace KContacts
> >> {
> >>    class AddresseeList: QVector<KContacts::Addressee>
> >>    {
> >> =============
> >>
> >> into this SIP:
> >>
> >> =============
> >> namespace KContacts
> >> {
> >> %TypeHeaderCode
> >> typedef QVector<KContacts::Addressee> foo_t;
> >> %End
> >> typedef QVector<KContacts::Addressee> foo_t;
> >>    class AddresseeList: KContacts::foo_t
> >>    {
> >> =============
> >>
> >> only results in:
> >>
> >> sip: tmp/KContacts/KContacts/AddresseeList.sip:121: Super-class list
> >> contains an invalid type
> >>
> >> I stared a the code that emits the message in parser.y (and also tried
> >> moving foo_t to global scope), without the solution becoming obvious.
> >> So, any clues or ideas welcomed!
> >
> > PyQt has the same problem with QPolygon. The workaround is to say that
> AddresseeList does not have a super-class and to add any QVector methods
> you want to AddresseeList. See qpolygon.sip in PyQt.
>
> Thanks Phil...
>

I'm still working on variations of this topic. The problem I am having at
the moment is that a sequence like this, where Bar has a base which is a
%MappedType:

=======
%Module(name=xxx)

%MappedType FooBad
{
%ConvertFromTypeCode
// blah.
%End
%ConvertToTypeCode
// blah.
%End
};

class FooOK
{
public:
    FooOK();
};

class Bar: FooBad
{  <<<<<<<<<<<<<<<< This is line 20
public:
    Bar();
};
=======

gives the error "sip: tmp.sip:20: A class, exception, namespace or mapped
type has already been defined with the same name" but if I change the base
class from FooBad to the non-%MappedType normal class FooOK, it compiles
just fine. I'm on 4.19.4.dev1708081632...have I gone mad?

Thanks, Shaheed


> >
> > Phil
>

[Attachment #5 (text/html)]

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 8 August 2017 at \
22:12, Shaheed Haque <span dir="ltr">&lt;<a href="mailto:srhaque@theiet.org" \
target="_blank">srhaque@theiet.org</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On \
8 August 2017 at 17:23, Phil Thompson &lt;<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>&gt; \
wrote:<br> &gt; On 2 Aug 2017, at 9:21 am, Shaheed Haque &lt;<a \
href="mailto:srhaque@theiet.org">srhaque@theiet.org</a>&gt; wrote:<br> &gt;&gt;<br>
&gt;&gt; Hi,<br>
&gt;&gt;<br>
&gt;&gt; On 18 May 2017 at 13:14, Denis Rouzaud &lt;<a \
href="mailto:denis.rouzaud@gmail.com">denis.rouzaud@gmail.com</a>&gt; wrote:<br> \
&gt;&gt;&gt;<br> &gt;&gt;&gt; Sorry, for the noise.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I missed the second typedef in the ModuleHeaderCode, it works!<br>
&gt;&gt;&gt; Thanks to David, Phil and Shaheed for the hints!<br>
&gt;&gt;<br>
&gt;&gt; Is there a variation on this technique that works for nested classes?<br>
&gt;&gt; It turns out that in all 17 places this affects PyKF5 involve nested<br>
&gt;&gt; classes, and attempting to modify this SIP:<br>
&gt;&gt;<br>
&gt;&gt; =============<br>
&gt;&gt; namespace KContacts<br>
&gt;&gt; {<br>
&gt;&gt;      class AddresseeList: QVector&lt;KContacts::Addressee&gt;<br>
&gt;&gt;      {<br>
&gt;&gt; =============<br>
&gt;&gt;<br>
&gt;&gt; into this SIP:<br>
&gt;&gt;<br>
&gt;&gt; =============<br>
&gt;&gt; namespace KContacts<br>
&gt;&gt; {<br>
&gt;&gt; %TypeHeaderCode<br>
&gt;&gt; typedef QVector&lt;KContacts::Addressee&gt; foo_t;<br>
&gt;&gt; %End<br>
&gt;&gt; typedef QVector&lt;KContacts::Addressee&gt; foo_t;<br>
&gt;&gt;      class AddresseeList: KContacts::foo_t<br>
&gt;&gt;      {<br>
&gt;&gt; =============<br>
&gt;&gt;<br>
&gt;&gt; only results in:<br>
&gt;&gt;<br>
&gt;&gt; sip: tmp/KContacts/KContacts/<wbr>AddresseeList.sip:121: Super-class \
list<br> &gt;&gt; contains an invalid type<br>
&gt;&gt;<br>
&gt;&gt; I stared a the code that emits the message in parser.y (and also tried<br>
&gt;&gt; moving foo_t to global scope), without the solution becoming obvious.<br>
&gt;&gt; So, any clues or ideas welcomed!<br>
&gt;<br>
&gt; PyQt has the same problem with QPolygon. The workaround is to say that \
AddresseeList does not have a super-class and to add any QVector methods you want to \
AddresseeList. See qpolygon.sip in PyQt.<br> <br>
</div></div>Thanks Phil...<br></blockquote><div><br></div><div>I&#39;m still working \
on variations of this topic. The problem I am having at the moment is that a sequence \
like this, where Bar has a base which is a \
%MappedType:<br><br>=======<br>%Module(name=xxx)<br><br>%MappedType \
FooBad<br>{<br>%ConvertFromTypeCode<br>// blah.<br>%End<br>%ConvertToTypeCode<br>// \
blah.<br>%End<br>};<br><br>class FooOK<br>{<br>public:<br>       \
FooOK();<br>};<br><br>class Bar: FooBad<br></div><div>{   \
&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; This is line \
20<br></div><div>public:<br>       Bar();<br>};<br>=======<br><br></div><div>gives \
the error &quot;sip: tmp.sip:20: A class, exception, namespace or mapped type has \
already been defined with the same name&quot; but if I change the base class from \
FooBad to the non-%MappedType normal class FooOK, it compiles just fine. I&#39;m on \
4.19.4.dev1708081632...have I gone mad?<br></div><div><br></div><div>Thanks, \
Shaheed<br></div><div>  </div><blockquote class="gmail_quote" style="margin:0px 0px \
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> &gt;<br>
&gt; Phil<br>
</blockquote></div><br></div></div>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://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