Re: [PyKDE] PyQt 3.x for Debian

2002-06-12 Thread Fredrik Juhlin

On Tue, 2002-06-11 at 21:19, Karl wrote:
 Hi!
 
 Does anyone know if there are PyQt v3.x packages for Debian and if so, where?
They are available with apt at:
deb http://asgard.debian.net unstable main

There's an announcement from May 21 about them on this list, so if you
want more information just check the archives.

//Fredrik

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde



RE: [PyKDE] PyKDE and libkdegames

2002-06-12 Thread Jim Bublitz

 On 10-Jun-02 Bjorn Pettersen wrote:
 From: Jim Bublitz [EMAIL PROTECTED]
 
 Basically, there are only a few simple rules for generating sip
 description files (.sip) from C++ headers:

 0a. Delete all methods you don't want to expose to Python
 (although point 5 below still holds).

Very good point. In PyKDE the goal is to expose everything to
Python, but in cases where you just want Python access to parts of
an API, you can save a lot of work by hiding things. Another
example is that in writing an intermediate C++ wrapper and then
writing the bindings to that instead of the base package, you can
expose very little in the h files that are used in binding and
expose nearly everything (to gcc) in the .cpp files of your
wrapper or in h files that aren't visible in the bindings. In the
extreme you can make the bindings' h files and sip files almost
identical.

 0b. Delete all operator overloads (you'll have to write
 %MemberCode to access those).

Yep -- not done in PyKDE.

 1. Delete any forward declarations
 2. Change 'class someClass : public QWidget' to 
 'class someClass : QWidget'

 But only if you have given a definition for QWidget in one of your
 sip files, i.e. there is no need to expose the inheritance
 relationship if it doesn't buy you anything. 

 This can be useful if you're inheriting from a templatized class.

Another very good point - I hadn't tried that explicitly, but it
could prove very useful (in fact there's a couple of places in
PyKDE where that might work).

 A simple example is in kcharsets.sip

kcharsets.sip has %MemberCode examples with lists and static methods
as well as returning an int argument in a tuple - those cover the
majority of cases. intvaluelist.sip is probably a good example of
%MappedType usage (and then grep the PyKDE sip files to see how the
IntValueList type is used to replace a template type).

 7. Anything template based (eg QList QString) will require
 either handwritten code or a %MappedType.

 A simple example is in the PyQt distribution in qpair.sip. Note
 that specific instantiations of a templatized class work fine as
 long as SIP doesn't see the template, e.g:

  ivec.h:

 #include vector
 typedef std::vectorint IntVector;

  ivec.sip:

 class IntVector {
 %HeaderCode
 #include ivec.h
 %End
 public:
 void push_back(int);
 int size();
 };

It's sometimes helpful to keep in mind that sip doesn't look in the
h files at all - it only reads .sip files. You can also augment the
h files with code in the %HeaderCode block in the sip file (there
was an example below but I already snipped it).

 8. Eliminate duplicate typedefs if any
 9. Namespaces need some special handling, mostly in naming
 objects in namespaces - see KParts stuff

 I.e. if subclassing from a class in the same namespace you need to
 prefix with the namespace, e.g:

  namespace foo {

  class A {...};
  class B : foo::A {...};

  };

'A' and 'B' will need the namespace prefix nearly everywhere, even
within the namespace itself:

B.h:

namespace foo
{
class B
{
public:
B ();
B (B);

B*  self () { return this; }
};
};


B.sip:

namespace foo
{
class B
{
%HeaderCode
#include B.h
%End

public:
B ();
B (foo::B);

foo::B* self ();
};
};

I also forgot to mention that any inline code is stripped out too.

Lastly, you can insert SGML docs in the sip files and sip will
produce a concatenated .sgml documentation file with the proper
switches (see either PyQt or PyKDE - kde.sip or kde.sip-in drive
the documentation construction, but the doc text is distributed
over all of the sip files)


Jim

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde



Re: [PyKDE] How do I delete a QCanvasItem?

2002-06-12 Thread Boudewijn Rempt

On Wednesday 12 June 2002 18:32, Stephen Green wrote:
 From: Moray Taylor [EMAIL PROTECTED]

 I think I have figured out how to do it.
 
 MyCanvasItem.setCanvas(None)
 
 It gets rid of it, and seems to free any memory it was using.
 
 Any comments?
 
 Moray

 I tried doing that, and it seems to make the canvas item disappear, but
 shortly thereafter I always get a segmentation fault.  I can't figure out
 why this is happening, since I'm pretty sure I've removed all references to
 the canvas item.
 Any ideas?


If I simply add 

item.setCanvas(None)

after item.show() in the test script I posted earlier, I don't get a 
segfault. It's quite possible that my script is too simple, and that the
segfault occurs only under more complex circumstances. Could you run the
attached file, and see if it segfaults for you?

-- 
Boudewijn Rempt | http://www.valdyas.org

#
# canvas.py
#
import sys
from qt import *
from qtcanvas import *

class cv(QCanvasView):

def __init__(self, *args):
self.canvas = QCanvas(100,100)

QCanvasView.__init__(self, self.canvas, *args)

self.item = QCanvasText(bla, self.canvas)
self.item.move(0,0)
self.item.show()

self.canvas.resize(0, 0)
self.canvas.update()
self.canvas.resize(100, 100)
self.canvas.update()


if __name__ == '__main__':
app = QApplication(sys.argv)
QObject.connect(app, SIGNAL('lastWindowClosed()')
 , app
 , SLOT('quit()')
 )
win = cv()
print win.canvas.allItems()
win.item.setCanvas(None)
del win.item
print win.canvas.allItems()
app.setMainWidget(win)
win.show()
app.exec_loop()



[PyKDE] (no subject)

2002-06-12 Thread gvermeul

Phil,

is it possible to run PyQt on Qt-3.0.4 embedded?

I have cheated:

(1) making a link libqt-mt.so to libqte-mt.so for
the configure scripts
(2) tried to use PyQt-3.0.4-Qtopia (fails because
it expects Qt-2.3.1).
(3) tried to use PyQt-3.0.4-Qt-3.0.4-X11 (fails
because during linking, because it requires HANDLES
to X11 stuff).

If it is possible to let sip generate source code
for Qt-3.0.4 embedded, I can give it a try myself.
If not, can you help me?

Gerard




-
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/


___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde



Re: [PyKDE] (no subject)

2002-06-12 Thread Phil Thompson

[EMAIL PROTECTED] wrote:

 Phil,
 
 is it possible to run PyQt on Qt-3.0.4 embedded?


Not without changes to the .sip files.


 I have cheated:
 
 (1) making a link libqt-mt.so to libqte-mt.so for
 the configure scripts
 (2) tried to use PyQt-3.0.4-Qtopia (fails because
 it expects Qt-2.3.1).
 (3) tried to use PyQt-3.0.4-Qt-3.0.4-X11 (fails
 because during linking, because it requires HANDLES
 to X11 stuff).
 
 If it is possible to let sip generate source code
 for Qt-3.0.4 embedded, I can give it a try myself.
 If not, can you help me?


The way to do it is to grep the .h files for QWS specific changes and 
make corresponding changes to the .sip files. You may also need to add 
Qt3 specific features to versions.sip.

Phil

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde



Re: [PyKDE] How do I delete a QCanvasItem?

2002-06-12 Thread Stephen Green




From: Boudewijn Rempt [EMAIL PROTECTED]
To: Stephen Green [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: [PyKDE] How do I delete a QCanvasItem?
Date: Wed, 12 Jun 2002 22:08:59 +0200

On Wednesday 12 June 2002 18:32, Stephen Green wrote:
  From: Moray Taylor [EMAIL PROTECTED]
 
  I think I have figured out how to do it.
  
  MyCanvasItem.setCanvas(None)
  
  It gets rid of it, and seems to free any memory it was using.
  
  Any comments?
  
  Moray
 
  I tried doing that, and it seems to make the canvas item disappear, but
  shortly thereafter I always get a segmentation fault.  I can't figure 
out
  why this is happening, since I'm pretty sure I've removed all references 
to
  the canvas item.
  Any ideas?
 

If I simply add

   item.setCanvas(None)

after item.show() in the test script I posted earlier, I don't get a
segfault. It's quite possible that my script is too simple, and that the
segfault occurs only under more complex circumstances. Could you run the
attached file, and see if it segfaults for you?

--
Boudewijn Rempt | http://www.valdyas.org
 canvas.py 


Yeah, your code works fine for me. I don't know what the problem is then.

Right now, to delete an item from the canvas, I'm doing the following inside 
my canvas class:

def deleteObject(self, x):
x.setCanvas(None)
self.items.remove(x)
del x
self.update()

Actually it's a bit more complicated than that, but that's the main part.  
Maybe you're right that the segfault only occurs in more complex code...

_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde



Re: [PyKDE] Trying to build PyKDE for KDE 3

2002-06-12 Thread Alex Willmer

On Tuesday 11 June 2002 1:18 am, Jim Bublitz wrote:
 This indicates libkdecore.so (in /opt/kde3/lib) has an undefined
 symbol __ti13KMultipleDrag. If you do:


nm /opt/kde3/lib/libkdecore.so | less


 and then


/__ti13KMultipleDrag


 to search for the symbol (you can grep instead of 'less' too), it
 either shouldn't be there or will have a 'U' next to it. If it's
 there and has an address, something else is wrong. According to the
 same 'nm' line with a -C switch to unmangle the names, the
 corresponding item on my system is defined as a 'type_info
 function'. I don't know what that is for sure or how it gets there,
 so I'm a little at a loss as to how to fix this. Do other Mandrake
 8.2 users have this problem?


 On SuSE (and I assume RH and Debian) this symbol is defined and the
 install/link step works fine.


 The only fix I can think of at the moment is to go to:


PyKDE-3.2.4/sip/kde30/kdecore.sip-in


 and comment out (//) the line


%Include kmultipledrag.sip


 I don't believe anything else references this class. After that
 do:


build -mkdecore


 and recompile (make - only kdecore should recompile, saving you
 about an hour). You shouldn't need to run configure again. These
 kinds of install failures come about because of things missing in
 the KDE libs - I have no idea how that happens, but there are a
 number of things in the .h files that don't make it to the
 libraries. You won't have the KMultipleDrag class with this fix.


Thankyou for the tip, I tried this out and the 'make install' run got a bit 
further, unfortunately another import error occurred. Judicious (although 
very possibly not correct) repetition of the above with the '%Include 
netwm.sip' line, got a little further, but after that the import error gets 
a bit close to the bone.


 My only concern in this case is that the 'type_info' functions
 (whatever they are) are missing as a group, and there are a number
 of them. I can't verify any of this because I don't have a Mandrake
 system, and it works on my systems, so please let me know what
 happens.


Here are the reported errors, both occur during 'make install'. The first is 
after commenting kmultipledrag.sip, the second netwm.sip. Both occur during 
the install-data-hook stage, I can only assume the second refers to the KDE 
Window Manager class constructor.

Traceback (most recent call last):
  File string, line 1, in ?
  File /usr/lib/python2.2/site-packages/kdecore.py, line 40, in ?
import libkdecorec
ImportError: /usr/lib/python2.2/site-packages/libkdecorecmodule.so: 
undefined symbol: virtual_hook__10NETWinInfoiPv

Traceback (most recent call last):
  File string, line 1, in ?
  File /usr/lib/python2.2/site-packages/kdecore.py, line 40, in ?
import libkdecorec
ImportError: /usr/lib/python2.2/site-packages/libkdecorecmodule.so: 
undefined symbol: qt_cast__10KWinModulePCc


 I'll look into this some more and see if I can figure out what a
 'type_info function' is. You might also want to check the libtool
 command line just before the install failure and make sure it has a
 '-L/opt/kde3/lib' and not some other KDE location (like kde2 if
 that's also on your system) - KMultipleDrag is new in 3.0.0. If
 that does occur, you can try adding a


I've had a look at the libtool line in question, it does contain the correct 
library ('-L/opt/kde3/lib'), however it is a relink command, which libtool 
warns of in the preceding line:

libtool: install: warning: relinking `libkdecorecmodule.la'

Presumably this is intentional, but I just thought I should mention it. If 
it is relevant, the full output of the 'make install' stage is at the url 
below:

http://www.alexwillmer.uklinux.net/makeinstall.log

I'm afraid libtool and type_info functions are currently beyond me.

Thanks for taking the time out to help me with this. As an aside. Just some 
further background, in case of rpm screwiness, possibly due to a switch 
from some unofficial texstar kde 3.0.1ish/cvs rpms, to the official 
Mandrake ones while trying to build PyKDE previously (of course rerunning 
configure afterwards) I nuked the build directory and started afresh from 
the 3.2.4 tarball today. It appears that the Mandrake RPMS currently 
available for 3.0.0 report as 3.0.1 in the headers with kdeverison.h 
containing:

#define KDE_VERSION 301
#define KDE_VERSION_STRING 3.0.1 (CVS = 20020327)

I've modified ckversion.py accordingly. To the best of my knowledge, these 
are definitely the 3.0.0 rpms, 'rpm -qf /opt/kde3/include/kdeversion.h' 
reports 'kdelibs3-devel-3.0-10mdk', as found at:

ftp://ftp.kde.org/pub/kde/stable/3.0/Mandrake/8.2/RPMS/i586

So either I've screwed up so well I can't even spot the error, or there is 
something else going on.

Sincerely

Alex
-- 
Alex Willmer
mailto:[EMAIL PROTECTED]

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde



Re: [PyKDE] Trying to build PyKDE for KDE 3

2002-06-12 Thread Jim Bublitz

On 13-Jun-02 Alex Willmer wrote:
 Thankyou for the tip, I tried this out and the 'make install' run
 got a bit further, unfortunately another import error occurred.
 Judicious (although very possibly not correct) repetition of
 the above with the '%Include netwm.sip' line, got a little
 further, but after that the import error gets a bit close to
 the bone.

 I've had a look at the libtool line in question, it does contain
 the correct library ('-L/opt/kde3/lib'), however it is a relink
 command, which libtool warns of in the preceding line:
 
 libtool: install: warning: relinking `libkdecorecmodule.la'

Yes - that's normal.
 
 I'm afraid libtool and type_info functions are currently beyond
 me.

As I posted earlier, I'm still not very enlightened regarding
type_info, but it doesn't appear to be the problem.
 
 Thanks for taking the time out to help me with this. 

We try to give everyone their money's worth, and unfortunately
sometimes that's what you get :)

 As an aside. Just some further background, in case of rpm
 screwiness, possibly due to a switch from some unofficial
 texstar kde 3.0.1ish/cvs rpms, to the official Mandrake ones
 while trying to build PyKDE previously (of course rerunning 
 configure afterwards) I nuked the build directory and started
 afresh from the 3.2.4 tarball today. It appears that the
 Mandrake RPMS currently available for 3.0.0 report as 3.0.1 in
 the headers with kdeverison.h  containing:

#define KDE_VERSION 301
#define KDE_VERSION_STRING 3.0.1 (CVS = 20020327)

Those are the Red Hat rpms, which is what I'd expect for Mandrake.
They definitely are the 3.0.0 version, just mislabeled.
 
 I've modified ckversion.py accordingly. To the best of my
 knowledge, these are definitely the 3.0.0 rpms, 'rpm -qf
 /opt/kde3/include/kdeversion.h' reports'kdelibs3-devel-3.0-10mdk',
 as found at:

 So either I've screwed up so well I can't even spot the error, or
 there is something else going on.

At this point I think there definitely is something else going on.
I've had the RH install (after the version fix) verified, and
another poster verified a Mandrake 8.2 install. The sequence of
errors you're getting doesn't point to any particular code problems
and looks more like a library version problem with something (but
not the 3.0.1 stuff). You'd get these kinds of problems if, for
example, you were linked to Qt1.4.2 instead of Qt3.0.4 (having done
it myself).

I looked at the log file (thanks for posting it!), and don't see a
problem. I'd suggest the following:

1. If you had sip/PyQt installed from Mandrake, get rid of them
(rpm -e). I'm not sure which version they are - if they're pre-3.1,
they have libsip in the wrong place (it should only exist in
python/site-packages now - remove any other versions in /usr/lib,
/usr/local/lib or where-ever). If that was the case, then download
sip and PyQt 3.2.4 from riverbankcomputing.co.uk and
rebuild/re-install. It might also be a good idea to clean all of
the sip/PyQt/PyKDE stuff out of python/site-packages too - maybe
look at libkdecore.la *first* (it's a text file) and see if there's
anything unusual in there (wrong path to libs, etc) sip, PyQt and
PyKDE all need to be 3.2.4 for KDE3.0.0.

2. If the first step doesn't appear to be the problem, you might
want to make sure you have a clean KDE install - check for KDE libs
(other than symlinks) in /usr/lib and other locations other than
/opt/kde3/lib. Also check for libqt and libqt-mt and look for
multiple versions of those (for example libqt.so.2 and libqt.so.3).
If you can, delete and re-install KDE (that's pretty messy on SuSE
because their installer 'yast' depends on KDE - don't know about
Mandrake). Will the PyQt examples run?

Again, the libkdecore.la file in site-packages might provide a hint.
If a necessary lib (like libkdecore or libqt) turns up earlier in
the search path than /opt/kde3/lib or /usr/lib/qt3, it'll get used
instead - I've tried to order things to prevent that, but might not
have eliminated all of the possibilities.

3. Try a clean build of PyKDE - running './configure' again deletes
everything and rebuilds from the ground up. I know it's a long
compile - the next version will be faster, so you might want to wait
for that. I don't think anything will change in the next version
that will affect the problem you're having though. Restore all the
stuff you commented out too (starting with kmutlipledrag.sip) - it
should all work once the real problem is fixed.

I've run into these kinds of problems on my own systems and they
can be very frustrating. The fix is usually simple once you find
the cause. I always appreciate it when people stick with it this
far and am happy to provide any help I can. Personally I think it's
worth it - I've been writing stuff for my own use with PyKDE the
last few weeks and it's really been fun and productive too. 


Jim

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde