root/trunk/twisted/scripts/manhole.py

Revision 26801, 1.6 KB (checked in by glyph, 16 months ago)

Remove a bunch of grotty old non-working GTK1 and Swing code.

This eliminates all of the gtk1 code remaining in Twisted besides the explicit
gtk1 reactor support.

Author: glyph

Reviewer: mwh, exarkun

Fixes #3699

Fixes #3340

Line 
1# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
2# See LICENSE for details.
3
4"""
5Start a L{twisted.manhole} client.
6"""
7
8import sys
9
10from twisted.python import usage
11
12def run():
13    config = MyOptions()
14    try:
15        config.parseOptions()
16    except usage.UsageError, e:
17        print str(e)
18        print str(config)
19        sys.exit(1)
20
21    run_gtk2(config)
22
23    from twisted.internet import reactor
24    reactor.run()
25
26
27def run_gtk2(config):
28    # Put these off until after we parse options, so we know what reactor
29    # to load.
30    from twisted.internet import gtk2reactor
31    gtk2reactor.install()
32
33    # Put this off until after we parse options, or else gnome eats them.
34    sys.argv[:] = ['manhole']
35    from twisted.manhole.ui import gtk2manhole
36
37    o = config.opts
38    defaults = {
39        'host': o['host'],
40        'port': o['port'],
41        'identityName': o['user'],
42        'password': o['password'],
43        'serviceName': o['service'],
44        'perspectiveName': o['perspective']
45        }
46    w = gtk2manhole.ManholeWindow()
47    w.setDefaults(defaults)
48    w.login()
49
50
51pbportno = 8787
52
53class MyOptions(usage.Options):
54    optParameters=[("user", "u", "guest", "username"),
55                   ("password", "w", "guest"),
56                   ("service", "s", "twisted.manhole", "PB Service"),
57                   ("host", "h", "localhost"),
58                   ("port", "p", str(pbportno)),
59                   ("perspective", "P", "",
60                    "PB Perspective to ask for "
61                    "(if different than username)")]
62    zsh_actions = {"host":"_hosts"}
63
64if __name__ == '__main__':
65    run()
Note: See TracBrowser for help on using the browser.