Browse Source

Show the time for the next update.

master
Julio Biason 15 years ago
parent
commit
918a23afc2
  1. 12
      mitterlib/ui/ui_pygtk.py

12
mitterlib/ui/ui_pygtk.py

@ -25,6 +25,7 @@ gobject.threads_init()
import logging
import urllib2
import gettext
import datetime
from mitterlib.ui.helpers.image_helpers import find_image
from mitterlib.ui.helpers.gtk_threading import ThreadManager
@ -813,15 +814,22 @@ class Interface(object):
grid = self._main_tabs.get_nth_page(1)
grid.update(results)
interval = self._options[self.NAMESPACE]['refresh_interval']
# once our update went fine, we can queue the next one. This avoids
# any problems if case there is an exception.
now = datetime.datetime.now()
delta = datetime.timedelta(seconds=interval*60)
next_call = now + delta
interval = self._options[self.NAMESPACE]['refresh_interval']
_log.debug('Queueing next refresh in %d minutes', interval)
prefix = _('New messages retrieved.')
suffix = N_('Next update in %d minute', 'Next update in %d minutes',
interval)
message = '%s %s.' % (prefix, suffix)
next_update = '(%s)' % (next_call.strftime('%H:%M:%S'))
# TODO: Check if the time format string should go in the config file.
message = '%s %s %s.' % (prefix, suffix, next_update)
self._update_statusbar(message % (interval))
self._refresh_id = gobject.timeout_add(
interval * 60 * 1000,

Loading…
Cancel
Save