PageRenderTime 102ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/examples/mail/Mailboxes.py

http://pyjamas.googlecode.com/
Python | 27 lines | 22 code | 5 blank | 0 comment | 0 complexity | 87c9902e03b3c8ecdd127545a3e51a12 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. from ui import Composite, Tree, TreeItem
  2. class Mailboxes(Composite):
  3. def __init__(self):
  4. self.tree = Tree()
  5. root = TreeItem(self.imageItemHTML("home.gif", "foo@example.com"))
  6. self.tree.addItem(root)
  7. inboxItem = self.addImageItem(root, "Inbox")
  8. self.addImageItem(root, "Drafts")
  9. self.addImageItem(root, "Templates")
  10. self.addImageItem(root, "Sent")
  11. self.addImageItem(root, "Trash")
  12. root.setState(True)
  13. self.initWidget(self.tree)
  14. def addImageItem(self, root, title):
  15. item = TreeItem(self.imageItemHTML(title + ".gif", title))
  16. root.addItem(item)
  17. return item
  18. def imageItemHTML(self, imageUrl, title):
  19. value = "<span><img style='margin-right:4px' src='"
  20. value += "http://code.google.com/webtoolkit/documentation/examples/desktopclone/"
  21. value += imageUrl.toLowerCase() + "'>" + title + "</span>"
  22. return value