Monday, August 17, 2009

Introduction to Qt @ Debian Day '09 Amazonas

Hi again!
I'm pleased to announce that me and Frederico Duarte will be giving an "Introduction to Qt" mini-course at Debian Day '09 Amazonas, which will be placed this 22th August @ UniLaSalle, Manaus. The course will start at 9am and will proceed until 11am. There we'll try to explain some Qt basic together with a fancy animated example using Qt's newest frameworks. There shall be a plenty of other interesting courses given by my colleagues Éverton Arruda (BrDesktop installation), Adenilson Cavalcanti (PyS60: Python para S60 Nokia) and Francisco Alecrim (Kernel Linux development for newcomers), among others. More info about the Debian day conference at Amazonas can be found on Br-Linux.org and the official site. Hope to see you there!

Friday, June 26, 2009

Python-purple at FISL 10

(Me, Ricardo Salveti and Anderson Briglia - thanks to Henry Vieira for the picture!)


Yesterday me and Anderson Briglia spoke about python-purple (a libpurple binding for Python written using Cython) at FISL 10, the most valuable free software event in Latin America. Actually, we had to compete with Richard Stallman's presentation together with the brazilliam soccer team game (which was happening on the same time!). Public acceptance was good and we hope to get new developers to join the team :) Anyway, we made available the presentation (sorry, brazillian portuguese only) at the project's documentation section.

[]s!

Friday, June 5, 2009

Qt's Animation framework API updates

Hi again,
Since my previous post, we've been using the QAnimationState class together with the convenience method addAnimateTransition() to get animated transitions between states. Now the API's got even cleaner and easier to understand, you don't have to use a special state in order to associate animated transitions to it any longer ;) I've updated the Qt's documentation about the animation framework, you can read it below:

Animations and States

When using a state machine, we can associate an animation to a transition between states using a QSignalTransition or QEventTransition class. These classes are both derived from QAbstractTransition, which defines the convenience function addAnimation() that enables the appending of one or more animations triggered when the transition occurs.

We also have the possibility to associate properties with the states rather than setting the start and end values ourselves. Below is a complete code example that animates the geometry of a QPushButton.


QPushButton *button = new QPushButton("Animated Button");
button->show();

QStateMachine *machine = new QStateMachine;

QState *state1 = new QState(machine->rootState());
state1->assignProperty(button, "geometry", QRect(0, 0, 100, 30));

machine->setInitialState(state1);

QState *state2 = new QState(machine->rootState());
state2->assignProperty(button, "geometry", QRect(250, 250, 100, 30));

QSignalTransition *transition1 = state1->addTransition(button,
SIGNAL(clicked()), state2);
transition1->addAnimation(new QPropertyAnimation(button, "geometry"));

QSignalTransition *transition2 = state2->addTransition(button,
SIGNAL(clicked()), state1);

transition2->addAnimation(new QPropertyAnimation(button, "geometry"));

machine->start();

You can find the most up-to-date documentation about the Animation Framework and State Machine framework here: http://doc.trolltech.com/4.6-snapshot/index.html

Thursday, April 16, 2009

Playing with QAnimationState

After some time studying and learning how Qt's Animation framework and State Machine framework works, I've come to this little example I would like to show:


As you can see from the video above, the horizontal list shows a subset of all its items, and the focused item always stays on the first position. List navigation happens when the user presses a keyboard key (in this case, left/right keys), which then emits a signal which is connected to the horizontal list controller slots. The horizontal list internal state machine is then responsible for managing the animations using QAnimationStates, which executes the demanded animation and then returns to the default state:

initialState->addFinishedTransition(stoppedState);
stoppedState->addTransition(this, SIGNAL(moveItemsToLeft()), m_NextItemState);
stoppedState->addTransition(this, SIGNAL(moveItemsToRight()), m_PreviousItemState);
m_NextItemState->addFinishedTransition(stoppedState);
m_PreviousItemState->addFinishedTransition(stoppedState);

On the horizontal list state machine, initialState executes the initial animation (not shown on this video), then it goes to stoppedState. From this, every time the list needs to animate something, it uses a QAnimationState (eg. m_NextItemState, m_PreviousItemState) to do the job. I general, these new Qt frameworks have a very intuitive API and provides an easy way to implement nice animations. Kudos for Qt developers!

Friday, April 3, 2009

Introducing python-purple

At OpenBossa labs I've worked on the Carman project, which is a really nice application that captures real-time OBD-II data from your car and shows these informations (such as velocity, RPM, etc) in a fancy look. It also captures GPS data from your Maemo device and shows your current position on the map, also logging it for future visualization of the whole trip. On the last months we've worked implementing the InfoShare feature, which enables the user to share its information with other Carman users by transferring data along an IM protocol. One of the prototypes we implemented in order to achieve this feature was the binding of libpurple C library into Python. This was the beginning of python-purple, which now is separated from Carman and has its own project webpage at Maemo's Garage. As the website defines:
Python-purple is the first python binding for libpurple (used by Pidgin as communication library). It implements a python module which can be easily imported by python applications providing access to native libpurple methods.
So far, python-purple is capable of connecting to an account and send/receive messages from connected buddies, among other things. Currently, there is a list of TODO stuff I would like to see implemented on python-purple:
  • Actually Ecore is used as main loop for python-purple (mainly because Carman also uses Ecore). It would be nice to remove Ecore and use Glib as main loop, in order to fix some C hacks which are responsible for the binding to work.
  • Support for all mainly used signals generated by libpurple (so far, only the most basic are implemented).
  • Support for group chat (for now, only one-to-one conversation is implemented).
  • Fix LD_PRELOAD bug ( http://developer.pidgin.im/ticket/7872 ).
In case you're interested in python-purple, you are welcome to visite our Garage project website ( https://garage.maemo.org/projects/python-purple ). Feel free to send bugs, patches and ideas to us!

ps: There is a mini-tutorial explaining how to build and execute the example IM client inside python-purple source code repository. It is available on Pidgin's developer wiki:
http://developer.pidgin.im/wiki/PythonHowTo

ps: Thanks Tomaz Noleto for the hint about the messy project link!