pyside_pyconar2011

Upload: willerdavis

Post on 16-Jul-2015

13 views

Category:

Documents


0 download

TRANSCRIPT

PySide: An introduction to Python/Qt DevelopmentBruno Arajo, Willer Moreira

Nokia Technology Institute

NOKIA TECHNOLOGY INSTITUTEINDT

Non-profit Research & Development Center, focused on developing new concepts, products and solutions to areas related to mobile technologies and the Internet.Manaus Recife

Our key areas are:

Braslia

Software and User Interface Network T echnologies Product and Manufacturing T echnologies Service ExperienceNokia Technology Institute

So Paulo

Who am I?

Computer scientist Software developer at INdT Member of the PyMaemo and PySide teams

Nokia Technology Institute

Schedule

Introduction to Qt PySide description PySide + QtQuick PySide Assistant (PSA)

Nokia Technology Institute

Introduction to Qt

Nokia Technology Institute

Qt Framework

Cross-platform application development framework. A little while after Nokia's acquisition of Trolltech Qt started being distributed under the LGPL license.Nokia Technology Institute

PySide == Python + Qt

PySide is how we call the Python bindings of the Qt Framework produced by INdT and released under the LGPL license.

Nokia Technology Institute

PySide description

Nokia Technology Institute Nokia Technology Institute

PySide toolchain

PySide: the thing you import libpyside: deals with Qt signals/slots libshiboken: helps in the interfacing of Python and C++

Nokia Technology Institute Nokia Technology Institute

Binding assembly line

Qt headers: the basic information about Qt libraries comes from here Type system files: here the binding developer modifies the collected information to fit the Python language. Handwritten code: code to handle the C++Nokia Technology Institute Nokia Technology Institute

Supported platforms

Maemo 5 (Nokia N900) MeeGo 1.2 Harmattan (Nokia N950/N9) MeeGo Netbook and Handset Linux Distros: the community is taking care of these

Ports for Debian, Ubuntu, ArchLinux, Fedora, openSUSE and Mandriva MacOS X: Maintained by Markus Ullmann

Microsoft Windows: Maintained by Roman Lacko Android: experimental port done by Thomas PerlNokia Technology Institute Nokia Technology Institute

How to install

PySide is available on all cited platforms via their standard installation procedures (except Android) However, if you want to build all from source... ...just go to http://developer.qt.nokia.com/wiki/Building_PySide.

Nokia Technology Institute Nokia Technology Institute

Roadmap

Memory optimization Investigation of some ideas to reduce PySide memory footprint Python 3 support

According to a already done investigation, there are no insurmountable obstacles for Python 3 support. New API features

Make PySide API more 'pythonic' The up-to-date roadmap for PySide project can be found at

http://www.pyside.org/roadmapNokia Technology Institute Nokia Technology Institute

PySide + QtQuick

Nokia Technology Institute Nokia Technology Institute

What is QtQuick?

QtQuick is a collection of technologies that allows developers and UI designers to work together for creating responsive and touch-enabled UIs for all platforms Qt supports. One of these technologies is QML

Nokia Technology Institute Nokia Technology Institute

What is QML?

Qt Meta-Object Language (QML) is a Javascript-based declarative language for designing user interface centric applications. In QML, a user interface is specified as a tree of objects with properties.

Nokia Technology Institute Nokia Technology Institute

QML

Example:

Nokia Technology Institute Nokia Technology Institute

PySide + QML

You can easily create an application using PySide and QML together First demo: Simple PySide+QML app

Nokia Technology Institute Nokia Technology Institute

Using Qt signals and slots

One way to use a Python Qt slot from QML is calling it directly

Function declaration Passing it to QML

Calling it in QML

Nokia Technology Institute Nokia Technology Institute

Using Qt signals and slots

There are other ways of connecting signals and slots in QML

These other ways are in the PySide wiki:http://developer.qt.nokia.com/wiki/Connecting_QML_Signals_in_PySide

Nokia Technology Institute Nokia Technology Institute

PySide Assistant (PSA)

Nokia Technology Institute Nokia Technology Institute

What is PSA?

PSA is a set of Python scripts and file templates that allows painless creation of binary Debian packages from pure Python applications. It is based on python-stdeb, which in turn is based on Python Distutils and Debian's dpkg. At the moment, there are templates available to Ubuntu Maverick and Natty, Maemo 5 (N900) and Meego 1.2Nokia Technology Institute Nokia Technology Institute

PSA usage

PSA supports four commands:

init: creates the initial project layout build-deb: builds a Debian binary package update: easily updates certain project properties list: displays available templates

Nokia Technology Institute Nokia Technology Institute

PSA usage

Usual workflow:

$ psa init sampleproject ubuntu-qml (...hack...) $ psa build-deb install at the target ($ sudo dpkg -i ...), test (...hack some more...) $ psa update app-name=NewApp $ psa build-deb (and so on)

Nokia Technology Institute Nokia Technology Institute

PSA demo

Second demo: creating and installing a sample app in Ubuntu

Nokia Technology Institute Nokia Technology Institute

Questions

Nokia Technology Institute Nokia Technology Institute

Where to find us

http://www.pyside.org http://lists.openbossa.org/listinfo/pyside #pyside at Freenode http://qt.gitorious.org/pyside Willer Moreira [email protected]

Nokia Technology Institute Nokia Technology Institute

Thanks!

Nokia Technology Institute Nokia Technology Institute