wiki:pyclutter_notes

Version 35 (modified by Martin Kolman, 13 years ago) (diff)

--

Python-Clutter development notes

ModRana? will in the future use Clutter as an alternative to the current non-accelerated GTK GUI. Unfortunately, the documentation to the Python bindings for Clutter is in a sad state. This page serves as a compilation of various Clutter & Python related development notes, with the hope to piece together some sort of documentation for the most needed elements :)

NOTE: all of this information concerns Python bindings for Clutter 1.0

Gathered resources

documentation from various sources

official incomplete documentation, taken from Debian PyClutter package:
http://www.modrana.org/pyclutter for the package.

official documentation improved by Paolo Marti, from his GitHub page:
http://www.modrana.org/pyclutter_marti

PyClutter tutorial, also by Paolo Marti:
http://www.modrana.org/pyclutter_tutorial

complete examples for the above mentioned tutorial:
http://www.modrana.org/pyclutter_tutorial/examples

a short PyClutter tutorial by TuxRadar:
http://www.tuxradar.com/content/code-project-monitor-proc-python-and-clutter

a small PyClutter recipe:
http://otherwiseingle.blogspot.com/2010/02/pyclutter-recipes.html

rounded rectangle actor in Python:
http://www.themacaque.com/?p=565

rounded rectangle actor in Python using Gobject introspection:
http://www.themacaque.com/?p=847

rounded rectangle actor in Python - wiki version:
http://www.themacaque.com/wiki/doku.php?id=clutter:rounded_rectangle

working with images in Python-Clutter:
http://www.themacaque.com/?p=549

creting Clutter texture from Pixbuf:
http://www.themacaque.com/wiki/doku.php?id=clutter:texture_from_pixbuf

issues

actors not getting motion notify events

Call set_reactive(True) on the actor and it will start receiving motion notify events. Clutter does this probably as an optimization, eq. it has to handle the motion notify event only for actors that request it.

compiling more recent clutter version

Raw notes

# compile dependencies
libffi4-dev
libjson-glib-dev
gobject-introspection

export PATH=/opt/bin:$PATH
export LD_LIBRARY_PATH=/opt/lib:/lib:/usr/lib:/usr/local/lib:/usr/X11R6/lib
export PKG_CONFIG_PATH=/opt/lib/pkgconfig/

./configure --enable-gtk-doc --enable-docs=yes --enable-introspection=yes

checking for XEXT extension... configure: error: Not found ????


# libffi4-dev:
  CCLD   g-ir-compiler
../girepository/.libs/libgirepository-1.0.so: undefined reference to `ffi_prep_closure_loc'
../girepository/.libs/libgirepository-1.0.so: undefined reference to `ffi_closure_free'
../girepository/.libs/libgirepository-1.0.so: undefined reference to `ffi_closure_alloc'
collect2: ld returned 1 exit status
make[2]: *** [g-ir-compiler] Error 1

# libffi-dev:
  CC     libgirepository_1_0_la-gdump.lo
  CC     libgirepository_1_0_la-gfield.lo
In file included from gfield.c:4:
girffi.h:24:17: error: ffi.h: No such file or directory
In file included from gfield.c:4:
girffi.h:29: error: expected ')' before '*' token
girffi.h:37: error: expected specifier-qualifier-list before 'ffi_cif'
girffi.h:43: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
girffi.h:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
girffi.h:57: error: expected declaration specifiers or '...' before 'ffi_closure'
make[2]: *** [libgirepository_1_0_la-gfield.lo] Error 1



Compiling gobject-introspection in Maemo scratchbox

1. install libffi-dev
2. symlink libffi header files to correct place
{{{
fakeroot ln -s /usr/include/arm-linux-gnueabi/ffi.h /usr/include/ffi.h
fakeroot ln -s /usr/include/arm-linux-gnueabi/ffitarget.h /usr/include/ffitarget.h
}}}
3. comment out offending constructs in /targets/FREMANTLE_ARMEL/usr/include/sys/stat.h

4. apply:

diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
index cac4fdf..26c2f02 100644
--- a/giscanner/shlibs.py
+++ b/giscanner/shlibs.py
@@ -71,7 +71,7 @@ def _resolve_non_libtool(options, binary, libraries):
     if libtool:
         args.extend(libtool)
         args.append('--mode=execute')
-    args.extend(['ldd', '--list', binary.args[0]])
+    args.extend(['/lib/ld-2.5.so', '--list', binary.args[0]])
     proc = subprocess.Popen(args, stdout=subprocess.PIPE)
     patterns = {}
     for library in libraries: 

--- Makefile.am~	2009-05-28 12:43:16.000000000 -0300
+++ Makefile.am	2009-06-23 16:57:10.000000000 -0300
@@ -18,7 +18,7 @@
 
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = girepository giscanner tools gir docs tests examples
+SUBDIRS = girepository giscanner tools gir docs examples
 DIST_SUBDIRS = m4 $(SUBDIRS)
 
 man_MANS = 			\
--- Makefile.in~	2009-06-21 18:38:36.000000000 -0300
+++ Makefile.in	2009-06-23 16:57:09.000000000 -0300
@@ -262,7 +262,7 @@
 GCOVSOURCES = 
 @GI_GCOV_ENABLED_TRUE@GCOV_DIRS = girepository tools
 ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = girepository giscanner tools gir docs tests examples
+SUBDIRS = girepository giscanner tools gir docs examples
 DIST_SUBDIRS = m4 $(SUBDIRS)
 man_MANS = \
 	docs/g-ir-compiler.1	\

Compiling Clutter 1.4.2 (newest clutter version working on glib 2.20)

  1. compile and install gobject-introspection with patches from Extras-devel Gobject-introspection package (ld patch and tests removal patch)
  2. compile atk with gir support
  3. compile Pango with git support
  4. compile JSON glib with gir support

./configure --prefix=/opt/new26 --disable-gtk-doc --enable-introspection=yes --with-flavour=eglx --with-gles=2.0 --enable-cogl-debug=no --with-json=internal --disable-maintainer-mode --build=arm-linux-gnueabi

Compiling Clutter 1.6.2 with gobject introspection in maemo scratchbox

  • ./configure everything with --prefix=/opt
  • use the folowing to load the newly compiled versions instead of the installed versions:
export PATH=/opt/bin:$PATH
export LD_LIBRARY_PATH=/opt/lib:/lib:/usr/lib:/usr/local/lib:/usr/X11R6/lib
export PKG_CONFIG_PATH=/opt/lib/pkgconfig/
  1. compile & install glib 2.26+ to /opt/new
  2. compile and install to /opt/new pixman 1.18.4 - remove test from SUBDIRS in makefiles or build fails
  3. compile and install to /opt/new cairo
  4. configure Clutter 1.6.2
./configure --enable-gtk-doc --enable-docs=yes --enable-introspection=yes --prefix=/opt

available methods

summary of available methods