From 95706d11d3cf2af02aa6ee2a8e25d36e55ccc1d1 Mon Sep 17 00:00:00 2001 From: Ragner Magalhaes Date: Tue, 2 Dec 2008 20:39:30 +0000 Subject: [PATCH] Adding _write_im_cb to MainWindow class Adding _write_im_cb to update the conversation message at UI Signed-off-by: Ragner Magalhaes git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1333 596f6dd7-e928-0410-a184-9e12fd12cf7e --- conversation_cbs.pxd | 2 +- nullclient-ecore.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/conversation_cbs.pxd b/conversation_cbs.pxd index 4688985..8e68883 100644 --- a/conversation_cbs.pxd +++ b/conversation_cbs.pxd @@ -57,7 +57,7 @@ cdef void write_im (conversation.PurpleConversation *conv, const_char *who, time_t mtime): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation", "write_im\n") try: - (conversation_cbs["write_im"])("write_im") + (conversation_cbs["write_im"])(conv.account.username, message) except KeyError: pass diff --git a/nullclient-ecore.py b/nullclient-ecore.py index aa283ec..207d42d 100644 --- a/nullclient-ecore.py +++ b/nullclient-ecore.py @@ -61,7 +61,6 @@ def conv_callback(name): conv_cbs["create_conversation"] = conv_callback conv_cbs["destroy_conversation"] = conv_callback conv_cbs["write_chat"] = conv_callback -conv_cbs["write_im"] = conv_callback conv_cbs["write_conv"] = conv_callback conv_cbs["chat_add_users"] = conv_callback conv_cbs["chat_rename_user"] = conv_callback @@ -117,8 +116,10 @@ signal_cbs["receiving_im_msg"] = receiving_im_msg_cb class MainWindow: def __init__(self, quit_cb): + global conv_cbs self.bt_cbs = {} self.quit_cb = quit_cb + conv_cbs["write_im"] = self._write_im_cb def init_window(self): # Main vbox @@ -149,6 +150,8 @@ class MainWindow: vbox_txt_area = etk.VBox() self.txt_area = etk.Label() + self.txt_area.text = "
" + vbox_txt_area.append(self.txt_area, etk.VBox.START, etk.VBox.EXPAND_FILL, 0) hbox_panel.append(vbox_txt_area, etk.HBox.START, etk.HBox.EXPAND_FILL, 0) @@ -208,6 +211,10 @@ class MainWindow: if callable(cb): self.quit_cb = cb + def _write_im_cb(self, name, message): + self.txt_area.text += str(name) + ": " + str(message) + "
" + self._window.show_all() + class NullClientPurple: def __init__(self): @@ -219,6 +226,7 @@ class NullClientPurple: self.username = "carmanplugintest@gmail.com" self.password = "abc123def" + global cbs global signal_cbs cbs["blist"]["update"] = self._purple_blist_new_cb @@ -270,4 +278,4 @@ class NullClientPurple: if __name__ == '__main__': nullpurple = NullClientPurple() - ecore.main_loop_begin() \ No newline at end of file + ecore.main_loop_begin() -- 1.7.9.5