Browse Source

show/hide the update area

master
Julio Biason 15 years ago
parent
commit
737f0b0344
  1. 43
      mitterlib/ui/ui_pygtk.py

43
mitterlib/ui/ui_pygtk.py

@ -353,6 +353,7 @@ class Interface(object):
<toolitem action="Clear" /> <toolitem action="Clear" />
<toolitem action="AllRead" /> <toolitem action="AllRead" />
<separator /> <separator />
<toolitem action="New" />
<toolitem action="Delete" /> <toolitem action="Delete" />
<toolitem action="Reply" /> <toolitem action="Reply" />
<toolitem action="Repost" /> <toolitem action="Repost" />
@ -380,6 +381,7 @@ class Interface(object):
<menuitem action="Replies" /> <menuitem action="Replies" />
</menu> </menu>
<menu action="Message"> <menu action="Message">
<menuitem action="New" />
<menuitem action="Delete" /> <menuitem action="Delete" />
<menuitem action="Reply" /> <menuitem action="Reply" />
<menuitem action="Repost" /> <menuitem action="Repost" />
@ -455,6 +457,11 @@ class Interface(object):
action_group.add_action(settings_action) action_group.add_action(settings_action)
# Message actions # Message actions
new_action = gtk.Action('New', _('_New'),
_('Post a new message'), gtk.STOCK_ADD)
new_action.connect('activate', self._new_message)
action_group.add_action_with_accel(new_action, '<Ctrl>n')
self._delete_action = gtk.Action('Delete', _('_Delete'), self._delete_action = gtk.Action('Delete', _('_Delete'),
_('Delete a post'), gtk.STOCK_DELETE) _('Delete a post'), gtk.STOCK_DELETE)
self._delete_action.set_property('sensitive', False) self._delete_action.set_property('sensitive', False)
@ -521,6 +528,7 @@ class Interface(object):
close_button = gtk.Button(stock=gtk.STOCK_CLOSE) close_button = gtk.Button(stock=gtk.STOCK_CLOSE)
close_button.set_relief(gtk.RELIEF_NONE) close_button.set_relief(gtk.RELIEF_NONE)
close_button.connect('clicked', self._clear_text)
status_bar = gtk.HBox(False, 0) status_bar = gtk.HBox(False, 0)
status_bar.pack_start(self._update_status, expand=True, fill=True, status_bar.pack_start(self._update_status, expand=True, fill=True,
@ -533,9 +541,11 @@ class Interface(object):
padding=0) padding=0)
update_bar.pack_start(avatar, expand=False, fill=False, padding=0) update_bar.pack_start(avatar, expand=False, fill=False, padding=0)
update = gtk.VBox(False, 0) self._update_box = gtk.VBox(False, 0)
update.pack_start(status_bar, expand=False, fill=True, padding=0) self._update_box.pack_start(status_bar, expand=False, fill=True,
update.pack_start(update_bar, expand=False, fill=True, padding=0) padding=0)
self._update_box.pack_start(update_bar, expand=False, fill=True,
padding=0)
# Spell checking the update box # Spell checking the update box
spell_check_enabled = self._options[self.NAMESPACE]['spell_check'] spell_check_enabled = self._options[self.NAMESPACE]['spell_check']
@ -554,7 +564,7 @@ class Interface(object):
_log.debug('Error initializing spell checking: ' \ _log.debug('Error initializing spell checking: ' \
'spell checking disabled') 'spell checking disabled')
return update return self._update_box
def _create_statusbar(self): def _create_statusbar(self):
"""Create the statusbar.""" """Create the statusbar."""
@ -682,7 +692,6 @@ class Interface(object):
should have the same property, so whenever you need to disable/enable should have the same property, so whenever you need to disable/enable
them, use this function.""" them, use this function."""
#self._update_button.set_property('sensitive', enabled)
self._update_action.set_property('sensitive', enabled) self._update_action.set_property('sensitive', enabled)
return return
@ -787,6 +796,16 @@ class Interface(object):
store.sort_column_changed() store.sort_column_changed()
return return
def _show_update_box(self):
"""Enables the update box."""
self._update_box.show_all()
self._update_text.grab_focus()
return
def _hide_update_box(self):
"""Hides de update box."""
self._update_box.hide_all()
return
# ------------------------------------------------------------ # ------------------------------------------------------------
# Widget callback functions # Widget callback functions
@ -838,6 +857,7 @@ class Interface(object):
self._delete_info = None self._delete_info = None
self._clear_reply() self._clear_reply()
self._remove_count_status() self._remove_count_status()
self._hide_update_box()
# change the focus to the grid. # change the focus to the grid.
page = self._main_tabs.get_current_page() page = self._main_tabs.get_current_page()
@ -1000,7 +1020,7 @@ class Interface(object):
self._update_text.get_buffer().set_text( self._update_text.get_buffer().set_text(
self._connection.reply_prefix(message)) self._connection.reply_prefix(message))
self._reply_message_id = message self._reply_message_id = message
self._update_text.grab_focus() self._show_update_box()
return return
@ -1029,8 +1049,7 @@ class Interface(object):
display = _('Removing message from %s from favorites...') display = _('Removing message from %s from favorites...')
else: else:
display = _('Marking message from %s as favorite...') display = _('Marking message from %s as favorite...')
self._update_status(display % (message.username)) self._update_statusbar(display % (message.username))
self._threads.add_work(self._post_favourite_message, self._threads.add_work(self._post_favourite_message,
self._exception_favourite_message, self._exception_favourite_message,
self._connection.favourite, self._connection.favourite,
@ -1219,6 +1238,11 @@ class Interface(object):
self._favourite_action.set_property('sensitive', False) self._favourite_action.set_property('sensitive', False)
return return
def _new_message(self, widget, user_data=None):
"""Opens the text area for a new message."""
self._show_update_box()
return
# ------------------------------------------------------------ # ------------------------------------------------------------
# Network related functions # Network related functions
# ------------------------------------------------------------ # ------------------------------------------------------------
@ -1331,6 +1355,7 @@ class Interface(object):
self._update_statusbar(_('Your status was updated.')) self._update_statusbar(_('Your status was updated.'))
self._update_sensitivity(False) self._update_sensitivity(False)
self._clear_text(None) self._clear_text(None)
self._hide_update_box()
return return
def _exception_update_status(self, widget, exception): def _exception_update_status(self, widget, exception):
@ -1598,4 +1623,4 @@ class Interface(object):
'protected/private.', 'protected/private.',
metavar='CHAR', metavar='CHAR',
default=_('<small>(protected)</small>'), default=_('<small>(protected)</small>'),
is_cmd_option=False) is_cmd_option=False)
Loading…
Cancel
Save