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