Browse Source

Re-enabled the statusbar, 'cause feedback to the user was pretty bad

master
Julio Biason 15 years ago
parent
commit
6b1e7a831c
  1. 22
      mitterlib/ui/ui_pygtk.py

22
mitterlib/ui/ui_pygtk.py

@ -222,7 +222,7 @@ class Interface(object):
grid = self._create_grid()
(menu, toolbar, accelerators) = self._create_menu_and_toolbar()
update_field = self._create_update_box()
statusbar = self._create_statusbar()
self._statusbar = self._create_statusbar()
update_box = gtk.VPaned()
update_box.pack1(grid, resize=True, shrink=False)
@ -233,7 +233,7 @@ class Interface(object):
box.pack_start(menu, False, True, 0)
box.pack_start(toolbar, False, False, 0)
box.pack_start(update_box, True, True, 0)
box.pack_start(statusbar, False, False, 0)
box.pack_start(self._statusbar, False, False, 0)
main_window.add(box)
main_window.add_accel_group(accelerators)
@ -491,12 +491,11 @@ class Interface(object):
def _create_statusbar(self):
"""Create the statusbar."""
statusbar = gtk.Statusbar()
# TODO: Probaly set the context in the object.
self._statusbar_context = statusbar.get_context_id('Mitter')
return statusbar
def _show_about(self, widget):
"""Show the about dialog."""
about_window = gtk.AboutDialog()
about_window.set_name('Mitter')
about_window.set_version(version)
@ -603,6 +602,11 @@ class Interface(object):
self._cancel_action.set_property('sensitive', enabled)
return
def _update_statusbar(self, message):
"""Update the statusbar with the message."""
self._statusbar.push(self._statusbar_context, message)
return
def _refresh(self, widget=None):
"""Request a refresh. *widget* is the widget that called this
function (we basically ignore it.)"""
@ -613,6 +617,7 @@ class Interface(object):
self._refresh_id = None
# do the refresh
self._update_statusbar('Retrieving messages...')
self._threads.add_work(self._post_get_messages,
self._exception_get_messages,
self._connection.messages)
@ -636,7 +641,6 @@ class Interface(object):
# TODO: gettext to properly use "characters"/"character"
self._count_label.set_text('%d characters' % count)
#self._update_button.set_label('(%d)' % (140 - count))
self._update_sensitivity(not (count == 0))
return True
@ -650,6 +654,7 @@ class Interface(object):
return
_log.debug('Status: %s', status)
self._update_statusbar('Sending update...')
self._update_sensitivity(False)
self._threads.add_work(self._post_update_status,
self._exception_update_status,
@ -768,6 +773,7 @@ class Interface(object):
error_dialog.destroy()
return
self._update_statusbar('Deleting message...')
self._delete_iter = iter
_log.debug('Deleting messing %d', message.id)
self._threads.add_work(self._post_delete_message,
@ -785,6 +791,10 @@ class Interface(object):
"""Function called after the data from the messages list is
retrieved."""
_log.debug('%d new tweets', len(results))
interval = self._options[self.NAMESPACE]['refresh_interval']
self._update_statusbar('Messages retrieved. Next update in ' \
'%d minutes.' % interval)
store = self._grid.get_model()
for message in results:
_log.debug('Data: %s', str(message))
@ -838,6 +848,7 @@ class Interface(object):
"""Called when the status is updated correctly."""
self._update_sensitivity(True)
self._clear_text(None)
self._update_statusbar('Your status was updated.')
return
def _exception_update_status(self, widget, exception):
@ -854,6 +865,7 @@ class Interface(object):
if self._delete_iter:
self._grid.get_model().remove(self._delete_iter)
self._delete_iter = None
self._update_statusbar('Message deleted.')
return
def _exception_delete_message(self, widget, exception):

Loading…
Cancel
Save