A Qui, 2004-06-17 �s 11:41, Gustavo J. A. M. Carneiro escreveu:
> A Qua, 2004-06-16 �s 23:32, Tim Newsham escreveu:
> > Hi,  Is there any way to set the log handler in pygtk?  I couldn't
> > find any.  I did notice a previous related thread on
> > "turning tk warnings into exceptions."   I am interested
> > in altering the default warning logging mechanism.  Currently
> > under windows it forces a console window to open up to
> > emit these warnings.  I know that ideally the code would
> > be warning free, but I still get occasional harmless warnings
> > from gtk and glade.
> 
>   I think pygtk should install a log handler to turn all log messages
> into python warnings.  Then, the pygtk programmer may use the standard
> 'warnings' module to do whatever he wishes to such warnings: hide them,
> turn them to exceptions, show in a text/list widget, etc.
> 
>   If you are interested in this, you should open a bug report in
> bugzilla.gnome.org, product pygtk, type enhancement.  A patch will speed
> up the bug progress, but otherwise I will eventually do this, but it may
> take some time.

  Did this.  All (and only) Gtk warnings now are caught and raised as
python warnings.  The advantage of doing so is that by default python
shows the python source file and line number that caused the warning to
be raised.  Also, warnings can be turned into exceptions or redirected
somewhere else.

  In the future we might want to handle other logging domains, such as
libgnome.  But the Gtk domain is by far the most important one.

  For general logging, I don't think we should wrap g_log_set_handler. 
It duplicates the functionality of the standard python modules
'warnings' and 'logging'.

  I hope no one disagrees with this, because it's done. ;-)

  Regards.

-- 
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
The universe is always one step beyond logic

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to