error handling cleanup

error_msg and verbose.report_error are banished. In their place use
exceptions and warnings.warn. I ported all existing matplotlib
frontend and backend code, but please check your respective backends
and diff them against 0.72 to make sure you agree with what I did.

I left error_msg_gtk, error_msg_wx and friends for internal backend
use (they aren't imported or used in any other part of mpl code).
Thus proper (in my view) uses like

    agg = self.switch_backends(FigureCanvasAgg)
    try: agg.print_figure(filename, dpi, facecolor, edgecolor, orientation)
    except IOError, msg:
        error_msg_gtk('Failed to save\nError message: %s'%(msg,), self)

are still in the code base.

Hope this removes one source of confusion. If people think we need to
layer some more sophisticated error handling on top of this, I'm open.
But at least we are now starting from a clean slate with exceptions
used consistently throughout.

JDH

John,
This sounds great! Let me know if you need any help from us.

FYI: here is the fix for the Qt front end status bar not having an initial message (so it doesn't appear until a message is displayed).

In backend_qt.py, add this line to the ctor for NavigationToolbar2QT:

self.window.statusBar.message( " " )

so the ctor looks like this:
     def __init__( self, canvas, window ):
         self.window = window
         self.canvas = canvas

         qt.QToolBar.__init__( self, "Navigator2", window, qt.Qt.DockBottom )
         NavigationToolbar2.__init__( self, canvas )

         # If we don't do this, the status bar is hidden until needed.
         self.window.statusBar.message( " " )

Ted

···

At 07:40 AM 2/15/2005, John Hunter wrote:

error_msg and verbose.report_error are banished. In their place use
exceptions and warnings.warn. I ported all existing matplotlib
frontend and backend code, but please check your respective backends
and diff them against 0.72 to make sure you agree with what I did.

I left error_msg_gtk, error_msg_wx and friends for internal backend
use (they aren't imported or used in any other part of mpl code).
Thus proper (in my view) uses like

    agg = self.switch_backends(FigureCanvasAgg)
    try: agg.print_figure(filename, dpi, facecolor, edgecolor, orientation)
    except IOError, msg:
        error_msg_gtk('Failed to save\nError message: %s'%(msg,), self)

are still in the code base.

Hope this removes one source of confusion. If people think we need to
layer some more sophisticated error handling on top of this, I'm open.
But at least we are now starting from a clean slate with exceptions
used consistently throughout.

JDH

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel