Remove unused variable
[vte.git] / python / unrealize.py
1 #!/usr/bin/python
2 import sys
3 import getopt
4 import gtk
5 import vte
6
7 # FIXME: figure out why we don't get a PID here.
8 def exited_cb(terminal):
9         gtk.main_quit()
10
11 def nuke(button, (box, terminal)):
12         box.remove(terminal)
13         box.pack_start(terminal)
14
15 if __name__ == '__main__':
16         child_pid = -1;
17         # Defaults.
18         emulation = "xterm"
19         font = "fixed 12"
20         command = None
21         # Let the user override them.
22         (shorts, longs) = getopt.getopt(sys.argv[1:], "c:t:f:", ["command=", "terminal=", "font="])
23         for argpair in (shorts + longs):
24                 if ((argpair[0] == '-c') or (argpair[0] == '--command')):
25                         print "Running command `" + argpair[1] + "'."
26                         command = argpair[1]
27                 if ((argpair[0] == '-f') or (argpair[0] == '--font')):
28                         print "Setting font to `" + argpair[1] + "'."
29                         font = argpair[1]
30                 if ((argpair[0] == '-t') or (argpair[0] == '--terminal')):
31                         print "Setting terminal type to `" + argpair[1] + "'."
32                         emulation = argpair[1]
33         window = gtk.Window()
34         terminal = vte.Terminal()
35         terminal.set_emulation(emulation)
36         terminal.set_font_from_string(font)
37         terminal.connect("child-exited", exited_cb)
38         if (command):
39                 # Start up the specified command.
40                 child_pid = terminal.fork_command(command)
41         else:
42                 # Start up the default command, the user's shell.
43                 child_pid = terminal.fork_command()
44         box = gtk.VBox()
45         box.pack_start(terminal)
46         button = gtk.Button("remove")
47         button.connect("pressed", nuke, (box, terminal))
48         box.pack_start(button)
49         window.add(box)
50         window.show_all()
51         gtk.main()