
Wafepython is an extension to Python allowing to build python
applications with graphical user interfaces based on the OSF/Motif or
Athena Widget set. Wafe can be build with X11R4 (not recommended),
X11R5 and X11R6. Wafe is essentially Tcl+Xt+Extensions+WidgetSets.
Wafe was initially developed as a tool for building frontends for
non-c-languages, but can be used as well as a scripting language based
on Tcl, as an interactive shell, or for embedding in various
languages. Wafepython is an example of embedding (as wafeperl is for
extending Perl with GUI functionality)

As shipped on can build either an OSF/MOTIF version using

    - OSF/Motif 1.1 or OSF/Motif 1.2 (all widgets are supported)
    - XmGraph (an editable graph widget by Douglas Young)
    - Plotter (series of widgets for bar and line graphs 
      (Peter Klingebiel <klin@iat.uni-paderborn.de>
    - HTML widget (from Mosaic 2.4, Marc Andreessen, former NCSA)
    - XPM-Library (Arnaud Le Hors <lehors@sophia.inria.fr>)
    - RDD (Drag and Drop library, can be used in parallel to the
      Motif 1.2 drag and drop code, by Roger Reynolds <rogerr@netcom.com>)
    - debug (debugging and profiling by Fred Fish)

The Athena widget set library is shipped to build with the following
packages:

    - Xaw3d (3d version of the Athena widget set, all widgets are 
      supported, including the Layout widget by Keith Packard)
    - Plotter (series of widgets for bar and line graphs 
      (Peter Klingebiel <klin@iat.uni-paderborn.de>
    - HTML widget (from Mosaic 2.4, Marc Andreessen, former NCSA)
    - XPM-Library (Arnaud Le Hors <lehors@sophia.inria.fr>)
    - RDD (Drag and Drop library)
    - debug (debugging and profiling by Fred Fish)

Wafepython has a bi-directional calling interface between 
Python and Wafe based on strings. 

Wafe tries to be a "thin-as-possible" interface to Xt and the
supported widget sets. About 70% of the c-code of Wafe are generated
(by a Perl program). This allows low maintenance costs for supporting
the extensive functionality of X11 and reduces the number of bugs in
Wafe. Another advantage of this approach is that only a very few new
concepts are introduced by Wafe and the standard Xt (or Motif)
knowledge (and literature) can be used for developing wafe
applications.

Wafepython is in the same sense minimal and supports currently the
following commands:


  wafe.cmd(string)                  evaluate string as Wafe command
  wafe.set(nameString,valueString)  set the Tcl variable named in 
                                    the first argument to the value
                                    in the second argument
  wafe.process_events()             start the event processing loop
                                    of Wafe (should be the last command
                                    in the script)

In addition, the following Wafe commands is created during
initialization of Wafe to archive the `Wafe-calls-Python' interface:

   python call <pythonFunctionName> <arguments> ...
   python exec <pythonStatement>
   python eval <pythonExpression>

"python call ..." implements an interface purely based on strings, all
input arguments and the return value is a string.  If other input data
types are needed as input argument, the called Python function has to
perform the conversions (eg. using eval()). <arguments> is a space
separated argument list of arbitrary length (may be empty).

"python exec <pythonStatement>"  executes the passed <pythonStatement>,
which has to be in valid Python syntax (quoting etc). From the Tcl
point of view, <pythonStatement> has to be a single argument. 

For example
                  python exec {print "hello world!"} 

will execute 'print "hello world!"' as a Python statement.

"python eval <pythonExpression>" is very similar to "python exec .."
but evaluates <pythonExpression> and returns its result as string to
Tcl.  
For example
                  set tclVar [python eval 1+1]

will set the Tcl variable tclVar to the result of the Python
expression (should be 2).

Four sample scripts (demo1 to demo4) are shipped with wafepython.  The
first two are for the Athena widget set, the latter are for OSF/Motif.
The demo scripts are VERY similar to the scripts provided with
wafeperl and do not exploit any sophisticated python functionality.


Installation
------------

To install wafepython, move or copy the files in 

    WAFEHOME/wafepython/Extensions/wafe/* 
to  
    PYTHONHOME/Extensions/wafe/

where PYTHONHOME points to the source directory of Python. If you do
not have the Python extensions installed, obtain extensions.tar.gz
from ftp.cwi.nl (the extensions are mainly needed for creating the
Makefile). As shipped, wafepython is configured to build with the
Athena widget set.

Go into python*/Extension/wafe and edit Setup.in.  You will have to
set the WAFEHOME directory and you might want to change the provided
setup (building for example a Motif version). To build wafepython,
issue the following commands
 
  make Makefile -f Makefile.pre.in
  make

This should build a new python binary in the python*/Extension/wafe
directory. Note, that the demo scripts use the name wafepython and
mofepython in their header line. you might want to rename python to
these names as well.


Comments
--------

The python documentation is very good, installation, reading through
the introduction etc can be done in a fairly short time. 

The biggest problem i had was using Python together with certain
OSF/Motif widgets. It turns out that if regular expression externals
in OSF/Motif are resolved against the python libraries, weird things
start to happen. I would strongly recommend to hide these externals in
future versions of Python. For the time being, please apply the
following patch below (made against python-1.0.2).

wafepython was developed under Linux 1.0 and tested under AIX 3.2.5 as 
well.

 Gustaf Neumann              Mohegan Lake, NY, Sat Jun  4 18:58:22

====================================================================
*** Modules/Setup.in.ORIG	Sat Jun  4 17:28:39 1994
--- Modules/Setup.in	Sat Jun  4 17:46:15 1994
***************
*** 58,63 ****
--- 58,71 ----
  
  PYTHONPATH=.:$(DESTLIB)$(TESTPATH)$(ARCHPATH)$(STDWINPATH)
  
+ RENAMEREGEXP = \
+ 	re_compile_fastmap=PYre_compile_fastmap \
+ 	-Dre_compile_pattern=PYre_compile_pattern \
+ 	-Dre_match=PYre_match \
+ 	-Dre_match_2=PYre_match_2 \
+ 	-Dre_search=PYre_search \
+ 	-Dre_search_2=PYre_search_2 \
+ 	-Dre_set_syntax=PYre_set_syntax
  
  # Modules that should always be present (non UNIX dependent)
  
***************
*** 65,71 ****
  math mathmodule.o	# math library functions, e.g. sin()
  parser parsermodule.o	# raw interface to the Python parser
  posix posixmodule.o	# posix (UNIX) system calls
! regex regexmodule.o regexpr.o	# Regular expressions, GNU Emacs style
  strop stropmodule.o	# fast string operations implemented in C
  struct structmodule.o	# binary structure packing/unpacking
  time timemodule.o	# time operations and variables
--- 73,79 ----
  math mathmodule.o	# math library functions, e.g. sin()
  parser parsermodule.o	# raw interface to the Python parser
  posix posixmodule.o	# posix (UNIX) system calls
! regex regexmodule.o regexpr.o -D$(RENAMEREGEXP)	# Regular expressions, GNU Emacs style
  strop stropmodule.o	# fast string operations implemented in C
  struct structmodule.o	# binary structure packing/unpacking
  time timemodule.o	# time operations and variables
