PageRenderTime 34ms CodeModel.GetById 14ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1, Apache-2.0
  1. from Sink import Sink, SinkInfo
  2. from ui import TabPanel, HasAlignment, Image, VerticalPanel
  3. class Tabs(Sink):
  4. def __init__(self):
  5. self.fTabs = TabPanel()
  6. self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/JohannesElison.jpg"), "1634")
  7. self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/SelfPortrait1640.jpg"), "1640")
  8. self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"), "1642")
  9. self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662")
  10. self.fTabs.selectTab(0)
  11. self.fTabs.setWidth("100%")
  12. self.fTabs.setHeight("100%")
  13. self.initWidget(self.fTabs)
  14. def onShow(self):
  15. pass
  16. def createImage(self, imageUrl):
  17. image = Image(imageUrl)
  18. image.setStyleName("ks-images-Image")
  19. p = VerticalPanel()
  20. p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
  21. p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
  22. p.add(image)
  23. return p
  24. def init():
  25. 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."
  26. text="GWT's built-in <code>TabPanel</code> class makes it easy to build tabbed dialogs "
  27. text+="and the like. Notice that no page load occurs when you select the "
  28. text+="different tabs in this page. That's the magic of dynamic HTML."
  29. return SinkInfo("Tabs", text, Tabs)