First cut on a QtAgg backend

Hi,
I have written a basic QtAgg backend for Matplot-lib. It is only tested
on Windows, so some more testing should be done, but it is my hope that
it can some day be included in the matplotlib distribution. I will test
on linux when I get the time, but all the code is python so it should
probably work ok.

See http://www.tjora.no/python/matplotlib/ for the code.

Most examples run ok, but the keypress_demo.py does not work yet. Not
all examples have been tested, just some random double-clicking on the
one that look interesting.

A lot of the comments from the backend_template.py has not been removed
or fixed. The code is also somewhat rough around the edges, but it works.

Is there any unittest-suite it is possible to run the backend against?

Feedback is welcome.

Best regards,
Sigve Tjora

Well done. I tried it out on Linux (Fedora 3) and it works reasonably
well.

I noticed a few things:
It puts the toolbar at the top rather than the bottom of the window.

The graph is smaller and the colours are different than that produced
with GTKAgg, which is strange since they both use Agg rendering.

I think it would be better to have a 'backend_qt.py' file used as a base
class (with a FigureCanvasQtAgg.draw() method that raises
NotImplementedError), and with backend_qtagg.py overriding just those
functions/methods which are specific to drawing using Agg. This would
allow backend_qt.py code to be used to produce a QtCairo backend at a
later date.

I copied the file into cvs so other people can try it out.

Regards
Steve

ยทยทยท

On Fri, 2005-01-28 at 21:36 +0100, Sigve Tjora wrote:

Hi,
I have written a basic QtAgg backend for Matplot-lib. It is only tested
on Windows, so some more testing should be done, but it is my hope that
it can some day be included in the matplotlib distribution. I will test
on linux when I get the time, but all the code is python so it should
probably work ok.

Steve Chaplin skrev:

Well done. I tried it out on Linux (Fedora 3) and it works reasonably
well.

Thats nice.

I noticed a few things:
It puts the toolbar at the top rather than the bottom of the window.

Fix by changing in NavigationToolbar2QtAgg.__init:

        qt.QToolBar.__init__(self, qt.QString(""), window, qt.Qt.DockTop)

to

        qt.QToolBar.__init__(self, qt.QString(""), window, qt.Qt.DockBottom)

The graph is smaller and the colours are different than that produced
with GTKAgg, which is strange since they both use Agg rendering.

Colors are fixed in CVS, i think.

I think it would be better to have a 'backend_qt.py' file used as a base
class (with a FigureCanvasQtAgg.draw() method that raises
NotImplementedError), and with backend_qtagg.py overriding just those
functions/methods which are specific to drawing using Agg. This would
allow backend_qt.py code to be used to produce a QtCairo backend at a
later date.

I agree, but have not time to do it right now.

Regards,
Sigve