11

Click here to load reader

Dynamic Slides using OpenOffice.org Impress and Python

Embed Size (px)

DESCRIPTION

How to fetch some data from Mysql using Python and update in real time the slides in OpenOffice.org Impress using Python-Uno

Citation preview

Page 1: Dynamic Slides using OpenOffice.org Impress and Python

Barcelona Python MeetingJanuary 2008

Carles Pina i Estany

Dynamic slides using OpenOffice ImpressLexatel Technologies, S.L.

Page 2: Dynamic Slides using OpenOffice.org Impress and Python

Dynamic presentations using OpenOffice Impress

SQL queries and high-level API

Carles Pina i Estany

[email protected]

Page 3: Dynamic Slides using OpenOffice.org Impress and Python

3/11

Dynamic presentations using OpenOffice Impress

What is a dynamic slide?

● OpenOffice Impress Template● Data behind it updated every

several seconds, automatically● Data from external source:

● Mysql (implemented)● Any Python code (implemented)● Webservices● Serial port

DataSource

Program

Page 4: Dynamic Slides using OpenOffice.org Impress and Python

4/11

Dynamic presentations using OpenOffice Impress

Practical Applications

● Information Desks● Point of Sale

● Airport● Train Station● Any waiting room

● Real Time Monitoring

Any place where up-to-dateinformation is critical.

Page 5: Dynamic Slides using OpenOffice.org Impress and Python

5/11

Dynamic presentations using OpenOffice Impress

Quick win:

After this presentation you will be able to:● Grab the code (http://www.lexatel.com/slides)

● Make an OpenOffice Impress template● Write the config.py file using:

● Mysql username and password● Mysql host● Write some queries

● Execute it!

Page 6: Dynamic Slides using OpenOffice.org Impress and Python

6/11

Dynamic presentations using OpenOffice Impress

Automatically refreshed

Page 7: Dynamic Slides using OpenOffice.org Impress and Python

7/11

Dynamic presentations using OpenOffice Impress

Architecture

Python-Uno

Data Slides API

tcp● Config:● SQL● Other param.

Data Slides

Python

Your ownapplication

tcp

MySQL

Python

OpenOffice

Page 8: Dynamic Slides using OpenOffice.org Impress and Python

8/11

Dynamic presentations using OpenOffice Impress

Features

● Allows complete separation between interface design and system administration, databases, etc. Graphics designers can have fun!

● 100% remote administration.● You can use several screens (Dual Head, replicate the

same image, etc.)

● CPU load: on average: 0%● Multiplatform!

DataSlides

Screen

1Screen

2

Page 9: Dynamic Slides using OpenOffice.org Impress and Python

9/11

Dynamic presentations using OpenOffice Impress

Problems

● OpenOffice v2.2 crashed often (New version 2.3 released 17-Sep is much more stable). We implemented watchdog to restart OO if needed.

● Python and Mysql do not communicate well over a network (low-level design problem). Using sql-relay (or similar utilities) could avoid the problem.

Page 10: Dynamic Slides using OpenOffice.org Impress and Python

10/11

Dynamic presentations using OpenOffice Impress

Download

● Download code from http://www.lexatel.com/slides● Setup the follow variables in config.py:

● dbhost, dbname, dbuser, dbpassword● Assign odpfile1 and odpfile2 to some .odp file (if one fails,

try another one)

Page 11: Dynamic Slides using OpenOffice.org Impress and Python

11/11

Dynamic presentations using OpenOffice Impress

3 types of code:

● -SQL queriessql[“name_object”]=”””select param_value from table

order by date limit 1”””● -Code using high level API

sql”code”]=”””a=function(b,c,d)config.ret=a“””

● -Code_step: same than Code but will move the graphic