|
|
@ -222,7 +222,7 @@ class Interface(object): |
|
|
|
grid = self._create_grid() |
|
|
|
grid = self._create_grid() |
|
|
|
(menu, toolbar, accelerators) = self._create_menu_and_toolbar() |
|
|
|
(menu, toolbar, accelerators) = self._create_menu_and_toolbar() |
|
|
|
update_field = self._create_update_box() |
|
|
|
update_field = self._create_update_box() |
|
|
|
statusbar = self._create_statusbar() |
|
|
|
self._statusbar = self._create_statusbar() |
|
|
|
|
|
|
|
|
|
|
|
update_box = gtk.VPaned() |
|
|
|
update_box = gtk.VPaned() |
|
|
|
update_box.pack1(grid, resize=True, shrink=False) |
|
|
|
update_box.pack1(grid, resize=True, shrink=False) |
|
|
@ -233,7 +233,7 @@ class Interface(object): |
|
|
|
box.pack_start(menu, False, True, 0) |
|
|
|
box.pack_start(menu, False, True, 0) |
|
|
|
box.pack_start(toolbar, False, False, 0) |
|
|
|
box.pack_start(toolbar, False, False, 0) |
|
|
|
box.pack_start(update_box, True, True, 0) |
|
|
|
box.pack_start(update_box, True, True, 0) |
|
|
|
box.pack_start(statusbar, False, False, 0) |
|
|
|
box.pack_start(self._statusbar, False, False, 0) |
|
|
|
main_window.add(box) |
|
|
|
main_window.add(box) |
|
|
|
main_window.add_accel_group(accelerators) |
|
|
|
main_window.add_accel_group(accelerators) |
|
|
|
|
|
|
|
|
|
|
@ -491,12 +491,11 @@ class Interface(object): |
|
|
|
def _create_statusbar(self): |
|
|
|
def _create_statusbar(self): |
|
|
|
"""Create the statusbar.""" |
|
|
|
"""Create the statusbar.""" |
|
|
|
statusbar = gtk.Statusbar() |
|
|
|
statusbar = gtk.Statusbar() |
|
|
|
# TODO: Probaly set the context in the object. |
|
|
|
self._statusbar_context = statusbar.get_context_id('Mitter') |
|
|
|
return statusbar |
|
|
|
return statusbar |
|
|
|
|
|
|
|
|
|
|
|
def _show_about(self, widget): |
|
|
|
def _show_about(self, widget): |
|
|
|
"""Show the about dialog.""" |
|
|
|
"""Show the about dialog.""" |
|
|
|
|
|
|
|
|
|
|
|
about_window = gtk.AboutDialog() |
|
|
|
about_window = gtk.AboutDialog() |
|
|
|
about_window.set_name('Mitter') |
|
|
|
about_window.set_name('Mitter') |
|
|
|
about_window.set_version(version) |
|
|
|
about_window.set_version(version) |
|
|
@ -603,6 +602,11 @@ class Interface(object): |
|
|
|
self._cancel_action.set_property('sensitive', enabled) |
|
|
|
self._cancel_action.set_property('sensitive', enabled) |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _update_statusbar(self, message): |
|
|
|
|
|
|
|
"""Update the statusbar with the message.""" |
|
|
|
|
|
|
|
self._statusbar.push(self._statusbar_context, message) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
def _refresh(self, widget=None): |
|
|
|
def _refresh(self, widget=None): |
|
|
|
"""Request a refresh. *widget* is the widget that called this |
|
|
|
"""Request a refresh. *widget* is the widget that called this |
|
|
|
function (we basically ignore it.)""" |
|
|
|
function (we basically ignore it.)""" |
|
|
@ -613,6 +617,7 @@ class Interface(object): |
|
|
|
self._refresh_id = None |
|
|
|
self._refresh_id = None |
|
|
|
|
|
|
|
|
|
|
|
# do the refresh |
|
|
|
# do the refresh |
|
|
|
|
|
|
|
self._update_statusbar('Retrieving messages...') |
|
|
|
self._threads.add_work(self._post_get_messages, |
|
|
|
self._threads.add_work(self._post_get_messages, |
|
|
|
self._exception_get_messages, |
|
|
|
self._exception_get_messages, |
|
|
|
self._connection.messages) |
|
|
|
self._connection.messages) |
|
|
@ -636,7 +641,6 @@ class Interface(object): |
|
|
|
|
|
|
|
|
|
|
|
# TODO: gettext to properly use "characters"/"character" |
|
|
|
# TODO: gettext to properly use "characters"/"character" |
|
|
|
self._count_label.set_text('%d characters' % count) |
|
|
|
self._count_label.set_text('%d characters' % count) |
|
|
|
#self._update_button.set_label('(%d)' % (140 - count)) |
|
|
|
|
|
|
|
self._update_sensitivity(not (count == 0)) |
|
|
|
self._update_sensitivity(not (count == 0)) |
|
|
|
|
|
|
|
|
|
|
|
return True |
|
|
|
return True |
|
|
@ -650,6 +654,7 @@ class Interface(object): |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
_log.debug('Status: %s', status) |
|
|
|
_log.debug('Status: %s', status) |
|
|
|
|
|
|
|
self._update_statusbar('Sending update...') |
|
|
|
self._update_sensitivity(False) |
|
|
|
self._update_sensitivity(False) |
|
|
|
self._threads.add_work(self._post_update_status, |
|
|
|
self._threads.add_work(self._post_update_status, |
|
|
|
self._exception_update_status, |
|
|
|
self._exception_update_status, |
|
|
@ -768,6 +773,7 @@ class Interface(object): |
|
|
|
error_dialog.destroy() |
|
|
|
error_dialog.destroy() |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self._update_statusbar('Deleting message...') |
|
|
|
self._delete_iter = iter |
|
|
|
self._delete_iter = iter |
|
|
|
_log.debug('Deleting messing %d', message.id) |
|
|
|
_log.debug('Deleting messing %d', message.id) |
|
|
|
self._threads.add_work(self._post_delete_message, |
|
|
|
self._threads.add_work(self._post_delete_message, |
|
|
@ -785,6 +791,10 @@ class Interface(object): |
|
|
|
"""Function called after the data from the messages list is |
|
|
|
"""Function called after the data from the messages list is |
|
|
|
retrieved.""" |
|
|
|
retrieved.""" |
|
|
|
_log.debug('%d new tweets', len(results)) |
|
|
|
_log.debug('%d new tweets', len(results)) |
|
|
|
|
|
|
|
interval = self._options[self.NAMESPACE]['refresh_interval'] |
|
|
|
|
|
|
|
self._update_statusbar('Messages retrieved. Next update in ' \ |
|
|
|
|
|
|
|
'%d minutes.' % interval) |
|
|
|
|
|
|
|
|
|
|
|
store = self._grid.get_model() |
|
|
|
store = self._grid.get_model() |
|
|
|
for message in results: |
|
|
|
for message in results: |
|
|
|
_log.debug('Data: %s', str(message)) |
|
|
|
_log.debug('Data: %s', str(message)) |
|
|
@ -838,6 +848,7 @@ class Interface(object): |
|
|
|
"""Called when the status is updated correctly.""" |
|
|
|
"""Called when the status is updated correctly.""" |
|
|
|
self._update_sensitivity(True) |
|
|
|
self._update_sensitivity(True) |
|
|
|
self._clear_text(None) |
|
|
|
self._clear_text(None) |
|
|
|
|
|
|
|
self._update_statusbar('Your status was updated.') |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
def _exception_update_status(self, widget, exception): |
|
|
|
def _exception_update_status(self, widget, exception): |
|
|
@ -854,6 +865,7 @@ class Interface(object): |
|
|
|
if self._delete_iter: |
|
|
|
if self._delete_iter: |
|
|
|
self._grid.get_model().remove(self._delete_iter) |
|
|
|
self._grid.get_model().remove(self._delete_iter) |
|
|
|
self._delete_iter = None |
|
|
|
self._delete_iter = None |
|
|
|
|
|
|
|
self._update_statusbar('Message deleted.') |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
def _exception_delete_message(self, widget, exception): |
|
|
|
def _exception_delete_message(self, widget, exception): |
|
|
|