PageRenderTime 30ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/kitchensink/Buttons.py

http://pyjamas.googlecode.com/
Python | 49 lines | 40 code | 9 blank | 0 comment | 0 complexity | 148461dc06bb765cdbbc99d05fe1f9f5 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. from Sink import Sink, SinkInfo
  2. from ui import Button, CheckBox, VerticalPanel, HorizontalPanel, RadioButton
  3. class Buttons(Sink):
  4. def __init__(self):
  5. disabledButton = Button("Disabled Button")
  6. disabledCheck = CheckBox("Disabled Check")
  7. normalButton = Button("Normal Button")
  8. normalCheck = CheckBox("Normal Check")
  9. panel = VerticalPanel()
  10. radio0 = RadioButton("group0", "Choice 0")
  11. radio1 = RadioButton("group0", "Choice 1")
  12. radio2 = RadioButton("group0", "Choice 2 (Disabled)")
  13. radio3 = RadioButton("group0", "Choice 3")
  14. hp=HorizontalPanel()
  15. panel.add(hp)
  16. hp.setSpacing(8)
  17. hp.add(normalButton)
  18. hp.add(disabledButton)
  19. hp=HorizontalPanel()
  20. panel.add(hp)
  21. hp.setSpacing(8)
  22. hp.add(normalCheck)
  23. hp.add(disabledCheck)
  24. hp=HorizontalPanel()
  25. panel.add(hp)
  26. hp.setSpacing(8)
  27. hp.add(radio0)
  28. hp.add(radio1)
  29. hp.add(radio2)
  30. hp.add(radio3)
  31. disabledButton.setEnabled(False)
  32. disabledCheck.setEnabled(False)
  33. radio2.setEnabled(False)
  34. panel.setSpacing(8)
  35. self.initWidget(panel)
  36. def onShow(self):
  37. pass
  38. def init():
  39. text="GWT supports all the myriad types of buttons that exist in HTML. Here are a few for your viewing pleasure."
  40. return SinkInfo("Buttons", text, Buttons)