On Mon, Mar 19, 2012 at 10:08 PM, Pierre Raybaut
<pierre.rayb...@gmail.com> wrote:
> Hi all,
>
> Is anyone interested in including the Matplotlib QtDesigner plugin
> which I wrote for Python(x,y)?
>
> The code is quite simple and hasn't evolved for a while now (3 years)
> but apparently it is still appreciated by users even outside
> Python(x,y).
>
> Here are the two files which are necessary to make this plugin work:
> http://code.google.com/p/pythonxy/source/browse/src/python/matplotlib/QtDesigner_Plugins/matplotlibwidget.py
> http://code.google.com/p/pythonxy/source/browse/src/python/matplotlib/QtDesigner_Plugins/PyQt4/plugins/designer/python/matplotlibplugin.py
>
> The directory struture also has its importance:
> http://code.google.com/p/pythonxy/source/browse/#hg%2Fsrc%2Fpython%2Fmatplotlib%2FQtDesigner_Plugins
>
> Cheers,
> Pierre

I have been looking at the matplotlib widget code.  It is very helpful
for putting a widget inside PyQt4 windows.  However, it is lacking any
signals and slots to let you easily connect other Qt4 widgets with the
matplotlib one.  Particularly in Qt Designer, using signals and slots
to connect widgets together is very convenient.

I am willing to implement signals and slots, but I need some advice on
the best approach. So far I see three different approaches that may
work:

1. The simplest is just to manually add slots for common commands in
the widget.  I would also probably add some signals for things like
mouse clicks.  However, this requires manually creating the signals
and slots, and will break if matplotlib changes any of its api.  I
would also need to decide whether to use the matplotlib function
naming rules or the Qt4 ones (or both, since I can give the same
signal multiple names).

2. Integrate the signals and slots directly into matplotlib.  This
would probably involve somehow having matplotlib functions exposed as
signals and/or slots, probably somewhere in the PyQt4/pyside backend.
It would probably entail separating the PyQt4/pyside backend into a
PyQt4/pyside widget and a PyQt4/pyside window that contains that
widget.  All the interaction between settings, buttons, etc would use
signals and slots internally.  Users could then use the widget in
other contexts besides the window, and use the same signals and slots
the window uses.  This would also eliminate the need for a separate
widget to be used for Qt Designer. It would still require manually
specifying the signals and slots. I haven't looked in much detail, but
this is probably not that much more difficult than 1.

3. Make PyQt4 backend use widgets for everything.  Each object would
have all of its functions exposed as signals and slots, and all would
be usable in Qt Designer.  If I understand it correctly, the PyQt4
backend uses Agg for the actual painting, so this would require
implementing an entire new backend, so is probably not a good choice
initially.

Either approach would be

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to