Browse Source

Added a cancel button, but the current layout isnt good

master
Julio Biason 15 years ago
parent
commit
41d26196a0
  1. 17
      mitterlib/ui/ui_pygtk.py

17
mitterlib/ui/ui_pygtk.py

@ -427,13 +427,18 @@ class Interface(object):
def _create_update_box(self):
"""Create the widgets related to the update box"""
self._update_text = gtk.TextView()
self._update_text.set_property('wrap-mode', gtk.WRAP_WORD)
text_buffer = self._update_text.get_buffer()
text_buffer.connect('changed', self._count_chars)
self._update_button = gtk.Button(label = '(140)')
self._update_button = gtk.Button(label='(140)')
self._update_button.connect('clicked', self._update_status)
self._update_button.set_property('sensitive', False)
self._cancel_button = gtk.Button(label='Cancel')
self._cancel_button.connect('clicked', self._clear_text)
self._cancel_button.set_property('sensitive', False)
# TODO: We'll need a cancel button to cancel replies/repost.
update_box = gtk.HBox(False, 0)
@ -441,6 +446,8 @@ class Interface(object):
padding=0)
update_box.pack_start(self._update_button, expand=False, fill=False,
padding=0)
update_box.pack_start(self._cancel_button, expand=False, fill=False,
padding=0)
update_area = gtk.VBox(True, 0)
update_area.pack_start(update_box)
@ -575,6 +582,7 @@ class Interface(object):
self._update_button.set_property('sensitive', enabled)
self._update_action.set_property('sensitive', enabled)
self._cancel_button.set_property('sensitive', enabled)
return
# ------------------------------------------------------------
@ -607,6 +615,11 @@ class Interface(object):
status)
# TODO: We are not dealing with replies here yet
return
def _clear_text(self, widget):
"""Clear the text field."""
self._update_text.get_buffer().set_text('')
return
def _quit_app(self, widget=None, user_data=None):
"""Callback when the window is destroyed or the user selects
@ -780,7 +793,7 @@ class Interface(object):
def _post_update_status(self, widget, data):
"""Called when the status is updated correctly."""
self._update_sensitivity(True)
self._update_text.get_buffer().set_text('')
self._clear_text(None)
return
def _exception_update_status(self, widget, exception):

Loading…
Cancel
Save