Layouts

Layouts are main user interface in pyjama: They are used to show the albums in pyjama's album-browser, the artist informations on artist-pages and your favorite albums in the starred-albums-plugin.

If this page confuses you more than it helps you, please have a look at the quite simple stared_albums-plugin. The folder 'clLayouts' contains even more example for the layout interface.

Here some information how to create your own layout:

The draw methode:

The draw methode of your layout is called whenever your layout ist meant to be shown. Pyjama passes 4 params to this methode - use this params to generate the data you need for your layout (e.g. hits per page, page number, order etc). In this methode the information is placed on the layout and shown: For example an album-browser would query jamendo for some albums, download the covers and show them on the layout.

Register a layout

Now we need to tell pyjama, that we've created a new layout. As you'll be most probably developing a plugin, just connect to the "alldone" event and call the following function: pyjama.layouts.register_layout("my-layout", MyLayout(self.pyjama))

Showing the layout

Now, how do we show the layout? The best way is to create a menu or toolbar entry in the plugin's alldone-methode. Whenever this menu or toolbar entry is being clicked, call:

Pyjama will now call the draw methode of your MyLayout class with the params 10, 1, "listens" and "rock". This is how the params come to your draw() methode ;). Please remember: You cannot pass more than 4 params to your draw() methode. Actually you cannot even pass less than 4 values: If you call show_layout("my-layout", 10, 1), pyjama will pass None als arg3 and arg4 to your draw() methode.

Arranging the layout

If you want to be notified, when the size of your parent container changes, please connect to pyjama's "scrolled_window_resized" event.


Generated on Thu Jun 4 19:08:24 2009 for Pyjama by  doxygen 1.5.8