Browse Source

Disable auto-refresh on error; show something in case of net operations fail

master
Julio Biason 15 years ago
parent
commit
0db021d210
  1. 39
      mitterlib/ui/ui_pygtk.py

39
mitterlib/ui/ui_pygtk.py

@ -624,12 +624,6 @@ class Interface(object):
self._exception_get_messages, self._exception_get_messages,
self._connection.messages) self._connection.messages)
# queue the next auto-refresh
interval = self._options[self.NAMESPACE]['refresh_interval']
_log.debug('Queueing next refresh in %d minutes', interval)
self._refresh_id = gobject.timeout_add(
interval * 60 * 1000,
self._refresh, None)
return return
def _clear_reply(self): def _clear_reply(self):
@ -910,12 +904,30 @@ class Interface(object):
store.prepend([message]) store.prepend([message])
store.sort_column_changed() store.sort_column_changed()
self._grid.queue_draw() self._grid.queue_draw()
# once our update went fine, we can queue the next one. This avoids
# any problems if case there is an exception.
interval = self._options[self.NAMESPACE]['refresh_interval']
_log.debug('Queueing next refresh in %d minutes', interval)
self._refresh_id = gobject.timeout_add(
interval * 60 * 1000,
self._refresh, None)
return return
def _exception_get_messages(self, widget, exception): def _exception_get_messages(self, widget, exception):
"""Function called if the retrival of current messages returns an """Function called if the retrival of current messages returns an
exception.""" exception."""
_log.debug(str(exception)) _log.debug(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.',
buttons=gtk.BUTTONS_OK)
error_win.run()
error_win.hide()
self._update_statusbar('Auto-update disabled')
return return
### image download function ### image download function
@ -966,6 +978,13 @@ class Interface(object):
# TODO: Need the check the type of exception we got. # TODO: Need the check the type of exception we got.
_log.debug('Update error') _log.debug('Update error')
_log.debug(str(exception)) _log.debug(str(exception))
error_win = gtk.MessageDialog(parent=self._main_window,
type=gtk.MESSAGE_ERROR,
message_format='Error updating your status. Please ' \
'try again.',
buttons=gtk.BUTTONS_OK)
error_win.run()
error_win.hide()
return return
### Results for the delete message call ### Results for the delete message call
@ -995,6 +1014,14 @@ class Interface(object):
"""Called when the message cannot be reposted.""" """Called when the message cannot be reposted."""
_log.debug('Repost error.') _log.debug('Repost error.')
_log.debug(str(exception)) _log.debug(str(exception))
error_win = gtk.MessageDialog(parent=self._main_window,
type=gtk.MESSAGE_ERROR,
message_format='Error reposting message. Please ' \
'try again.',
buttons=gtk.BUTTONS_OK)
error_win.run()
error_win.hide()
return return
# ------------------------------------------------------------ # ------------------------------------------------------------

Loading…
Cancel
Save