finch/libgnt/pygnt/dbus-gnt

Sat, 18 Aug 2007 05:54:49 +0000

author
William Ehlhardt <williamehlhardt@gmail.com>
date
Sat, 18 Aug 2007 05:54:49 +0000
branch
soc.2007.certmgr
changeset 19489
772b691e901b
parent 19202
729cec5a41e2
child 19596
93f6139d4aaa
permissions
-rwxr-xr-x

- Add purple_certificate_display_x509

15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1 #!/usr/bin/env python
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
2
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3 # This script requires Python 2.4 and pygnt bindings
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
4 #
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
5 # Note that all function names are resolved dynamically, no
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
6 # purple-specific library is needed.
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
7
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
8 import dbus
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
9 import dbus.glib
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
10 import dbus.decorators
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
11 import gobject
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
12 import os
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
13 import gnt
18826
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16205
diff changeset
14 import sys
15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
15
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
16 from time import strftime
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
17
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
18 convwins = {}
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
19
19200
ac7b9c360fd9 Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19173
diff changeset
20 def buddysignedon(buddy):
15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
21 pass
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
22
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
23 def conv_closed(conv):
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
24 key = get_dict_key(conv)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
25 stuff = convwins[key]
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
26 stuff[0].destroy()
19202
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
27 # if a conv window is closed, then reopened, this thing crashes
15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
28 convwins[key] = None
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
29
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
30 def wrote_msg(account, who, msg, conv, flags):
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
31 stuff = show_conversation(conv)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
32 tv = stuff[1]
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
33 tv.append_text_with_flags("\n", 0)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
34 tv.append_text_with_flags(strftime("(%X) "), 8)
19200
ac7b9c360fd9 Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19173
diff changeset
35 if flags & 3:
ac7b9c360fd9 Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19173
diff changeset
36 tv.append_text_with_flags(who + ": ", 1)
ac7b9c360fd9 Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19173
diff changeset
37 tv.append_text_with_flags(msg, 0)
ac7b9c360fd9 Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19173
diff changeset
38 stuff[0].set_urgent()
ac7b9c360fd9 Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19173
diff changeset
39 else:
ac7b9c360fd9 Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19173
diff changeset
40 tv.append_text_with_flags(msg, 8)
15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
41 tv.scroll(0)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
42
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
43 bus = dbus.SessionBus()
16205
397be242f4a4 Trac Ticket #149 from JensenDied
Richard Laager <rlaager@pidgin.im>
parents: 15992
diff changeset
44 obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
397be242f4a4 Trac Ticket #149 from JensenDied
Richard Laager <rlaager@pidgin.im>
parents: 15992
diff changeset
45 purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")
15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
46
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
47 bus.add_signal_receiver(buddysignedon,
16205
397be242f4a4 Trac Ticket #149 from JensenDied
Richard Laager <rlaager@pidgin.im>
parents: 15992
diff changeset
48 dbus_interface = "im.pidgin.purple.PurpleInterface",
15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
49 signal_name = "BuddySignedOn")
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
50
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
51 bus.add_signal_receiver(wrote_msg,
16205
397be242f4a4 Trac Ticket #149 from JensenDied
Richard Laager <rlaager@pidgin.im>
parents: 15992
diff changeset
52 dbus_interface = "im.pidgin.purple.PurpleInterface",
15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
53 signal_name = "WroteImMsg")
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
54
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
55 bus.add_signal_receiver(wrote_msg,
16205
397be242f4a4 Trac Ticket #149 from JensenDied
Richard Laager <rlaager@pidgin.im>
parents: 15992
diff changeset
56 dbus_interface = "im.pidgin.purple.PurpleInterface",
15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
57 signal_name = "WroteChatMsg")
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
58
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
59 bus.add_signal_receiver(conv_closed,
16205
397be242f4a4 Trac Ticket #149 from JensenDied
Richard Laager <rlaager@pidgin.im>
parents: 15992
diff changeset
60 dbus_interface = "im.pidgin.purple.PurpleInterface",
15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
61 signal_name = "DeletingConversation")
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
62
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
63 def get_dict_key(conv):
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
64 val = purple.PurpleConversationGetName(conv)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
65 return val
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
66
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
67 def send_im_cb(entry, key, conv):
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
68 if key[0] == '\r':
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
69 # XXX: do something about the / commands
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
70 type = purple.PurpleConversationGetType(conv)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
71 if type == 1:
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
72 imdata = purple.PurpleConversationGetImData(conv)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
73 purple.PurpleConvImSend(imdata, entry.get_text())
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
74 else:
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
75 chatdata = purple.PurpleConversationGetChatData(conv)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
76 purple.PurpleConvChatSend(chatdata, entry.get_text())
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
77 entry.clear()
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
78
19202
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
79 def conv_window_destroyed(win, key):
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
80 del convwins[key]
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
81
15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
82 def show_conversation(conv):
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
83 key = get_dict_key(conv)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
84 if key in convwins:
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
85 return convwins[key]
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
86 win = gnt.Window()
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
87 vbox = gnt.Box(0, 1)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
88 win.add_widget(vbox)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
89 win.set_title(purple.PurpleConversationGetName(conv))
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
90 win.set_pad(0)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
91 vbox.set_pad(0)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
92 tv = gnt.TextView()
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
93 entry = gnt.Entry("")
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
94 vbox.add_widget(tv)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
95 entry.set_size(40, 1)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
96 vbox.add_widget(entry)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
97 entry.connect("key_pressed", send_im_cb, conv)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
98 tv.clear()
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
99 win.show()
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
100 convwins[key] = [win, tv, entry]
19202
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
101 win.connect("destroy", conv_window_destroyed, key)
15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
102 return convwins[key]
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
103
18826
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16205
diff changeset
104 def show_buddylist():
19202
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
105 win = gnt.Window()
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
106 tree = gnt.Tree()
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
107 tree.set_property("columns", 1)
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
108 win.add_widget(tree)
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
109 node = purple.PurpleBlistGetRoot()
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
110 while node:
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
111 if purple.PurpleBlistNodeIsGroup(node):
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
112 sys.stderr.write(str(node) + "\n")
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
113 tree.add_row_after(str(node), ["asd", ""], None, None)
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
114 #tree.add_row_after(node, [str(purple.PurpleGroupGetName(node)), ""], None, None)
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
115 #tree.add_row_after(node, ["aasd", ""], None, None)
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
116 elif purple.PurpleBlistNodeIsContact(node):
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
117 buddy = purple.PurpleContactGetPriorityBuddy(node)
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
118 group = purple.PurpleBuddyGetGroup(buddy)
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
119 #tree.add_row_after(node, [str(purple.PurpleBuddyGetName(buddy)), ""], group, None)
18826
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16205
diff changeset
120
19202
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
121 node = purple.PurpleBlistNodeNext(node, False)
729cec5a41e2 "Bless me father for I have sinned."
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19200
diff changeset
122 win.show()
18826
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16205
diff changeset
123
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16205
diff changeset
124 gnt.gnt_init()
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16205
diff changeset
125
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16205
diff changeset
126 # show_buddylist()
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16205
diff changeset
127
15992
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
128 convs = purple.PurpleGetConversations()
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
129 for conv in convs:
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
130 show_conversation(conv)
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
131
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
132 gnt.gnt_main()
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
133
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
134 gnt.gnt_quit()
76e7972b3ff9 python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
135

mercurial