Fer's blog
fer, ferulo, that crazy man

Sun, 29 Oct 2006

Scripting your desktop with dogtail

Today I was preparing some slides for my upcoming talks at 7th Encuentro Linux 2006 in Chile. I had planned to use some music in sync with some slides. However embbeding music in OpenOffice Impress is not easy. Also I'd prefer to use a PDF with evince in presentation mode. Solution? Using evince for display slides and totem for playing the music, both syncronized using a dogtail script. Here are the fundamentals:
Guess what page evince is displaying from:

If the page has changed, check in an array if the new slide has music. If no music associated, press pause button on totem. If music associated, search totem playlist for the song and press play button. That's all: 30 lines of python where you can embbed your music array:

import gtk
from dogtail.tree import root

music = {}
music['3'] = '03. Nina Simone - Pirate Jenny'
music['5'] = '04-raimon - diguem no.mp3'

current = '0'

def check_music():
        global music, page, play, totem, current

        if current == page.text:
                return True
                current = page.text

        if music.has_key(page.text):
                entry = totem.child(roleName='table cell', name=music[page.text])
                if play.name == 'gtk-media-play':
                if play.name == 'gtk-media-pause':

        return True

evince = root.application('evince')
toolbar = evince.child(roleName='tool bar')
page = toolbar.child(roleName='text')

totem = root.application('totem')
play = totem.child(name='gtk-media-play')

tag = gtk.timeout_add (500, check_music)


Next improvement would be adding a gui for creating playlists, associating PDF presentation and slides, lauching evince and launching totem with the created playlist

[11:55] | Permalink | 3 comments

Posted by MDK at Sun Oct 29 16:58:56 2006
Fer, you use way too much python.

Posted by test at Wed Nov 1 20:59:38 2006

Posted by Pablo Rodríguez at Wed Nov 1 22:26:15 2006
Fer, I'm extremely interested in the contents of this post, but I'm afraid I cannot code (so I cannot understand exactly what the program does).

Your example would be great for the following scenario: syncing audio and slides (as described here or originally here). But I wonder whether our script (or GUI) supports automatic page transition at the given time.

Once this would be achieved, it would be great (and I guess it would be very simple to implement)  a timer (a tool that enables the task described here). If the timer can start counting when the presentation audio starts to be recorded and it is able to mark every slide transition, this would be the perfect tool to get timelines right.

Would you be interested in developing this?

Thanks for your interesting post,


This blog has been moved to: http://blogs.gnome.org/fherrera
Please, update your bookmarks and feeds


Fernando Herrera

< October 2006 >
1 2 3 4 5 6 7
8 91011121314

RSS 2.0