Scott Maddox | 9 Jul 2012 06:52
Picon

Embed Veusz in a PySide window?

Hi all,


I'm planning on writing an application for collecting and plotting experimental data, and I'm thinking about using Veusz as the plotting backend due to the ease of user interaction. However, after spending all day trying to setup a development environment with all the requirements, I've given up. I much prefer using the enthought python distribution, which leaves me with PySide or wxWidgets. So, the question is: can Veusz be embedded in a PySide window, similar to a PyQt window? Since they just use different python bindings to the same c++ package, I feel like it should be possible.

I know Veusz can be embedded into any python application, but it seems from the example, that the window must always be standalone. Since I want to integrate the plotting canvas into the application, this is sub-optimal.

Any clarification on embedding, and possible compatibility with PySide would be very helpful.

Thanks,
Scott
_______________________________________________
Veusz-discuss mailing list
Veusz-discuss@...
https://mail.gna.org/listinfo/veusz-discuss
Jeremy Sanders | 11 Jul 2012 21:17
Gravatar

Re: Embed Veusz in a PySide window?

Hi Scott

On 09/07/12 05:52, Scott Maddox wrote:

> I'm planning on writing an application for collecting and plotting
> experimental data, and I'm thinking about using Veusz as the plotting
> backend due to the ease of user interaction. However, after spending all
> day trying to setup a development environment with all the requirements,
> I've given up. I much prefer using the enthought python distribution, which
> leaves me with PySide or wxWidgets. So, the question is: can Veusz be
> embedded in a PySide window, similar to a PyQt window? Since they just use
> different python bindings to the same c++ package, I feel like it should be
> possible.
 >
> I know Veusz can be embedded into any python application, but it seems from
> the example, that the window must always be standalone. Since I want to
> integrate the plotting canvas into the application, this is sub-optimal.

To have the canvas inside your own window, Veusz needs to be sharing the 
same version of Qt as your app. You'd need to have PyQt available for 
Veusz and PySide for your application. I don't know whether it would be 
possible for these to coexist in any way as the Python versions of the 
Qt objects wouldn't be compatible. You'd need to have some way to 
convert the PyQt Qt objects to PySide Qt objects. I can't see it 
working. You'd need to have PyQt and PySide compiled anyway.

Now, it probably would be possible to get Veusz running under PySide 
rather than PyQt. The difficult bits are:

1. Veusz uses PyQt.uic.loadUi. I'm not sure PySide provides this - maybe 
easy to fix 
http://lists.pyside.org/pipermail/pyside/2010-December/001580.html

2. Veusz uses SIP to wrap some C++ code to speed up slow parts. This is 
the hard part. Most of Veusz runs ok without this, just slowly, but some 
features don't work. I don't know how much work it would be to convert 
this to whatever PySide uses to wrap Qt-based code.

An alternative might be to use the binary version of Veusz as a backend 
to produce bitmaps which you can render to your PySide based canvas.

Jeremy

Gmane