[4] | 1 | ----------------------------------------------------- |
---|
| 2 | |
---|
| 3 | PY_SAIL - write SAGE applications in python |
---|
| 4 | |
---|
| 5 | ----------------------------------------------------- |
---|
| 6 | Author: Ratko Jagodic |
---|
| 7 | Last Update: April 19, 2007 (updated for SAGE 2) |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | PREREQUISITES: |
---|
| 13 | ---------------------------------------------------- |
---|
| 14 | - python (any fairly recent version should work) |
---|
| 15 | - gcc compiler |
---|
| 16 | - compiled SAGE and the $SAGE_DIRECTORY |
---|
| 17 | environment variable set up |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | HOW TO INSTALL: |
---|
| 22 | ---------------------------------------------------- |
---|
| 23 | - run the "install_me" script |
---|
| 24 | - this will create the py_sail.so and put it into |
---|
| 25 | $SAGE_DIRECTORY/lib |
---|
| 26 | - it may also create another file ending in .egg-info |
---|
| 27 | (if it's there, leave it, if not, don't worry) |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | RUN THE TEST EXAMPLE: |
---|
| 32 | ---------------------------------------------------- |
---|
| 33 | - test.py is an example of how to write your applications |
---|
| 34 | with py_sail |
---|
| 35 | - since this is python, there is no need to install the |
---|
| 36 | example but you still need to configure it |
---|
| 37 | - in your $SAGE_DIRECTORY/bin/appLauncher/sage.conf add |
---|
| 38 | something like this (change the paths of course): |
---|
| 39 | |
---|
| 40 | pysail_test { |
---|
| 41 | configName test |
---|
| 42 | nodeNum 1 |
---|
| 43 | Init 100 100 600 600 |
---|
| 44 | exec 127.0.0.1 python /home/evl/rjagodic/sage2/app/py_sail/test.py |
---|
| 45 | nwProtocol tvTcpModule.so |
---|
| 46 | binDir /home/evl/rjagodic/sage2/app/py_sail |
---|
| 47 | staticApp |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | - now you can run the test from the SAGE UI by clicking |
---|
| 51 | on its icon and a small rectangle with a gradient |
---|
| 52 | should show up on your SAGE display |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | WRITE YOUR OWN APPLICATIONS WITH PY_SAIL: |
---|
| 57 | ---------------------------------------------------- |
---|
| 58 | - the main steps go something like this: |
---|
| 59 | |
---|
| 60 | (1) import py_sail |
---|
| 61 | (2) initialize your application with py_sail.initSail() |
---|
| 62 | (3) get your buffer and send it to py_sail with py_sail.setBuffer() |
---|
| 63 | (you use this function every time you want to swap a buffer) |
---|
| 64 | (4) check for sail messages with py_sail.checkMessages() |
---|