File: Mailboxes.py

package info (click to toggle)
pyjamas 0.7~%2Bpre2-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 10,656 kB
  • ctags: 12,331
  • sloc: python: 74,493; php: 805; sh: 291; makefile: 59; xml: 9
file content (31 lines) | stat: -rw-r--r-- 1,001 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from pyjamas.ui.Composite import Composite
from pyjamas.ui.Tree import Tree
from pyjamas.ui.TreeItem import TreeItem

    
class Mailboxes(Composite):
    def __init__(self):
        Composite.__init__(self)

        self.tree = Tree()
        root = TreeItem(self.imageItemHTML("home.gif", "foo@example.com"))
        self.tree.addItem(root)     
        inboxItem = self.addImageItem(root, "Inbox")
        self.addImageItem(root, "Drafts")
        self.addImageItem(root, "Templates")
        self.addImageItem(root, "Sent")
        self.addImageItem(root, "Trash")

        root.setState(True)
        self.initWidget(self.tree)

    def addImageItem(self, root, title):
        item = TreeItem(self.imageItemHTML(title + ".gif", title))
        root.addItem(item)
        return item

    def imageItemHTML(self, imageUrl, title):
        value  = "<span><img style='margin-right:4px' src='"
        value += "./"
        value += imageUrl.lower() + "'>" + title + "</span>"
        return value