PageRenderTime 37ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 1ms 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
 1from Sink import Sink, SinkInfo
 2from ui import Image, HTML, VerticalPanel, HorizontalPanel
 3from Tooltip import TooltipListener
 4
 5class TooltipTab(Sink):
 6    def __init__(self):
 7        img = Image("images/num1.png")
 8        img.addMouseListener(TooltipListener("An image: " + img.getUrl()))
 9        
10        img2 = Image("images/num2.png")
11        img2.addMouseListener(TooltipListener("An image: " + img2.getUrl()))
12
13        html = HTML("Some <i>HTML</i> text.")
14        html.addMouseListener(TooltipListener("An HTML component."))
15        
16        panel_h = HorizontalPanel()
17        panel_h.add(img)
18        panel_h.add(img2)       
19        panel_h.setSpacing(8)
20        
21        panel = VerticalPanel()
22        panel.add(panel_h)
23        panel.add(html)
24        
25        panel.setSpacing(8)
26        self.setWidget(panel)
27
28    def onShow(self):
29        pass
30
31
32def init():
33    text="<b>Tooltip popup component</b><p>Shows up after 1 second, hides after 5 seconds. Once activated, other tooltips show up immediately."
34    text+=r"<br><br>Originally by Alexei Sokolov at <a href=\"http://gwt.components.googlepages.com\">gwt.components.googlepages.com</a>"
35    return SinkInfo("Tooltip", text, TooltipTab)