From: John H. <jdh...@ac...> - 2004-08-19 12:22:04
|
>>>>> "Sigve" == Sigve Tjora <pu...@tj...> writes: Sigve> Hi everyone, Is there any planned support for a Qt-backend? Sigve> We are using Qt in our project, and I would like to use Sigve> Matplot lib for plotting. Sigve> If there is not any support for Qt how hard would it be to Sigve> make it myself? Would it be best to base it on the Agg Sigve> backend, or should I make a native Qt backend? What is the Sigve> least work? Is it possible to write the whole backend in Sigve> Python or should I use C++ in addition? Currently there is no QT backend, or one in the works, but it would be nice. It is definitely much easier to base it on the agg backend and is in fact *strongly encouraged* as that minimizes the amount of maintenance required. Using C/C++ is an optional step. TkAgg and GTKAgg use it to get the optimal transfer speed from the agg image to the GUI canvas. WXAgg and FLTKAgg do not use it, and Gregory reports great performance for FLTKAgg. WXAgg uses string methods to transfer the image and FLTKAgg uses a python buffer object. I encourage you to try and use a python buffer object (or string method) as opposed to extension code in the beginning since it's easier to write and maintain, it will introduce no extra compile time dependencies, and in the event that you find it too slow and want to write an extension to speed things up, you'll have the pure python method to fall back on for users who can't get the extension compiled. matplotlib.backends.backend_template contains the basic documentation for backend writers. But this code does a lot more than you need, since agg will be doing the drawing; ie you don't need to implement a renderer or graphics context. I recommend you give it a read through, and then follow the lead of backend_fltkagg. I also advise you not to implement the classic navigation toolbar (at least not until later) because the new toolbar design is not only better (in my opinion), it's currently the default and most importantly, is much easier to implement since all the work is done for you in backend bases. You basically need to load up some images into a toolbar and get the signal connections right. In the event you need a different pixel format to transfer the agg image to the qt canvas, that will be no problem. I will be glad to add it for you or you can add it yourself to backend_agg. The only thing I ask of submitters is that if you want your backend to be included with the matplotlib distribution, please be responsible for testing it across the major platforms the GUI should run on (eg linux, win32, and OSX), provide some install instructions, version dependencies, etc, for the documentation, and monitor the mailing lists to handle questions about your backend. In a nutshell, I need you to maintain it. If you don't have the time to maintain it but want to write one anyway for your own work, I would be happy to provide a link to it with a disclaimer that users are on their own. Good luck if you decide to do it, and let me know if I can help. JDH |