PageRenderTime 132ms CodeModel.GetById 126ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/kitchensink/Tabs.py

http://pyjamas.googlecode.com/
Python | 35 lines | 29 code | 6 blank | 0 comment | 0 complexity | a6883679916635142caa6d755c449742 MD5 | raw file
 1from Sink import Sink, SinkInfo
 2from ui import TabPanel, HasAlignment, Image, VerticalPanel
 3
 4class Tabs(Sink):
 5    def __init__(self):
 6        self.fTabs = TabPanel()
 7        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/JohannesElison.jpg"), "1634")
 8        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/SelfPortrait1640.jpg"), "1640")
 9        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"), "1642")
10        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662")
11        self.fTabs.selectTab(0)
12
13        self.fTabs.setWidth("100%")
14        self.fTabs.setHeight("100%")
15        self.initWidget(self.fTabs)
16
17    def onShow(self):
18        pass
19
20    def createImage(self, imageUrl):
21        image = Image(imageUrl)
22        image.setStyleName("ks-images-Image")
23        
24        p = VerticalPanel()
25        p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
26        p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
27        p.add(image)
28        return p
29
30def init():
31    text="This page demonstrates GWT's support for images.  Notice in particular how it uses the image's onLoad event to display a 'wait spinner' between the back and forward buttons."
32    text="GWT's built-in <code>TabPanel</code> class makes it easy to build tabbed dialogs "
33    text+="and the like.  Notice that no page load occurs when you select the "
34    text+="different tabs in this page.  That's the magic of dynamic HTML."
35    return SinkInfo("Tabs", text, Tabs)