diff options
author | Nalin Dahyabhai <nalin@src.gnome.org> | 2002-06-12 23:00:33 +0000 |
---|---|---|
committer | Nalin Dahyabhai <nalin@src.gnome.org> | 2002-06-12 23:00:33 +0000 |
commit | eaacb5d11a027c920575381de5abbfd4b245b0ee (patch) | |
tree | 8588bcec1f30fadb1083f2ff5e7502f9ef9c13ae /python | |
parent | 4ae8a2578e950a75c4f3760d96d7bbd67d83a30c (diff) |
Re-read the termcap when we change emulation, because the location of the
* src/vte.c: Re-read the termcap when we change emulation, because the location
of the file may have changed.
* python/vte.override (_wrap_vte_terminal_fork_command): Handle default value
for the command parameter.
Diffstat (limited to 'python')
-rw-r--r-- | python/vte.override | 4 | ||||
-rwxr-xr-x | python/vte.py | 43 |
2 files changed, 45 insertions, 2 deletions
diff --git a/python/vte.override b/python/vte.override index 0f15288..d6f6a80 100644 --- a/python/vte.override +++ b/python/vte.override @@ -18,13 +18,13 @@ _wrap_vte_terminal_fork_command(PyGObject *self, PyObject *args, PyObject *kwargs) { gchar **argv = NULL; - gchar *command; + gchar *command = NULL; static char *kwlist[] = { "command", "argv", NULL }; PyObject *py_argv = NULL; int i, n_args; pid_t pid; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|O:fork_command", + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|sO:fork_command", kwlist, &command, &py_argv)) return NULL; diff --git a/python/vte.py b/python/vte.py new file mode 100755 index 0000000..5abee1f --- /dev/null +++ b/python/vte.py @@ -0,0 +1,43 @@ +#!/usr/bin/python2.2 +import sys +import getopt +import gtk +import vte + +# FIXME: figure out why we don't get a PID here. +def exited_cb(terminal): + gtk.mainquit() + +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() + terminal.show() + window.add(terminal) + window.show() + gtk.main() |