Browse Source

show update box only when doing message related functions

master
Julio Biason 15 years ago
parent
commit
1913ab05ce
  1. 65
      mitterlib/ui/ui_pygtk.py

65
mitterlib/ui/ui_pygtk.py

@ -248,25 +248,27 @@ class Interface(object):
main_window.set_icon(self._images['icon']) main_window.set_icon(self._images['icon'])
(menu, toolbar, accelerators) = self._create_menu_and_toolbar() (menu, toolbar, accelerators) = self._create_menu_and_toolbar()
update_field = self._create_update_box() self._update_field = self._create_update_box()
self._statusbar = self._create_statusbar() self._statusbar = self._create_statusbar()
self._main_tabs = gtk.Notebook() self._main_tabs = gtk.Notebook()
self._grids = [] self._grids = []
(grid_widget, self._grid) = self._create_grid('_new_message_count') (grid_widget, grid) = self._create_grid('_new_message_count')
self._main_tabs.insert_page(grid_widget, gtk.Label('Messages')) self._main_tabs.insert_page(grid_widget, gtk.Label('Messages'))
self._grids.append((self._grid, '_new_messages_count')) self._grids.append((grid, '_new_messages_count'))
(replies_widget, self._replies) = self._create_grid( (replies_widget, replies) = self._create_grid(
'_new_replies_count') '_new_replies_count')
self._main_tabs.insert_page(replies_widget, gtk.Label('Replies')) self._main_tabs.insert_page(replies_widget, gtk.Label('Replies'))
self._grids.append((self._replies, '_new_replies_count')) self._grids.append((replies, '_new_replies_count'))
update_box = gtk.VPaned() update_box = gtk.VBox()
update_box.pack1(self._main_tabs, resize=True, shrink=False) update_box.set_property('border_width', 2)
update_box.pack2(update_field, resize=False, shrink=True) update_box.pack_start(self._main_tabs, expand=True, fill=True,
# TODO: Save the size of the update box in the config file. padding=0)
update_box.pack_start(self._update_field, expand=False, fill=False,
padding=0)
box = gtk.VBox(False, 1) box = gtk.VBox(False, 1)
box.pack_start(menu, False, True, 0) box.pack_start(menu, False, True, 0)
@ -276,6 +278,15 @@ class Interface(object):
main_window.add(box) main_window.add(box)
main_window.add_accel_group(accelerators) main_window.add_accel_group(accelerators)
# show widgets (except the update box, which will be shown when
# requested)
menu.show_all()
toolbar.show_all()
update_box.show()
self._main_tabs.show_all()
self._statusbar.show_all()
box.show()
self._message_count_updated() self._message_count_updated()
# now that all elements are created, connect the signals # now that all elements are created, connect the signals
@ -502,24 +513,29 @@ class Interface(object):
self._update_text = gtk.TextView() self._update_text = gtk.TextView()
self._update_text.set_property('wrap-mode', gtk.WRAP_WORD) self._update_text.set_property('wrap-mode', gtk.WRAP_WORD)
self._update_button = gtk.Button(label='Send') avatar = gtk.Image()
self._update_button.connect('clicked', self._update_status) avatar.set_from_pixbuf(self._images['avatar'])
self._update_button.set_property('sensitive', False)
self._cancel_button = gtk.Button(label='Cancel') status_bar = gtk.HBox(False, 0)
self._cancel_button.connect('clicked', self._clear_text) self._update_status = gtk.Label()
self._count_label = gtk.Label() close_button = gtk.Button(stock=gtk.STOCK_CLOSE)
self._count_label.set_justify(gtk.JUSTIFY_LEFT) close_button.set_relief(gtk.RELIEF_NONE)
self._reply_label = gtk.Label()
update_box = gtk.HBox(False, 0) status_bar = gtk.HBox(False, 0)
update_box.pack_start(self._update_text, expand=True, fill=True, status_bar.pack_start(self._update_status, expand=True, fill=True,
padding=0) padding=0)
update_box.pack_start(self._update_button, expand=False, fill=False, status_bar.pack_start(close_button, expand=False, fill=False,
padding=0) padding=0)
update_box.pack_start(self._cancel_button, expand=False, fill=False,
update_bar = gtk.HBox(False, 3)
update_bar.pack_start(self._update_text, expand=True, fill=True,
padding=0) padding=0)
update_bar.pack_start(avatar, expand=False, fill=False, padding=0)
update = gtk.VBox(False, 0)
update.pack_start(status_bar, expand=False, fill=True, padding=0)
update.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']
@ -538,7 +554,7 @@ class Interface(object):
_log.debug('Error initializing spell checking: ' \ _log.debug('Error initializing spell checking: ' \
'spell checking disabled') 'spell checking disabled')
return update_box return update
def _create_statusbar(self): def _create_statusbar(self):
"""Create the statusbar.""" """Create the statusbar."""
@ -666,7 +682,7 @@ 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_button.set_property('sensitive', enabled)
self._update_action.set_property('sensitive', enabled) self._update_action.set_property('sensitive', enabled)
return return
@ -696,7 +712,6 @@ class Interface(object):
def _clear_reply(self): def _clear_reply(self):
"""Clear the info about a reply.""" """Clear the info about a reply."""
self._reply_message_id = None self._reply_message_id = None
self._reply_label.set_text('')
return return
def _url_popup(self, widget, path, event): def _url_popup(self, widget, path, event):
@ -1457,7 +1472,7 @@ class Interface(object):
self._statusicon = None self._statusicon = None
self._main_window = self._create_main_window() self._main_window = self._create_main_window()
self._main_window.show_all() self._main_window.show()
self._threads = _ThreadManager() self._threads = _ThreadManager()

Loading…
Cancel
Save