Browse Source

Removed all the _action_* variables; everything should be accessible via

the _action_group variable now.
master
Julio Biason 15 years ago
parent
commit
74b441ed04
  1. 82
      mitterlib/ui/ui_pygtk.py

82
mitterlib/ui/ui_pygtk.py

@ -166,7 +166,7 @@ class Interface(object):
<toolitem action="Delete" />
<toolitem action="Reply" />
<toolitem action="Repost" />
<toolitem action="Favourite" />
<toolitem action="Favorite" />
<separator />
<toolitem action="Settings" />
<toolitem action="Quit" />
@ -194,7 +194,7 @@ class Interface(object):
<menuitem action="Delete" />
<menuitem action="Reply" />
<menuitem action="Repost" />
<menuitem action="Favourite" />
<menuitem action="Favorite" />
</menu>
<menu action="Help">
<menuitem action="About" />
@ -247,17 +247,15 @@ class Interface(object):
all_read_action.connect('activate', self._mark_all_read)
self._action_group.add_action(all_read_action)
self._update_action = gtk.Action('Update', _('_Update'),
update_action = gtk.Action('Update', _('_Update'),
_('Update your status'), gtk.STOCK_ADD)
self._update_action.connect('activate', self._update_status)
self._action_group.add_action_with_accel(self._update_action,
'Return')
update_action.connect('activate', self._update_status)
self._action_group.add_action_with_accel(update_action, 'Return')
self._cancel_action = gtk.Action('Cancel', _('_Cancel'),
cancel_action = gtk.Action('Cancel', _('_Cancel'),
_('Cancel the update'), gtk.STOCK_CANCEL)
self._cancel_action.connect('activate', self._clear_text)
self._action_group.add_action_with_accel(self._cancel_action,
'Escape')
cancel_action.connect('activate', self._clear_text)
self._action_group.add_action_with_accel(cancel_action, 'Escape')
settings_action = gtk.Action('Settings', _('_Settings'),
_('Settings'), gtk.STOCK_PREFERENCES)
@ -270,32 +268,32 @@ class Interface(object):
new_action.connect('activate', self._new_message)
self._action_group.add_action_with_accel(new_action, '<Ctrl>n')
self._delete_action = gtk.Action('Delete', _('_Delete'),
delete_action = gtk.Action('Delete', _('_Delete'),
_('Delete a post'), gtk.STOCK_DELETE)
self._delete_action.set_property('sensitive', False)
self._delete_action.connect('activate', self._delete_message)
self._action_group.add_action_with_accel(self._delete_action, 'Delete')
delete_action.set_property('sensitive', False)
delete_action.connect('activate', self._delete_message)
self._action_group.add_action_with_accel(delete_action, 'Delete')
self._reply_action = gtk.Action('Reply', _('_Reply'),
reply_action = gtk.Action('Reply', _('_Reply'),
_("Send a response to someone's else message"),
gtk.STOCK_REDO)
self._reply_action.set_property('sensitive', False)
self._reply_action.connect('activate', self._reply_message)
self._action_group.add_action_with_accel(self._reply_action, '<Ctrl>r')
reply_action.set_property('sensitive', False)
reply_action.connect('activate', self._reply_message)
self._action_group.add_action_with_accel(reply_action, '<Ctrl>r')
self._repost_action = gtk.Action('Repost', _('Re_post'),
repost_action = gtk.Action('Repost', _('Re_post'),
_("Put someone's else message on your timeline"),
gtk.STOCK_CONVERT)
self._repost_action.set_property('sensitive', False)
self._repost_action.connect('activate', self._repost_message)
self._action_group.add_action_with_accel(self._repost_action, '<Ctrl>p')
repost_action.set_property('sensitive', False)
repost_action.connect('activate', self._repost_message)
self._action_group.add_action_with_accel(repost_action, '<Ctrl>p')
self._favorite_action = gtk.Action('Favourite', _('_Favorite'),
favorite_action = gtk.Action('Favorite', _('_Favorite'),
_('Toggle the favorite status of a message'),
gtk.STOCK_ABOUT)
self._favorite_action.set_property('sensitive', False)
self._favorite_action.connect('activate', self._favorite_message)
self._action_group.add_action_with_accel(self._favorite_action, '<Ctrl>f')
favorite_action.set_property('sensitive', False)
favorite_action.connect('activate', self._favorite_message)
self._action_group.add_action_with_accel(favorite_action, '<Ctrl>f')
# view actions
view_messages_action = gtk.Action('Messages', _('_Messages'),
@ -397,10 +395,14 @@ class Interface(object):
# ------------------------------------------------------------
def _message_changed(self, widget, data):
"""Callback from the MesageGrids when the selected message changes."""
self._delete_action.set_property('sensitive', data.deletable)
self._reply_action.set_property('sensitive', data.replyable)
self._repost_action.set_property('sensitive', data.repostable)
self._favorite_action.set_property('sensitive', data.favoritable)
self._action_group.get_action('Delete').set_property('sensitive',
data.deletable)
self._action_group.get_action('Reply').set_property('sensitive',
data.replyable)
self._action_group.get_action('Repost').set_property('sensitive',
data.repostable)
self._action_group.get_action('Favorite').set_property('sensitive',
data.favoritable)
return
@ -456,7 +458,7 @@ class Interface(object):
_log.debug('Status: %s', status)
self._update_statusbar(_('Sending update...'))
self._update_action.set_sensitive(False)
self._action_group.get_action('Update').set_sensitive(False)
self._threads.add_work(self._post_update_status,
self._exception_update_status,
self._connection.update,
@ -701,10 +703,14 @@ class Interface(object):
# disable the message actions (they will be activated properly when
# the user leaves the textarea.)
_log.debug('Disabling message actions due focus on textarea')
self._delete_action.set_property('sensitive', False)
self._reply_action.set_property('sensitive', False)
self._repost_action.set_property('sensitive', False)
self._favorite_action.set_property('sensitive', False)
self._action_group.get_action('Delete').set_property('sensitive',
False)
self._action_group.get_action('Reply').set_property('sensitive',
False)
self._action_group.get_action('Repost').set_property('sensitive',
False)
self._iaction_group.get_action('Favorite').set_property('sensitive',
False)
return
def _new_message(self, widget, user_data=None):
@ -806,7 +812,7 @@ class Interface(object):
def _post_update_status(self, widget, data):
"""Called when the status is updated correctly."""
self._update_statusbar(_('Your status was updated.'))
self._update_action.set_sensitive(True)
self._action_group.get_action('Update').set_sensitive(True)
self._clear_text(None)
return
@ -865,7 +871,7 @@ class Interface(object):
### Results from the favorite call
def _post_favorite_message(self, widget, data):
"""Called when the message was favorited successfully."""
_log.debug('Favourite status changed.')
_log.debug('Favorite status changed.')
(grid, iter) = self._favorite_info
message = grid.get_model().get_value(iter, 0)
if message.favorite:
@ -879,7 +885,7 @@ class Interface(object):
def _exception_favorite_message(self, widget, exception):
"""Called when the message couldn't be favorited."""
_log.debug('Favourite error.')
_log.debug('Favorite error.')
_log.debug(str(exception))
error_win = gtk.MessageDialog(parent=self._main_window,

Loading…
Cancel
Save