~certify-web-dev/twisted/certify-trunk

« back to all changes in this revision

Viewing changes to twisted/words/ui/tktoc.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2004-06-21 22:01:11 UTC
  • mto: (2.2.3 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040621220111-vkf909euqnyrp3nr
Tags: upstream-1.3.0
ImportĀ upstreamĀ versionĀ 1.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Twisted, the Framework of Your Internet
2
 
# Copyright (C) 2001 Matthew W. Lefkowitz
3
 
4
 
# This library is free software; you can redistribute it and/or
5
 
# modify it under the terms of version 2.1 of the GNU Lesser General Public
6
 
# License as published by the Free Software Foundation.
7
 
8
 
# This library is distributed in the hope that it will be useful,
9
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
 
# Lesser General Public License for more details.
12
 
13
 
# You should have received a copy of the GNU Lesser General Public
14
 
# License along with this library; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 
 
17
 
from Tkinter import Tk,mainloop
18
 
from twisted.spread.ui import tkutil
19
 
from twisted.internet import tkinternet
20
 
from twisted.words.ui import im2,tkim
21
 
from twisted.words.ui.gateways import toc 
22
 
from twisted.internet import tcp 
23
 
 
24
 
im2.Conversation=tkim.Conversation
25
 
im2.ContactList=tkim.ContactList
26
 
im2.GroupSession=tkim.GroupSession
27
 
 
28
 
def our_callback(values):
29
 
    global im
30
 
    print values
31
 
    user=values["username"]
32
 
    password=values["password"]
33
 
    server=values["server"]
34
 
    port=int(values["port"])
35
 
    c=toc.TOCGateway(im,user,password)
36
 
    tcp.Client(server,port,c)
37
 
    im.attachGateway(c)
38
 
 
39
 
def main():
40
 
    global im
41
 
    root=Tk()
42
 
    root.withdraw()
43
 
    tkinternet.install(root)
44
 
    im=im2.InstanceMessenger()
45
 
    im.logging=1
46
 
    tkutil.GenericLogin(our_callback,[["Username","my_screen_name"],
47
 
                                      ["Password","my_password",{"show":"*"}],
48
 
                                      ["Server","toc.oscar.aol.com"],
49
 
                                      ["Port","9898"]])
50
 
    mainloop()
51
 
    tkinternet.stop()
52
 
 
53
 
if __name__=="__main__":main()