Commit 9d9c902e authored by Christian Persch's avatar Christian Persch
Browse files

Remove gtk2 python bindings

parent 3bdb0639
dnl From msw.
dnl
dnl a macro to check for ability to create python extensions
dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
dnl function also defines PYTHON_INCLUDES
AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
[AC_REQUIRE([AM_PATH_PYTHON])
AC_MSG_CHECKING(for headers required to compile python extensions)
dnl deduce PYTHON_INCLUDES
py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
if test -x "$PYTHON-config"; then
PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null`
else
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
if test "$py_prefix" != "$py_exec_prefix"; then
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
fi
fi
PYTHON_LIBS="-L${py_prefix}/libs -lpython${PYTHON_VERSION}"
AC_SUBST(PYTHON_INCLUDES)
AC_SUBST(PYTHON_LIBS)
dnl check if the headers exist:
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
AC_TRY_CPP([#include <Python.h>],dnl
[AC_MSG_RESULT(found)
$1],dnl
[AC_MSG_RESULT(not found)
$2])
CPPFLAGS="$save_CPPFLAGS"
])
......@@ -208,12 +208,6 @@ WARN_CFLAGS=$vte_cv_warn_cflags
AC_SUBST(WARN_CFLAGS)
CFLAGS="$CFLAGS $WARN_CFLAGS"
PYTHON_LDFLAGS=""
for W in "-Wl,--warn-unresolved-symbols"; do
VTE_LD_TRY_FLAG([$W], [PYTHON_LDFLAGS="$PYTHON_LDFLAGS $W"])
done
AC_SUBST(PYTHON_LDFLAGS)
# Enable debugging messages and additional run-time checks.
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],
......@@ -414,85 +408,6 @@ wcs_funcs_includes="
AC_CHECK_TYPES(wint_t, AC_DEFINE(HAVE_WINT_T, , [Defined when the wint_t type is supported]), ,$wcs_funcs_includes)
################################################################################
# Auxillary modules
################################################################################
if test "$with_gtk" = "2.0"; then
# Search for Python.
BUILD_PYTHON=true
AC_ARG_ENABLE(python, [AS_HELP_STRING(--enable-python,Build python bindings [default=yes])],[
if test x"$enableval" != xno ; then
BUILD_PYTHON=true
else
BUILD_PYTHON=false
fi],BUILD_PYTHON=true)
if $BUILD_PYTHON ; then
AM_PATH_PYTHON
if test -z "$PYTHON" ; then
BUILD_PYTHON=false
fi
fi
if $BUILD_PYTHON ; then
AC_MSG_CHECKING(for python >= 2.2)
prog="
import sys, string
minver = (2,2,0,'final',0)
if sys.version_info < minver:
sys.exit(1)
sys.exit(0)
"
if $PYTHON -c "$prog" 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
then
AC_MSG_RESULT([okay])
else
BUILD_PYTHON=false
AC_MSG_RESULT([too old])
fi
fi
if $BUILD_PYTHON ; then
AM_CHECK_PYTHON_HEADERS(,BUILD_PYTHON=false)
fi
if $BUILD_PYTHON ; then
AC_MSG_CHECKING([for pygtk-2.0])
if pkg-config --exists pygtk-2.0 ; then
AC_MSG_RESULT([found])
PKG_CHECK_MODULES(PYGTK,[pygtk-2.0])
AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no)
if test "x$PYGTK_CODEGEN" = xno; then
AC_MSG_ERROR(could not find pygtk-codegen-2.0 script)
fi
AC_MSG_CHECKING(for pygtk defs)
PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
AC_SUBST(PYGTK_DEFSDIR)
AC_MSG_RESULT($PYGTK_DEFSDIR)
else
AC_MSG_RESULT([not found])
BUILD_PYTHON=false
fi
fi
if ! $BUILD_PYTHON ; then
AC_MSG_RESULT([Python bindings disabled.])
fi
AC_SUBST(PYTHONREV)
AC_SUBST(PYTHONMODULES)
else # with_gtk = 3.0
BUILD_PYTHON=false
fi # with_gtk = 2.0
AM_CONDITIONAL(BUILD_PYTHON_MODULES, $BUILD_PYTHON)
################################################################################
# GNOME PTY Helper
################################################################################
......@@ -562,8 +477,6 @@ src/Makefile
src/vteversion.h
termcaps/Makefile
perf/Makefile
python/Makefile
python/pyvte.pc
po/Makefile.in
doc/Makefile
doc/openi18n/Makefile
......
EXTRA_DIST = vte.defs pyvte.pc.in vte.override cat.py unrealize.py vte-demo.py
if BUILD_PYTHON_MODULES
defsdir = $(datadir)/pygtk/2.0/defs
defs_DATA = vte.defs
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = pyvte.pc
PYTHON_MODULES = vtemodule.la
pythonsiteexecdir = $(pyexecdir)/gtk-2.0
pythonsiteexec_LTLIBRARIES = $(PYTHON_MODULES)
CLEANFILES = vte.c
vtemodule_la_SOURCES = vtemodule.c
vtemodule_la_CPPFLAGS = -I$(top_builddir)/src $(AM_CPPFLAGS)
vtemodule_la_CFLAGS = $(VTE_CFLAGS) $(X_CFLAGS) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) $(AM_CFLAGS)
# we do this to suport building with -Wl,-z,defs which errors on
# vtemodule.so as we cannot include $(PYTHON_LIBS) due to bug 410986.
vtemodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex initvte $(PYTHON_LDFLAGS) $(AM_LDFLAGS)
vtemodule_la_LIBADD = $(top_builddir)/src/libvte.la $(LIBS) $(PYGTK_LIBS) $(VTE_LIBS) $(X_LIBS)
nodist_vtemodule_la_SOURCES = vte.c
vte.c: vte.defs vte.override
.defs.c:
$(AM_V_GEN) (cd $(srcdir) \
&& $(PYGTK_CODEGEN) \
--register $(PYGTK_DEFSDIR)/pango-types.defs \
--register $(PYGTK_DEFSDIR)/gdk-types.defs \
--register $(PYGTK_DEFSDIR)/gtk-types.defs \
--override $*.override \
--prefix py$* $*.defs) > gen-$*.c \
&& cp gen-$*.c $*.c \
&& rm -f gen-$*.c
endif
-include $(top_srcdir)/git.mk
#!/usr/bin/python
import sys
import string
import getopt
import gtk
import vte
def main_quit(object, *args):
gtk.main_quit()
def commit_cb(object, *args):
(text, length) = args
# Echo the text input by the user to stdout. Note that the string's
# length isn't always going to be right.
if (0):
sys.stdout.write(text)
sys.stdout.flush()
else:
# Test the get_text() function.
for line in (string.splitfields(object.get_text(),"\n")):
if (line.__len__() > 0):
print line
# Also display it.
object.feed(text, length)
if __name__ == '__main__':
font = "fixed 12"
scrollback = 100
# Let the user override them.
(shorts, longs) = getopt.getopt(sys.argv[1:], "f:", ["font="])
for argpair in (shorts + longs):
if ((argpair[0] == '-f') or (argpair[0] == '--font')):
print "Setting font to `" + argpair[1] + "'."
font = argpair[1]
window = gtk.Window()
window.connect("delete-event", main_quit)
terminal = vte.Terminal()
terminal.set_cursor_blinks(gtk.TRUE)
terminal.set_emulation("xterm")
terminal.set_font_from_string(font)
terminal.set_scrollback_lines(1000)
terminal.set_audible_bell(gtk.TRUE)
terminal.set_visible_bell(gtk.FALSE)
terminal.connect("commit", commit_cb)
terminal.show()
scrollbar = gtk.VScrollbar()
scrollbar.set_adjustment(terminal.get_adjustment())
box = gtk.HBox()
box.pack_start(terminal)
box.pack_start(scrollbar)
window.add(box)
window.show_all()
gtk.main()
prefix=@prefix@
exec_prefix=@exec_prefix@
includedir=@includedir@
datarootdir=@datarootdir@
datadir=@datadir@
Name: PyVte
Description: Python bindings for the Vte terminal widget.
Requires: vte
Version: @VERSION@
#!/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()
#!/usr/bin/python
import sys
import string
import getopt
import gtk
import vte
def selected_cb(terminal, column, row, cb_data):
if (row == 15):
if (column < 40):
return 1
return 0
def restore_cb(terminal):
(text, attrs) = terminal.get_text(selected_cb, 1)
print "A portion of the text at restore-time is:"
print text
def child_exited_cb(terminal):
gtk.main_quit()
if __name__ == '__main__':
child_pid = -1;
# Defaults.
audible = 0
background = None
blink = 0
command = None
emulation = "xterm"
font = "fixed 12"
scrollback = 100
transparent = 0
visible = 0
# Let the user override them.
(shorts, longs) = getopt.getopt(sys.argv[1:], "B:Tabc:f:n:t:v", ["background", "transparent", "audible", "blink", "command=", "font=", "scrollback=", "terminal=", "visible"])
for argpair in (shorts + longs):
if ((argpair[0] == '-B') or (argpair[0] == '--background')):
print "Setting background image to `" + argpair[1] + "'."
background = argpair[1]
if ((argpair[0] == '-T') or (argpair[0] == '--transparent')):
print "Setting transparency."
transparent = not transparent
if ((argpair[0] == '-a') or (argpair[0] == '--audible')):
print "Setting audible bell."
audible = not audible
if ((argpair[0] == '-b') or (argpair[0] == '--blink')):
print "Setting blinking cursor."
blink = not blink
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] == '-n') or (argpair[0] == '--scrollback')):
scrollback = string.atoi(argpair[1])
if (scrollback == 0):
scrollback = 100
else:
print "Setting scrollback size to `" + str(scrollback) + "'."
if ((argpair[0] == '-t') or (argpair[0] == '--terminal')):
print "Setting terminal type to `" + argpair[1] + "'."
emulation = argpair[1]
if ((argpair[0] == '-v') or (argpair[0] == '--visible')):
print "Setting visible bell."
visible = not visible
window = gtk.Window()
terminal = vte.Terminal()
if (background):
terminal.set_background_image(background)
if (transparent):
terminal.set_background_transparent(gtk.TRUE)
terminal.set_cursor_blinks(blink)
terminal.set_emulation(emulation)
terminal.set_font_from_string(font)
terminal.set_scrollback_lines(scrollback)
terminal.set_audible_bell(audible)
terminal.set_visible_bell(visible)
terminal.connect("child-exited", child_exited_cb)
terminal.connect("restore-window", restore_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()
scrollbar = gtk.VScrollbar()
scrollbar.set_adjustment(terminal.get_adjustment())
box = gtk.HBox()
box.pack_start(terminal)
box.pack_start(scrollbar)
window.add(box)
window.show_all()
gtk.main()
;; -*- scheme -*-
; object definitions ...
(define-object Terminal
(in-module "Vte")
(parent "GtkWidget")
(c-name "VteTerminal")
(gtype-id "VTE_TYPE_TERMINAL")
)
;; Enumerations and flags ...
(define-enum TerminalEraseBinding
(in-module "Vte")
(c-name "VteTerminalEraseBinding")
(gtype-id "VTE_TYPE_TERMINAL_ERASE_BINDING")
(values
'("auto" "VTE_ERASE_AUTO")
'("ascii-backspace" "VTE_ERASE_ASCII_BACKSPACE")
'("ascii-delete" "VTE_ERASE_ASCII_DELETE")
'("delete-sequence" "VTE_ERASE_DELETE_SEQUENCE")
)
)
(define-enum TerminalAntiAlias
(in-module "Vte")
(c-name "VteTerminalAntiAlias")
(gtype-id "VTE_TYPE_TERMINAL_ANTI_ALIAS")
(values
'("use-default" "VTE_ANTI_ALIAS_USE_DEFAULT")
'("force-enable" "VTE_ANTI_ALIAS_FORCE_ENABLE")
'("force-disable" "VTE_ANTI_ALIAS_FORCE_DISABLE")
)
)
(define-enum TerminalCursorBlinkMode
(in-module "Vte")
(c-name "VteTerminalCursorBlinkMode")
(gtype-id "VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE")
(values
'("system" "VTE_CURSOR_BLINK_SYSTEM")
'("on" "VTE_CURSOR_BLINK_ON")
'("off" "VTE_CURSOR_BLINK_OFF")
)
)
(define-enum TerminalCursorShape
(in-module "Vte")
(c-name "VteTerminalCursorShape")
(gtype-id "VTE_TYPE_TERMINAL_CURSOR_SHAPE")
(values
'("block" "VTE_CURSOR_SHAPE_BLOCK")
'("ibeam" "VTE_CURSOR_SHAPE_IBEAM")
'("underline" "VTE_CURSOR_SHAPE_UNDERLINE")
)
)
;; From vte.h
(define-function vte_terminal_get_type
(c-name "vte_terminal_get_type")
(return-type "GType")
)
(define-function vte_terminal_new
(c-name "vte_terminal_new")
(is-constructor-of "VteTerminal")
(return-type "GtkWidget*")
)
(define-method fork_command
(of-object "VteTerminal")
(c-name "vte_terminal_fork_command")
(return-type "pid_t")
(parameters
'("const-char*" "command")
'("char**" "argv")
'("char**" "envv")
'("const-char*" "directory")
'("gboolean" "lastlog")
'("gboolean" "utmp")
'("gboolean" "wtmp")
)
)
(define-method forkpty
(of-object "VteTerminal")
(c-name "vte_terminal_forkpty")
(return-type "pid_t")
(parameters
'("char**" "envv")
'("const-char*" "directory")
'("gboolean" "lastlog")
'("gboolean" "utmp")
'("gboolean" "wtmp")
)
)
(define-method feed
(of-object "VteTerminal")
(c-name "vte_terminal_feed")
(return-type "none")
(parameters
'("const-char*" "data")
'("glong" "length" (default "-1"))
)
)
(define-method feed_child
(of-object "VteTerminal")
(c-name "vte_terminal_feed_child")
(return-type "none")
(parameters
'("const-char*" "text")
'("glong" "length" (default "-1"))
)
)
(define-method feed_child_binary
(of-object "VteTerminal")
(c-name "vte_terminal_feed_child_binary")
(return-type "none")
(parameters
'("const-char*" "data")
'("glong" "length" (default "-1"))
)
)
(define-method copy_clipboard
(of-object "VteTerminal")
(c-name "vte_terminal_copy_clipboard")
(return-type "none")
)
(define-method paste_clipboard
(of-object "VteTerminal")
(c-name "vte_terminal_paste_clipboard")
(return-type "none")
)
(define-method copy_primary
(of-object "VteTerminal")
(c-name "vte_terminal_copy_primary")
(return-type "none")
)
(define-method paste_primary
(of-object "VteTerminal")
(c-name "vte_terminal_paste_primary")
(return-type "none")
)
(define-method select_all
(of-object "VteTerminal")
(c-name "vte_terminal_select_all")
(return-type "none")
)
(define-method select_none
(of-object "VteTerminal")
(c-name "vte_terminal_select_none")
(return-type "none")
)
(define-method set_size
(of-object "VteTerminal")
(c-name "vte_terminal_set_size")
(return-type "none")
(parameters
'("glong" "columns")
'("glong" "rows")
)
)
(define-method set_audible_bell
(of-object "VteTerminal")
(c-name "vte_terminal_set_audible_bell")
(return-type "none")
(parameters
'("gboolean" "is_audible")
)
)
(define-method get_audible_bell
(of-object "VteTerminal")
(c-name "vte_terminal_get_audible_bell")
(return-type "gboolean")
)
(define-method set_visible_bell
(of-object "VteTerminal")
(c-name "vte_terminal_set_visible_bell")
(return-type "none")
(parameters
'("gboolean" "is_visible")
)
)
(define-method get_visible_bell
(of-object "VteTerminal")
(c-name "vte_terminal_get_visible_bell")
(return-type "gboolean")
)
(define-method set_scroll_background
(of-object "VteTerminal")
(c-name "vte_terminal_set_scroll_background")
(return-type "none")
(parameters
'("gboolean" "scroll")
)
)
(define-method set_scroll_on_output
(of-object "VteTerminal")
(c-name "vte_terminal_set_scroll_on_output")
(return-type "none")
(parameters
'("gboolean" "scroll")
)
)
(define-method set_scroll_on_keystroke
(of-object "VteTerminal")
(c-name "vte_terminal_set_scroll_on_keystroke")
(return-type "none")
(parameters
'("gboolean" "scroll")
)