Re: [PyQt] Designer source

2012-03-08 Thread Andreas Pakulat
On 07.03.12 16:14:18, JPolk wrote:
 
 ...'cause it would make it easier for me to merge Designer with Maya ;-)

Write Maya in C++ ;P

Andreas

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Designer source

2012-03-08 Thread Andreas Pakulat
On 08.03.12 09:35:51, Andreas Pakulat wrote:
 On 07.03.12 16:14:18, JPolk wrote:
  
  ...'cause it would make it easier for me to merge Designer with Maya ;-)
 
 Write Maya in C++ ;P

Hmm, on a more serious note, you won't get around writing C++. AFAIK the
public API of the QtDesigner library (and hence also the PyQt module)
does not include the necessary functions to actually create a designer
yourself. One needs to use one or two private headers from QtDesigner
for the necessary functions. You could of course simply wrap that
private API in a simple class and expose that via sip to Python and then
do all the rest in Python.

Andreas

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] sip: Member objects and GC

2012-03-08 Thread Phil Thompson
On Wed, 07 Mar 2012 20:09:36 +0100, Jonathan Kleinehellefort j...@molb.org
wrote:
 Thanks, I tried it.  Now, instead of being destroyed early, the object
 is never destroyed, which I believe means that it leaks memory.  Maybe
 you created a reference cycle?

Even if there is a reference cycle the garbage collector should break it
if it is being allowed to run. Any test should explicitly invoke it.

Can you provide such a test that demonstrates the problem?

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] New member (Drag and Drop)

2012-03-08 Thread Shoemaker, Ronnie A (N-UNITED SPACE ALLIANCE, LLC)
Okay, I will narrow the scope of this question for now.

I am playing with the draggablewidgets demo in PyQt4. What is the secret to 
getting different images into that app or how do I create a PNG image that it 
will load?

From: Shoemaker, Ronnie A (N-UNITED SPACE ALLIANCE, LLC)
Sent: Wednesday, March 07, 2012 1:52 PM
To: 'pyqt@riverbankcomputing.com'
Subject: New member

Hi. I am a new member of this mailing list. I am writing a GUI in PyQt4 that 
will use drag and drop of images to put a simulation together.
I found one drag and drop example that uses QLabels loaded with png files.  I 
need to be able to draw my own images or at least load other types onto my GUI.
I found some .ico files and tried to load them and they didn't work. I even 
loaded them into MS Paint and saved them as PNG files and they didn't load and 
gave no error message. Where can I find a tutorial or examples on how to do 
drag and drop and/or what I need to know about images to do that?  I can start 
with pictures as simple as geometric shapes, rectangle, triangle, etc.  I have 
done lots of googling and info that is either too specific or too general.

Thanks,
Ron

--
ronnie.a.shoema...@lmco.commailto:ronnie.a.shoema...@lmco.com

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Designer source

2012-03-08 Thread Detlev Offenbach
Am Donnerstag, 8. März 2012, 09:49:41 schrieb Andreas Pakulat:
 On 08.03.12 09:35:51, Andreas Pakulat wrote:
  On 07.03.12 16:14:18, JPolk wrote:
   ...'cause it would make it easier for me to merge Designer with Maya
   ;-) 
  Write Maya in C++ ;P
 
 Hmm, on a more serious note, you won't get around writing C++. AFAIK the
 public API of the QtDesigner library (and hence also the PyQt module)
 does not include the necessary functions to actually create a designer
 yourself. One needs to use one or two private headers from QtDesigner
 for the necessary functions. You could of course simply wrap that
 private API in a simple class and expose that via sip to Python and then
 do all the rest in Python.

If somebody would do that and maintain it over time I would be the first to 
use to integrate Designer into the eric IDE.

Regards,
Detlev
-- 
Detlev Offenbach
det...@die-offenbachs.de
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Designer source

2012-03-08 Thread Andreas Pakulat
On 08.03.12 19:42:39, Detlev Offenbach wrote:
 Am Donnerstag, 8. März 2012, 09:49:41 schrieb Andreas Pakulat:
  On 08.03.12 09:35:51, Andreas Pakulat wrote:
   On 07.03.12 16:14:18, JPolk wrote:
...'cause it would make it easier for me to merge Designer with Maya
;-) 
   Write Maya in C++ ;P
  
  Hmm, on a more serious note, you won't get around writing C++. AFAIK the
  public API of the QtDesigner library (and hence also the PyQt module)
  does not include the necessary functions to actually create a designer
  yourself. One needs to use one or two private headers from QtDesigner
  for the necessary functions. You could of course simply wrap that
  private API in a simple class and expose that via sip to Python and then
  do all the rest in Python.
 
 If somebody would do that and maintain it over time I would be the first to 
 use to integrate Designer into the eric IDE.

Its not an easy task though, we had something somewhat-working for
KDevelop4 in a plugin, but it did require some nasty hacks and
workarounds the designer API. Its simply not really meant to be added to
arbitrary IDE's, but mainly geared towards the designer standalone
app.

Note, I'm basing that information on Qt4.5/4.6, i.e. a point in time
where QtCreator was still in its early stages. Maybe in more recent
Qt versions this got improved to provide better integration for
QtCreator.

Andreas

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] sip: Member objects and GC

2012-03-08 Thread Jonathan Kleinehellefort
On Thu, 08 Mar 2012 10:03:46 +, Phil Thompson p...@riverbankcomputing.com 
wrote:
 Even if there is a reference cycle the garbage collector should break it
 if it is being allowed to run. Any test should explicitly invoke it.

Not sure if this applies here, but I think the Python GC will not call
destructors on objects that are part of a reference cycle.  So maybe the
Python wrappers get collected but not the C++ objects.

 Can you provide such a test that demonstrates the problem?

You can already see it in the original test I put up on my webserver.
But I updated it to make it more explicit:

http://molb.org/~jk/siptest2.tar.gz

The C++ objects have destructors that should print stuff, but that never
happens.

Another thing: it would be nice if sipKeepReference() would appear in the
docs.

 -- Jonathan
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] sip: Member objects and GC

2012-03-08 Thread Phil Thompson
On Thu, 08 Mar 2012 23:14:49 +0100, Jonathan Kleinehellefort j...@molb.org
wrote:
 On Thu, 08 Mar 2012 10:03:46 +, Phil Thompson
 p...@riverbankcomputing.com wrote:
 Even if there is a reference cycle the garbage collector should break
it
 if it is being allowed to run. Any test should explicitly invoke it.
 
 Not sure if this applies here, but I think the Python GC will not call
 destructors on objects that are part of a reference cycle.  So maybe the
 Python wrappers get collected but not the C++ objects.

No. The GC won't collect objects with __del__ methods.

 Can you provide such a test that demonstrates the problem?
 
 You can already see it in the original test I put up on my webserver.
 But I updated it to make it more explicit:
 
 http://molb.org/~jk/siptest2.tar.gz
 
 The C++ objects have destructors that should print stuff, but that never
 happens.

...because the GC isn't being run. Import the gc module and run it
explicitly.

 Another thing: it would be nice if sipKeepReference() would appear in
the
 docs.

It's not part of the public API.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] New member (Drag and Drop)

2012-03-08 Thread David Boddie
On Thu Mar 8 15:59:20 GMT 2012, Shoemaker, Ronnie A wrote:

 Okay, I will narrow the scope of this question for now.

 I am playing with the draggablewidgets demo in PyQt4. What is the secret to
 getting different images into that app or how do I create a PNG image that
 it will load?

First, make sure that the images can be loaded by PyQt4 by trying to load
them into the imageviewer.py example.

If that works, modify the draggableicons.qrc file to refer to your new
images and run the pyrcc4 tool to create a draggableicons_rc.py file.
The pyrcc4 tool basically converts the image data into a textual format that
can be stored in that Python module.

The example imports the module, causing the images to be registered as
resources - the ':/images/boat.png' string you can see in the
draggableicons.py example is a reference to the image in a kind of resource
file system. You need to update these strings to refer to your images.

Good luck!

David
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt