[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyKDE] about DCOP, QDataStream, <<, and >>
From: Phil Thompson <phil () river-bank ! demon ! co ! uk>
Date: 2002-11-30 23:37:47
[Download RAW message or body]
On Saturday 30 November 2002 7:23 pm, Jim Bublitz wrote:
> On 30-Nov-02 Jim Bublitz wrote:
> > On 30-Nov-02 Me wrote:
> >> Hi, I'm trying to figure out how to use the DCOP interface. The
> >> KDE C++
> >> examples make use of << and >>, but how to do it with python? Is
> >> there a work
> >> around for this?
> >>
> >> The example I'm working from has a part like so:
> >>
> >> void MainWindow::bookLocation()
> >> {
> >> DCOPClient *client=kapp->dcopClient();
> >> QByteArray params;
> >> QDataStream stream(params, IO_WriteOnly);
> >> stream << location->text();
> >> if (!client->send("p6-*", "bookmarkList", "add(QString)",
> >> params))
> >> kdDebug() << "Error with DCOP\n";
> >> }
> >>
> >> How would I do that with python? Thanks for any help.
> >
> > The short, quick, and unsatisfying answer is "I don't know". I've
> > been aware that the DCOP interface in PyKDE *might* be
> > incomplete, but haven't looked much farther than that. I seem to
> > recall that I did see a way around this, but I'm not sure what
> > it might be at the moment. I'll look into it and try to have an
> > answer in the next day or two. Please post again if I don't get
> > you an answer in that timeframe.
>
> It looks like you should be able to use QDataStream.writeBytes
> or QDataStream.writeRawBytes to put data on the stream. These
> are declared in qdatastream.sip as:
>
> QDataStream &writeBytes(const char * /Array/,uint /ArraySize/);
> QDataStream &writeRawBytes(const char * /Array/,uint /ArraySize/);
>
> I'm assuming the /.../ stuff (Phil ??) means that from Python you
> only need to supply the char string and sip will compute the length
> and pass it to Qt for you, eg:
>
> stream.writeBytes (location.text())
Correct.
Phil
_______________________________________________
PyKDE mailing list PyKDE@mats.gmd.de
http://mats.gmd.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic