Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Wednesday, May 7, 2008

How to record your Mac OS 10.5 Leopard screen to SWF

Sometimes when you want to demo an application or even create a step by step tutorial on something, there is nothing better then a live recording of the action. In those cases vnc2swf is a small and very handy python script able to help you on that job.

I am not very sure on what it depends, but you would need X11, Freetype 2, jpeg and Python Imaging Library (PIL) at least. Python of course, but Leopard already comes with version 2.5. I am not sure about GTK, I already had that on my system. If you don't, please take a look at Compiling GTK+ on Mac OS X 10.5 Leopard and get it to your system. That same post would help you setup all the dependencies but PIL, that we are going to cover now.

Download PIL source code to /usr/src. I assume all your own compiled libraries are installed to /usr/local and you used architecture i686.


cd /usr/src
wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz
tar -zxf Imaging-1.1.6.tar.gz
cd Imaging-1.1.6


Now you need to hack setup.py accoding to that diff:


--- setup.py.orig 2006-12-03 09:37:29.000000000 -0200
+++ setup.py 2008-05-06 21:13:29.000000000 -0300
@@ -131,14 +131,10 @@

elif sys.platform == "darwin":
# attempt to make sure we pick freetype2 over other versions
- add_directory(include_dirs, "/sw/include/freetype2")
- add_directory(include_dirs, "/sw/lib/freetype2/include")
+ add_directory(include_dirs, "/usr/local/include/freetype2")
# fink installation directories
- add_directory(library_dirs, "/sw/lib")
- add_directory(include_dirs, "/sw/include")
- # darwin ports installation directories
- add_directory(library_dirs, "/opt/local/lib")
- add_directory(include_dirs, "/opt/local/include")
+ add_directory(library_dirs, "/usr/local/lib")http://www.blogger.com/img/gl.link.gif
+ add_directory(include_dirs, "/usr/local/include")

add_directory(library_dirs, "/usr/local/lib")
# FIXME: check /opt/stuff directories here?


Then you are done to build:


export ARCHFLAGS="-arch i686"
export CFLAGS="-arch i686"
python setup.py build
sudo python setup.py install


Now you would just unzip and go vnc2swf but I couldn't make it work with Leopard's built-in VNC server (Screen Sharing) so you first need OSXVnc. Download the disc image, mount it and copy Vine Server to your Applications folder. Run and start the server.



You are now ready to go vnc2swf:


cd /usr/src
wget http://www.unixuser.org/~euske/vnc2swf/pyvnc2swf-0.9.3.tar.gz
tar -zxf pyvnc2swf-0.9.3.tar.gz
cd pyvnc2swf-0.9.3/pyvnc2swf/
./vnc2swf.py -n -o /tmp/myMovie.swf

Wednesday, March 26, 2008

GTK Python bindings for Mac OS X 10.5 Leopard

Following my previous post we are now ready to compile and install the python bindings in order to have UMIT ready to go.

we start with pygobject which is cursed by Murphy's law. At the first attempt I got make stopped by an error message, that could be fixed by telling which python version we would like to use (one more time thanks to macports).
wget http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.14/pygobject-2.14.1.tar.bz2
tar -jxf pygobject-2.14.1.tar.bz2
cd pygobject-2.14.1
./configure --prefix=/usr/local --disable-glibtest CFLAGS="-arch i686" PYTHON=/usr/bin/python2.5
make
sudo make install
next pycairo:
wget http://cairographics.org/releases/pycairo-1.4.12.tar.gz
tar -zxf pycairo-1.4.12.tar.gz
./configure --prefix=/usr/local CFLAGS="-arch i686" PYTHON=/usr/bin/python2.5
make
sudo make install
and finally pygtk:
wget http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.12/pygtk-2.12.1.tar.bz2
tar -jxf pygtk-2.12.1.tar.bz2
cd pygtk-2.12.1
./configure --prefix=/usr/local CFLAGS="-arch i686" PYTHON=/usr/bin/python2.5
make
sudo make install
that's the end of our saga. You can now enjoy UMIT on your Mac OS :)