PYV version 1.21


Contributions and BUG reports please send to Sofin Raskin(sofin@ecitele.com)


----------------------------------------------------------------------------
1. Introduction.
2. Implementation notes.
3. Installation.
4. How to run PYV.
5. Documentation.
6. Demos.
7. Copyright.
----------------------------------------------------------------------------

1. Introduction.

PYV is a binding of Python and Portable GUI V. More information about:
Python
	http://www.python.org

GUI V
	http://www.cs.unm.edu/~wampler/vgui/vgui.html



2. Implementation notes.

   PYV development and testing has been done on UNIX platforms 
   (Sun OS 4.1, Solaris, Linux) and Windows 95.

   
   V application has main() function inside V library. User
   has to run his application from AppMain entry. File pyvmain.cpp
   contains binding function between V and Python:

 
		extern "C" PYVmain(int argc, char** argv);
 
		int AppMain(int argc, char** argv)
		{
		    PYVmain(argc, argv);
		}

   UNIX. Pointer PYVmain is created by compilation of Python main file
   	 with the definition main=PYVmain.
   W95.  File PC/main_nt.c includes the function PYVmain.

   

   Sometimes it is useful to run PYV in interactive mode, for example to
   debug PYV application with pdb debugger or/and to debug with gdb. For 
   these reason, I don't return from AppMain call, and call EventLoop 
   directly from Python code. I added the method doEventLoop to vApp class. 
   This method must be called, when user decides to enter to this loop.

   This method presents in UNIX & W95.   



   I/O library to read/write various image bitmap formats in file imageio.c
   is from ../iconed. According to the Copyright label, all credits to
   Philip Eckenroth, Mike Tipping, Marilee Padilla, 
   John Fredric Jr. Masciantoni, and Bruce E. Wampler.


3. Installation.


	Tunable definitions are placed in the file pyvdef.h.

		#define vApp_simSDI  0
			Is relevant only for Windows platforms.
				0 - MDI 
				1 - SDI
	
		#define vApp_fh      0 //600-20     // In vapp.cpp fh+20
		#define vApp_fw      0 //800-20     //             fw+20
	
	


   UNIX.  Full source code is available in this directory. 
          Compilation requires g++ and gcc compilers version 2.6.0 or upper.

	  Makefile uses python exec in order to create dependencies. Python
	  should be in the path and PYTHONPATH should be defined properly.
	  For more info see Python manuals.

  	  Compilation steps:
		1. All distribution should be copy to the directory
		   pyV under V distribution tree - $HOMEV/pyV.


		2. One change of V source code should be done. Include file:
		   $HOMEV/include/vapp.h in class vApp method doEventLoop() 
		   should be moved from private to public.
		   Additional bug fixes according to the V.BUGS file should
		   be applied to the V source distribution. 
		   You can copy patched file for the proper V version
		   from the directory:
				Patches/V.15/Unix/ 
		   to the following V sub-directories:
				*.cxx --  srcx/
				*.h   -- includex/v/

		3. There are two files config.c : config.c-1.3, config.c-1.4. 
		   One of them 	should be choused, depending on the version of 
		   Python. Copy right file to config.c.
		   If you have additional modules you can edit config.c to add
		   proper init functions.

		4. Makefile must be edited in order to define:
			ARCH       - current architecture
			PYT_DIR      - source tree of Python distribution
			HOMEV	   - source tree of GUI V distribution.
			X11INC     - X11 include directory
			X11LIB     - X11 libraries
			LIBS       - additional libraries

		      Examples of definitions:
		   SunOS:
			ARCH	=       sun4
			PYT_DIR =	/home/sofin/Python-1.4
			HOMEV	=	/home/sofin/v
			X11INC	=	/usr/include
			X11LIB	=	/usr/lib
			LIBS	=	-lV  -lXaw  -lXmu -lXt -lXext -lX11  


		   Sun Solaris:
			ARCH	=       sun4
			PYT_DIR =	/home/sofin/Python-1.4
			HOMEV	=	/home/sofin/v
			X11INC	=	/usr/local/X11R6/include
			X11LIB	=	/usr/local/X11R6/lib
			LIBS	=	-lV -lXaw -lXmu -lXt -lXext -lX11 -lsocket -lnsl -ldl -lm 


		   Linux:
			Arch	=	intel
			PYT_DIR =	/home/sofin/Python1.4beta3
			HOMEV	=	/home/sofin
			X11INC	=	/usr/X11/include
			X11LIB	=	/usr/X11R6/lib
			LIBS	=	-lV -lieee -ldl -lXaw -lXmu -lXt -lXext -lX11




                Windows 95.

        	For Win95 I use only Python-1.4 version. This version has special
        directory for WIN32 compilations. In Win95 PYV works as window
        application. I wanted to redirect stdout & stderr to log window and
        file. In order to achieve this I defined macros to substitute
        printf,fprintf,puts,fputs,putc,fputc,fgets,fwrite by my own functions.
        This definitions are in the tail of PC/config.h. File PC/config.c
        includes functions IO redirections, PYV init function and SetVinit -
        initialization of the function pointers in DLL.

        	If you want to compile Python for the PC copy config.h and config.c to
        the directory PC in python distribution and follow compilation
        instructions in Python. After compilation and linking you get DLL
        PYTHON14.DLL. This DLL is suitable to use only with PYV. PYTHON.EXE
        couldn't use it.

        	Patches should be done in V also.  Same patch as in X version
        but on the Windows three.  File includew/v/vapp.h in class vApp method
        doEventLoop() should be moved from private to public. W95 version of V
        should be recompiled after the patching.
		Second patch is not must but "nice to have". This patch enables
	to use async socket communication. In order to get user defined messages
	you must to define the new method PYV_Win_Msg_Process in file vbasewin.h,
	and to call this method at the end of the switch in file vwindow.cpp.
	How to do this refer to the files in directory Patches/V.15/W95/vwindow.cpp.
	These are ready to use patches for the version V1.15. For the next versions
	do like this. It's really simple. If you decide to exclude this option and to
	omit the second patch in V, go to the file vmodule.h and uncomment definition:

	#define DONT_WANT_PYV_Win_Msg_Process

	This should allow you to compile PYV without this option. This patch requires
	library WSOCK32.LIB.

	You can copy patched files for the proper V version
	from the directory:
			Patches/V.15/W95/ 
	to the following V sub-directories:
			*.cxx --  srcwin/
			*.h   -- includew/v/


        	All development process I did in UNIX environment. Only compilation
        and execultion have been done on the target W95. I wrote python 
        script mkbat.py, that generates the Tools/mkall.bat command file. On PC
        I run Tools\mkall.bat that compiled and linked PYV. After execution of
        Tools/mkall.bat has been produced second file Tools\mkdep.bat, that has
        result of checking of sources against objects(somthing like make on UNIX).
        mkbat.py requires to define right place of:
        Python_base -- Home of Python distribution.
        V_inc       -- Path to the Include definitions of V Windows version.
        V_lib       -- Win95 library of V.



        Run mkall.bat and you probably get pyvw95.exe.


If you have any problems or questions send me mail (sofin@ecitele.com) 
and I try to help you.


4. How to run PYV.

	To run PYV application press :
	
	$ pyV.sun4 <python_file>

	for example to run "Hello, World !!!" version of PYV :

	$ pyV.sun4 demo1.py


	Python debugger pdb allows to debug PYV applications.

	You should  run pyV.sun4 and import pdb. 
	This is example of pdb debug session.

	$ pyV.sun4
	Python 1.3 (Jul 29 1996)  [GCC 2.6.0]
	Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
        >>> import pdb
        >>> pdb.run('import demo1')
        > <string>(0)?()
        (Pdb) s
        > <string>(1)?()
        (Pdb) s
        > ./demo1.py(0)?()
        (Pdb) s
        > ./demo1.py(1)?()
        -> from v import *
        (Pdb) l
          1  -> from v import * 
          2     from V import *
          3  
          4  
          5     CommandList=[
          6     [C_Button, 414, 0,  "Select Font", [], CA_None, isSens, 0, 0,   0,  0],
          7     [C_Button, 415, 0,  "Exit",        [], CA_None, isSens, 0, 414, 0,  0]
          8     ]
          9  
         10  
         11     def cb_Window(id, retval, ctype):
        (Pdb) l
         12             global txt, win, app
         13             fnt  = app.GetDefaultFont()
         14             if id==414: 
         15                     (rez,fnt)=vFontSelect(win, fnt)
         16                     if rez:  txt.SetFont(fnt)
         17             if id==415:     app.Exit()
         18  
         19  
         20     def cb_ResizeText(rows, cols):
         21             global txt, fnt, Text
         22             txt.Clear();    txt.GotoRC(rows/2, cols/2-len(Text)/2);
        (Pdb) b 14
        (Pdb) c
        Warning: Unable to load any useable fontset
        > ./demo1.py(14)cb_Window()
        -> if id==414:
        (Pdb) p id
        414
        (Pdb) p id, retval, ctype
        (414, 0, 4)
        (Pdb) c
         
        There is the fronted vdb.py for the debugger pdb. vdb.py is placed in
	Demos/vdb.py.


5. Documentation.

	Python documentation is available from Python home page.
	You can find postsript manuals of Python and pointers to Python books.


        V documentation.
	Bruce E. Wampler wrote "V a C++ GUI Framework". Available on V home site.
	Current Version is 1.14 (1/11/96).


	PYV.DOC is my quck and dirty reference of PYV interface from Python.
	This is ASCII document, that describes only Python classes, methods
	and functions and parameteres to them. The general concept and the
	usage of these classes see in manual to V of Bruce E. Wampler.


6. Demos.
       Check the directory /Demos.
	The ile Demos/readme.txt gives short explanation about contents of
	this directory. 


7. Copyright.
        See file COPYRIGHT. 



Sofin Raskin
sofin@ecitele.com


------------- End Of Document -------------