Browse Source

Enable warnings as errors; show exception messages.

master
Julio Biason 15 years ago
parent
commit
755065359c
  1. 26
      mitterlib/ui/ui_pygtk.py

26
mitterlib/ui/ui_pygtk.py

@ -26,6 +26,7 @@ import logging
import urllib2
import gettext
import datetime
import warnings
from mitterlib.ui.helpers.image_helpers import find_image
from mitterlib.ui.helpers.gtk_threading import ThreadManager
@ -801,11 +802,11 @@ class Interface(object):
"""Function called if the retrival of current messages returns an
exception."""
_log.debug(str(exception))
message = _('%s\nAuto-refresh is now disabled. Use the "refresh" ' \
'option to re-enable it.') % (str(exception))
error_win = gtk.MessageDialog(parent=self._main_window,
type=gtk.MESSAGE_ERROR,
message_format=_('Error retrieving current messages. ' \
'Auto-refresh disabled. Use the "Refresh" option ' \
'to re-enable it.'),
message_format=_message,
buttons=gtk.BUTTONS_OK)
error_win.run()
error_win.hide()
@ -902,10 +903,10 @@ class Interface(object):
"""Called when there is an exception updating the status."""
_log.debug('Update error')
_log.debug(str(exception))
message = _('%s\nPlease, try again.') % (message)
error_win = gtk.MessageDialog(parent=self._main_window,
type=gtk.MESSAGE_ERROR,
message_format=_('Error updating your status. Please ' \
'try again.'),
message_format=message,
buttons=gtk.BUTTONS_OK)
error_win.run()
error_win.hide()
@ -928,6 +929,12 @@ class Interface(object):
"""Called when the message cannot be deleted."""
_log.debug('Delete error')
_log.debug(str(exception))
error_win = gtk.MessageDialog(parent=self._main_window,
type=gtk.MESSAGE_ERROR,
message_format=str(exception),
buttons=gtk.BUTTONS_OK)
error_win.run()
error_win.hide()
return
### Results for the repost message call
@ -944,8 +951,7 @@ class Interface(object):
error_win = gtk.MessageDialog(parent=self._main_window,
type=gtk.MESSAGE_ERROR,
message_format=_('Error reposting message. Please ' \
'try again.'),
message_format=str(exception),
buttons=gtk.BUTTONS_OK)
error_win.run()
error_win.hide()
@ -969,8 +975,7 @@ class Interface(object):
error_win = gtk.MessageDialog(parent=self._main_window,
type=gtk.MESSAGE_ERROR,
message_format=_('Error changing favorite status of the ' \
'message. Please, try again.'),
message_format=str(exception),
buttons=gtk.BUTTONS_OK)
error_win.run()
error_win.hide()
@ -1018,6 +1023,9 @@ class Interface(object):
"""Call function; displays the interface. This method should
appear on every interface."""
# turn warnings into exception (so we can catch them)
warnings.simplefilter('error')
if self._options[self.NAMESPACE]['statusicon']:
self._statusicon = gtk.StatusIcon()
self._statusicon.set_from_pixbuf(self._images['icon'])

Loading…
Cancel
Save