Browse Source

Recheck actions when the updatebox closes.

master
Julio Biason 14 years ago
parent
commit
86e9a38188
  1. 26
      mitterlib/ui/ui_pygtk.py

26
mitterlib/ui/ui_pygtk.py

@ -402,6 +402,17 @@ class Interface(object):
self._main_window.set_title(mask)
return
def _hide_update_field(self):
"""Hides the update field and recheck the selected message for
enabling (or not) the actions."""
self._update_field.hide()
page = self._main_tabs.get_current_page()
child = self._main_tabs.get_nth_page(page)
if child.selected:
self._message_changed(child, child.selected)
return
# ------------------------------------------------------------
# Widget callback functions
# ------------------------------------------------------------
@ -486,7 +497,7 @@ class Interface(object):
status = self._update_field.text.strip()
if not status:
_log.debug('Empty message, aborting.')
self._update_field.hide()
self._hide_update_field()
return
page = self._main_tabs.get_current_page()
@ -494,7 +505,7 @@ class Interface(object):
if child.selected:
if child.selected.reply_prefix.strip() == status:
_log.debug('Empty reply, aborting.')
self._udpate_field.hide()
self._hide_update_field()
return
_log.debug('Status: %s', status)
@ -511,7 +522,7 @@ class Interface(object):
def _clear_text(self, widget):
"""Clear the text field."""
self._clear_reply()
self._update_field.hide()
self._hide_update_field()
# change the focus to the grid.
page = self._main_tabs.get_current_page()
@ -855,6 +866,15 @@ class Interface(object):
self._update_statusbar(_('Your status was updated.'))
self._action_group.get_action('Update').set_sensitive(True)
self._clear_text(None)
# re-enable (or not) the actions based on the currently selected
# message
page = self._main_tabs.get_current_page()
grid = self._main_tabs.get_nth_page(page)
message = grid.selected
if message:
self._message_changed(grid, message)
return
def _exception_update_status(self, widget, exception):

Loading…
Cancel
Save