Re: [PyKDE] eric3, qscintilla and code folding

2005-10-18 Thread Brad Ralph
Hi All, I am hoping someone can jump in here and help (Detlev?). Please ??? I thought I would have a go at implementing the kind on functionality that I was after but don't seem to be able to get it to work correctly. I thought that I would try the straight forward logical approach which is

[PyKDE] PyQt C API

2005-10-18 Thread Toby Dickenson
I am considering translating a few functions of our large PyQt application to C (or, probably, pyrex) as a performance optimisation, but I have stumbled at the first hurdle. How do you convert a PyObject pointer to a PyQt object into a pointer to the Qt C++ object? Thanks in advance, -- Toby

Re: [PyKDE] PyQt C API

2005-10-18 Thread Giovanni Bajo
Toby Dickenson [EMAIL PROTECTED] wrote: I am considering translating a few functions of our large PyQt application to C (or, probably, pyrex) as a performance optimisation, but I have stumbled at the first hurdle. How do you convert a PyObject pointer to a PyQt object into a pointer to the Qt

[PyKDE] PyQt C API

2005-10-18 Thread elho
When I understand your question right, this example will be the answer. PyObject*myPyType; // convert a PyObject pointer to MyPythonType-Pointer object // cppType will be the known CPP-Type which is the base of MyPythonType myPyType = sipBuildResult(NULL,M,cppType,sipClass_MyPythonType)

Re: [PyKDE] eric3, qscintilla and code folding

2005-10-18 Thread Brad Ralph
Hi Baz, Thanks for your suggestion it was very helpful. I tried Ctrl-clicking the class fold marker and as you suggest it colapses all of the child folds. I also tried the Ctrl and Shift but this is the same as the toggle all folds menu option (class gets folded but the children don't).

Re: [PyKDE] PyQt C API

2005-10-18 Thread Jim Bublitz
On Tuesday 18 October 2005 01:44, elho wrote: When I understand your question right, this example will be the answer. PyObject*myPyType; // convert a PyObject pointer to MyPythonType-Pointer object // cppType will be the known CPP-Type which is the base of MyPythonType myPyType =

Re: [PyKDE] PyQt C API

2005-10-18 Thread Phil Thompson
On Tuesday 18 October 2005 5:39 pm, Jim Bublitz wrote: On Tuesday 18 October 2005 00:44, Toby Dickenson wrote: I am considering translating a few functions of our large PyQt application to C (or, probably, pyrex) as a performance optimisation, but I have stumbled at the first hurdle. How do

[PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Phil Thompson
I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. At the moment Python strings and unicode strings are automatically converted to QStrings when passed as arguments - so there would be no change there. If a QString was returned by a method or an

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread İsmail Dönmez
On Tuesday 18 October 2005 20:24, Phil Thompson wrote: I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. At the moment Python strings and unicode strings are automatically converted to QStrings when passed as arguments - so there would be no change

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Phil Thompson
On Tuesday 18 October 2005 6:41 pm, Patrick K. O'Brien wrote: Phil Thompson wrote: I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. Sounds good to me. Any word on when we might expect a functioning PyQt4? I don't know about anyone else, but I'm

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread İsmail Dönmez
On Tuesday 18 October 2005 20:45, you wrote: İsmail Dönmez wrote: I very much like QString's api like endsWith instead of endswith. Its small but in the end all those small things matter :) Not to pick a fight or anything, but how is this an advantage? Is it the case that you don't do

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Yann Cointepas
Le Mardi 18 Octobre 2005 19:24, Phil Thompson a écrit : I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. Would it mean that QString content would always be copied when used in Python ? If yes, copying a QString from a widget to another (for example

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Patrick Stinson
I don't see how losing QString would cause any problems. I always convert QString objects immediately to a python string using str(). Would it reduce code bloat? It seems like there should be a rule here. If certain methods take python lists as arguments in place of QStringList or return a

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Jim Bublitz
On Tuesday 18 October 2005 10:24, Phil Thompson wrote: I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. At the moment Python strings and unicode strings are automatically converted to QStrings when passed as arguments - so there would be no change

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Giovanni Bajo
Phil Thompson [EMAIL PROTECTED] wrote: At the moment Python strings and unicode strings are automatically converted to QStrings when passed as arguments - so there would be no change there. If a QString was returned by a method or an operator then a unicode string would be returned instead.

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Baz Walter
On Tuesday 18 Oct 2005 18:24, Phil Thompson wrote: I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. At the moment Python strings and unicode strings are automatically converted to QStrings when passed as arguments - so there would be no change

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Robert Jonsson
Hi, On Tuesday 18 Oct 2005 19:24, Phil Thompson wrote: I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. At the moment Python strings and unicode strings are automatically converted to QStrings when passed as arguments - so there would be no change

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Simon Edwards
On Tuesday 18 October 2005 20:01, Yann Cointepas wrote: Le Mardi 18 Octobre 2005 19:24, Phil Thompson a écrit : I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. Would it mean that QString content would always be copied when used in Python ? If

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Patrick Stinson
Yes. Ideally a string would always just be a string; a string should not be a string and this other thing, too. A list should be a list, not a list and a list that can only hold this other thing, too. On Oct 18, 2005, at 11:53 AM, Simon Edwards wrote: On Tuesday 18 October 2005 20:01,

Re: [PyKDE] segfault using hasattr on a wrappertype class

2005-10-18 Thread Giovanni Bajo
Phil Thompson [EMAIL PROTECTED] wrote: It will be fixed in tonight's snapshot. It will now raise an exception saying that Foo should be derived from sip.wrapper. If you change it so it is, hasattr() returns False as expected. I have not tried that snapshot yet. Anyway, I noticed this

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Giovanni Bajo
Simon Edwards [EMAIL PROTECTED] wrote: Would it mean that QString content would always be copied when used in Python ? If yes, copying a QString from a widget to another (for example widget1.setCaption( widget2.caption() ) ) would lead to an unnecessary copy. True, but how often do you copy

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Torsten Marek
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Phil Thompson schrieb: I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. At the moment Python strings and unicode strings are automatically converted to QStrings when passed as arguments - so there

Re: [PyKDE] segfault using hasattr on a wrappertype class

2005-10-18 Thread Phil Thompson
On Tuesday 18 October 2005 9:13 pm, Giovanni Bajo wrote: Phil Thompson [EMAIL PROTECTED] wrote: It will be fixed in tonight's snapshot. It will now raise an exception saying that Foo should be derived from sip.wrapper. If you change it so it is, hasattr() returns False as expected. I

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Simon Edwards
On Tuesday 18 October 2005 22:42, Giovanni Bajo wrote: Simon Edwards [EMAIL PROTECTED] wrote: Would it mean that QString content would always be copied when used in Python ? If yes, copying a QString from a widget to another (for example widget1.setCaption( widget2.caption() ) ) would

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Giovanni Bajo
Simon Edwards [EMAIL PROTECTED] wrote: I'm not saying it happens often. I'm saying that we the proposed change it would be *impossible* to do it. On the other hand, with the current interface it is possible to do exactly what you want, it is just a little less convenient for the common case.

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Simon Edwards
On Tuesday 18 October 2005 23:24, Giovanni Bajo wrote: Simon Edwards [EMAIL PROTECTED] wrote: I'm not saying it happens often. I'm saying that we the proposed change it would be *impossible* to do it. On the other hand, with the current interface it is possible to do exactly what you want,

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Yann Cointepas
Le Mardi 18 Octobre 2005 21:53, Simon Edwards a écrit : On Tuesday 18 October 2005 20:01, Yann Cointepas wrote: Le Mardi 18 Octobre 2005 19:24, Phil Thompson a écrit : I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. Would it mean that

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Andreas Pakulat
On 18.10.05 23:59:56, Yann Cointepas wrote: If it means that the too few people that may care about the copy cost should be ignored then QString can be dropped. However, there is a simple case where the copy can be a problem. I use QTextEdit in a kind of log system (adding text line by

Re: [PyKDE] segfault using hasattr on a wrappertype class

2005-10-18 Thread Giovanni Bajo
Phil Thompson [EMAIL PROTECTED] wrote: behaviour: import sip isinstance(sip.wrapper, object) True issubclass(sip.wrapper, object) True Dunno if it's related to the fix. Why is it strange? It's uncommon for an object to both be an instance *and* a subclass of a given class. What

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Giovanni Bajo
Simon Edwards [EMAIL PROTECTED] wrote: You don't care, I care. Don't do the mistake of thinking that your needs are the same of everyone else. So, why _do_ you care? What's the issue or problem you have in mind? The best example I can think of involves the XML parser in Qt (assuming Phil

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Nigel Stewart
You don't care, I care. Don't do the mistake of thinking that your needs are the same of everyone else. So, why _do_ you care? What's the issue or problem you have in mind? We also care - we're storing the majority of our data in C++ containers of QString. Deep copying from QString -

Re: [PyKDE] eric3, qscintilla and code folding

2005-10-18 Thread Baz Walter
On Tuesday 18 Oct 2005 14:36, Brad Ralph wrote: Hi Baz, Thanks for your suggestion it was very helpful. I tried Ctrl-clicking the class fold marker and as you suggest it colapses all of the child folds. I also tried the Ctrl and Shift but this is the same as the toggle all folds menu

[PyKDE] Re: QString in PyQt4 - Request for Comments

2005-10-18 Thread Michael Thompson
Phil Thompson wrote: I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. At the moment Python strings and unicode strings are automatically converted to QStrings when passed as arguments - so there would be no change there. If a QString was returned by

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread David Boddie
On Tue, 18 Oct 2005 18:24:08, Phil Thompson wrote: I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. On one hand, it sounds like a nice idea. It would mean that you don't have to think about manually converting the ones you think you'll need and

Re: [PyKDE] QString in PyQt4 - Request for Comments

2005-10-18 Thread Gerard Vermeulen
On Tue, 18 Oct 2005 18:24:08 +0100 Phil Thompson [EMAIL PROTECTED] wrote: I'm wondering whether QString should be dropped in PyQt4 in order to make it more Pythonic. At the moment Python strings and unicode strings are automatically converted to QStrings when passed as arguments - so