Re: [PyKDE] Recent convert's comments

2001-01-09 Thread Phil Thompson

Markus Stenberg wrote:
 
 I first tried to get started with 2.2, then hoping for fix to (2) moved to
 2.3pre1.. it didn't address the issue either, so here we go, my comments
 about how PyQt works for me :)
 
 [1] First of all, some (*) classes seem to be missing some methods. No big
 deal, just required some SIP file twiddling to get the pyuic-converted UIs
 working.

I found 9 that were missing from QSlider and they've now been added to
the CVS version. Let me know if there are any more.

 [2] PyQt (and SIP'd stuff in general) explodes _mysteriously_ if you try
 to do multiple inheritance. I understand the reasons behind this, but at
 least _I_ couldn't find any reference to it in PyQt documentation, and
 only way I realized the limitation was by browsing SIP-generated source
 code.

It's been on the TODO list for ages to detect when a programmer tries to
do this. I've added a statement to the docs saying not to do it.

 I wish there was way to support it as well, but guess it's possible to
 live without.. (although life's much more difficult - f.ex when
 implementing custom QSlider-type widget, I wished I could've inherited
 both QWidget and QRangeControl..)

It's impossible to support. You'd have to create a new C++ class (and
the binding to it) dynamically.

 [3] It works like charm! :-) I was pleasantly surprised how easy it was to
 get started with PyQt once the two beforementioned hurdles were taken care
 of. It took me only few hours to write GravityWars-clone.. (roughly 1k
 lines of experimental code to get used to PyQt feel)
 
 (http://www.iki.fi/fingon/trickshot?.gif [? == [123]],
  http://www.iki.fi/fingon/gw.tar.gz, ms.tar.gz)
 
 It seems to be _much_ more fun than vanilla C++ Qt, and the speed is
 sufficient (although not neccessarily blazingly fast, but that's Python to
 you). Keep up the good work! ;-)
 
 -Markus Stenberg
 
 P.S.
  How is the exception handling done? I noted that my application did not
 explode totally from exceptions, but instead it seems that each event?
 performs it's own exception handling, and then resumes event loop on
 exception.

I just use the standard Python exception mechanism. Once you enter the
Qt event loop it then executes bits of Python to respond to events.
Those bits may raise an exception (and are displayed as normal) but the
Qt event loop has no idea they are happening.

Phil

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



Re: [PyKDE] Recent convert's comments

2001-01-09 Thread Phil Thompson

Markus Stenberg wrote:
 
 On Tue, 9 Jan 2001, Phil Thompson wrote:
  Markus Stenberg wrote:
   [2] PyQt (and SIP'd stuff in general) explodes _mysteriously_ if you try
   to do multiple inheritance. I understand the reasons behind this, but at
   least _I_ couldn't find any reference to it in PyQt documentation, and
   only way I realized the limitation was by browsing SIP-generated source
   code.
  It's been on the TODO list for ages to detect when a programmer tries to
  do this. I've added a statement to the docs saying not to do it.
 
 That works, I suppose (i.e. something like assertion if the class cannot
 be converted to desired class).

Actually I've just committed a change to SIP so that an exception is
raised if you try to do it.

   I wish there was way to support it as well, but guess it's possible to
   live without.. (although life's much more difficult - f.ex when
   implementing custom QSlider-type widget, I wished I could've inherited
   both QWidget and QRangeControl..)
  It's impossible to support. You'd have to create a new C++ class (and
  the binding to it) dynamically.
 
 How about having separate 'this' elements? I'm not sure if it would work,
 but I _think_ that by doing _sip_this_classname approach (and also doing
 it for all superclasses, i.e. _sip_QSlider would also have _sip_QWidget,
 _sip_QObject).. I'm not sure about the speed, but I don't think it'd be
 slower except at instantiation time.

It just wouldn't behave as you would expect. With multiple inheritance
you expect to end up with a single instance of a Qt class. What you are
suggesting is really composition trying to be inheritance. It would be
much better to be honest about it, inherit from one only and create an
instance of the second explicitly in the ctor.

Phil

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