Thursday, August 16, 2007

Hildon banner in pymaemo

In my journey of exploring python for the N800 I spotted some problems with using the hildon banner with the pymaemo bindings.
Now these problems are fixed in the svn version (thanks to Lauro Moura). I made a little example file based on the C api how to use this hildon banner in pymaemo.

import gtk
import hildon

class hildonBannerWindow(hildon.Window):
def __init__(self):
self.button = gtk.Button('Show Info');
self.button.connect('clicked', self.show_banner_cb)
self.connect('destroy', gtk.main_quit)
self.banner_type = 1
self.banner = None

def show_banner_cb(self, widget):
if self.banner_type == 1:
hildon.hildon_banner_show_information(self, None, "Hello Information")
elif self.banner_type == 2:
self.banner = hildon.hildon_banner_show_animation(self, None, "Hello Animation")
elif self.banner_type == 3:
elif self.banner_type == 4:
self.banner = hildon.hildon_banner_show_progress(self, None, "Info with progress bar")
elif self.banner_type == 5:
elif self.banner_type == 6:
self.banner_type = 0
self.banner_type += 1

if __name__ == '__main__':
window = hildonBannerWindow()

I shows there are 3 types of hildon banners:

hildon information : Just an information icon that shows up for a few seconds

hildon animation : Shows an spinning wheel whith some text ,this was the one I needed ;)

hildon progress : Can show a progressbar with some text next to it.

The two last one needs to be destroyed after using them.

No comments: