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'])
(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._main_tabs = gtk.Notebook()
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._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')
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.pack1(self._main_tabs, resize=True, shrink=False)
update_box.pack2(update_field, resize=False, shrink=True)
# TODO: Save the size of the update box in the config file.
update_box = gtk.VBox()
update_box.set_property('border_width', 2)
update_box.pack_start(self._main_tabs, expand=True, fill=True,
padding=0)
update_box.pack_start(self._update_field, expand=False, fill=False,
padding=0)
box = gtk.VBox(False, 1)
box.pack_start(menu, False, True, 0)
@ -276,6 +278,15 @@ class Interface(object):
main_window.add(box)
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()
# now that all elements are created, connect the signals
@ -502,24 +513,29 @@ class Interface(object):
self._update_text = gtk.TextView()
self._update_text.set_property('wrap-mode', gtk.WRAP_WORD)
self._update_button = gtk.Button(label='Send')
self._update_button.connect('clicked', self._update_status)
self._update_button.set_property('sensitive', False)
avatar = gtk.Image()
avatar.set_from_pixbuf(self._images['avatar'])
self._cancel_button = gtk.Button(label='Cancel')
self._cancel_button.connect('clicked', self._clear_text)
status_bar = gtk.HBox(False, 0)
self._update_status = gtk.Label()
self._count_label = gtk.Label()
self._count_label.set_justify(gtk.JUSTIFY_LEFT)
self._reply_label = gtk.Label()
close_button = gtk.Button(stock=gtk.STOCK_CLOSE)
close_button.set_relief(gtk.RELIEF_NONE)
update_box = gtk.HBox(False, 0)
update_box.pack_start(self._update_text, expand=True, fill=True,
status_bar = gtk.HBox(False, 0)
status_bar.pack_start(self._update_status, expand=True, fill=True,
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)
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)
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_check_enabled = self._options[self.NAMESPACE]['spell_check']
@ -538,7 +554,7 @@ class Interface(object):
_log.debug('Error initializing spell checking: ' \
'spell checking disabled')
return update_box
return update
def _create_statusbar(self):
"""Create the statusbar."""
@ -666,7 +682,7 @@ class Interface(object):
should have the same property, so whenever you need to disable/enable
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)
return
@ -696,7 +712,6 @@ class Interface(object):
def _clear_reply(self):
"""Clear the info about a reply."""
self._reply_message_id = None
self._reply_label.set_text('')
return
def _url_popup(self, widget, path, event):
@ -1457,7 +1472,7 @@ class Interface(object):
self._statusicon = None
self._main_window = self._create_main_window()
self._main_window.show_all()
self._main_window.show()
self._threads = _ThreadManager()

Loading…
Cancel
Save