Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Hermes
Summary Lists News SCM
1 import gtk
2 import hildon
4 class ContactView(hildon.PannableArea):
5   """Widget which shows a list of contacts in a pannable area.
6        
7      Copyright (c) Andrew Flegg <andrew@bleb.org> 2009.
8      Released under the Artistic Licence."""
11   # -----------------------------------------------------------------------
12   def __init__(self, contacts):
13     """Constructor. Passed a list of EContacts."""
14     
15     hildon.PannableArea.__init__(self)
16     self.contacts = contacts
17     self.treestore = gtk.ListStore(str, gtk.gdk.Pixbuf)
18     for contact in self.contacts:
19       self.treestore.append(row = [contact.get_name(), contact.get_photo(48)])
21     self.treeview = gtk.TreeView(self.treestore)
22     tvcolumn = gtk.TreeViewColumn('Name', gtk.CellRendererText(), text = 0)
23     self.treeview.append_column(tvcolumn)
25     cell = gtk.CellRendererPixbuf()
26     cell.set_property('xalign', 1.0)
27     tvcolumn = gtk.TreeViewColumn('Picture', cell, pixbuf = 1)
28     self.treeview.append_column(tvcolumn)
30     self.add(self.treeview)
31     self.set_size_request(600, 380)

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment