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

/examples/addonsgallery/TooltipTab.py

http://pyjamas.googlecode.com/
Python | 35 lines | 26 code | 9 blank | 0 comment | 0 complexity | 9bdef02c640bc38142272b58028c45bd MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. from Sink import Sink, SinkInfo
  2. from ui import Image, HTML, VerticalPanel, HorizontalPanel
  3. from Tooltip import TooltipListener
  4. class TooltipTab(Sink):
  5. def __init__(self):
  6. img = Image("images/num1.png")
  7. img.addMouseListener(TooltipListener("An image: " + img.getUrl()))
  8. img2 = Image("images/num2.png")
  9. img2.addMouseListener(TooltipListener("An image: " + img2.getUrl()))
  10. html = HTML("Some <i>HTML</i> text.")
  11. html.addMouseListener(TooltipListener("An HTML component."))
  12. panel_h = HorizontalPanel()
  13. panel_h.add(img)
  14. panel_h.add(img2)
  15. panel_h.setSpacing(8)
  16. panel = VerticalPanel()
  17. panel.add(panel_h)
  18. panel.add(html)
  19. panel.setSpacing(8)
  20. self.setWidget(panel)
  21. def onShow(self):
  22. pass
  23. def init():
  24. text="<b>Tooltip popup component</b><p>Shows up after 1 second, hides after 5 seconds. Once activated, other tooltips show up immediately."
  25. text+=r"<br><br>Originally by Alexei Sokolov at <a href=\"http://gwt.components.googlepages.com\">gwt.components.googlepages.com</a>"
  26. return SinkInfo("Tooltip", text, TooltipTab)