예제 #1
0
    def __init__(self, topPanel):
        TickeryTab.__init__(self, topPanel)
        # Get the query string and wanted tab, if any, from URL args.
        args = Window.getLocation().getSearchDict()
        query = args.get('query')
        wantedTab = args.get('tab')
        if wantedTab:
            wantedTab = wantedTab.lower()
        if query and wantedTab == self.tabName.lower():
            query = urllib.unquote_plus(query)
            self.autoActivate = True
        else:
            query = self.defaultQuery
            
        self.instructions.setHorizontalAlignment(HasAlignment.ALIGN_LEFT)
        self.instructions.setStyleName('instructions-popup')
        self.popup = InstructionBox(
            self.__class__.__name__, self.instructions)
        self.popup.setText(self.instructionsTitle)
        self.db = Button(HELP_TEXT, StyleName='help-button')
        self.db.addClickListener(self)

        huhId = HTMLPanel.createUniqueId()
        help = HTMLPanel('%s <span id="%s"></span>' %
                             (SHORT_INSTRUCTIONS[self.tabName], huhId),
                             StyleName='simple-instructions')
        help.add(self.db, huhId)
        
        self.goButton = go.GoButton(self)
        self.query = text.TextAreaFocusHighlight(Text=query,
                                                 VisibleLines=3,
                                                 StyleName='large-query-area')
        self.checkResult = HorizontalPanel(Spacing=4)
        
        mainGrid = Grid(2, 2, StyleName='tickery-tab-panel',
                        HorizontalAlignment=HasAlignment.ALIGN_LEFT)
        formatter = mainGrid.getCellFormatter()
        mainGrid.setWidget(0, 0, help)
        mainGrid.setWidget(1, 0, self.query)
        mainGrid.setWidget(1, 1, self.goButton)
        formatter.setHorizontalAlignment(0, 0, 'left')
        formatter.setHorizontalAlignment(1, 0, 'left')
        formatter.setAlignment(1, 1, 'left', 'bottom')
        self.topGrid.setWidget(0, 1, mainGrid)
        
        self.add(self.checkResult)
        self.results = userlist.UserListPanel(self, topPanel,
            HorizontalAlignment=HasAlignment.ALIGN_LEFT)
        self.add(self.results)
예제 #2
0
def sect_markup(txt, name):

    res = ''
    idx = 0
    links = []

    while 1:
        prev_idx = idx
        idx = txt.find("L#{", idx)
        if idx == -1:
            res += txt[prev_idx:]
            break

        beg = txt[prev_idx:idx]
        idx += 3
        i = txt.find("}", idx)
        if i == -1:
            res += txt[prev_idx:]
            break

        if i == len(txt)-1:
            url = txt[idx:]
            end = ''
        else:
            url = txt[idx:i]
            end = txt[i+1:]

        res += beg
        idx = i+1

        page_url = "%s_" % name
        page_url += url.lower()
        i = HTMLPanel.createUniqueId()

        res += "<span id='%s'></span>" % str(i)

        links.append([i, Hyperlink(url, False, page_url)])

    if not links:
        return HTML(res)

    p = HTMLPanel(res)

    for il in links:
        i = il[0]
        l = il[1]
        p.add(l, i)

    return p
예제 #3
0
파일: Chapter.py 프로젝트: Afey/pyjs
def sect_markup(txt, name):

    res = ''
    idx = 0
    links = []

    while 1:
        prev_idx = idx
        idx = txt.find("L#{", idx)
        if idx == -1:
            res += txt[prev_idx:]
            break

        beg = txt[prev_idx:idx]
        idx += 3
        i = txt.find("}", idx)
        if i == -1:
            res += txt[prev_idx:]
            break

        if i == len(txt)-1:
            url = txt[idx:]
            end = ''
        else:
            url = txt[idx:i]
            end = txt[i+1:]

        res += beg
        idx = i+1

        page_url = "%s_" % name
        page_url += url.lower()
        i = HTMLPanel.createUniqueId()

        res += "<span id='%s'></span>" % str(i)

        links.append([i, Hyperlink(url, False, page_url)])

    if not links:
        return HTML(res)

    p = HTMLPanel(res)

    for il in links:
        i = il[0]
        l = il[1]
        p.add(l, i)

    return p
예제 #4
0
 def show_about(self):
     self.dialog = PopupPanel(StyleName='about', autoHide=True)
     
     contents = HTMLPanel('', StyleName='contents')
     self.dialog.setWidget(contents)
     
     html = '<p class="pyjamas">MineSweeper written in Python with ' \
                 '<a href="http://pyjs.org" target="_blank">Pyjamas</a><p>' \
            '<p class="comments">Send comments to ' \
                 '<a href="mailto:[email protected]">' \
                     '[email protected]</a>.<p>'
     contents.setHTML(html)
     
     left = (Window.getClientWidth() - 294) / 2
     top = (Window.getClientHeight() - 112) / 2
     self.dialog.setPopupPosition(left, top)
     self.dialog.show()
예제 #5
0
    def show_about(self):
        self.dialog = PopupPanel(StyleName='about', autoHide=True)

        contents = HTMLPanel('', StyleName='contents')
        self.dialog.setWidget(contents)

        html = '<p class="pyjamas">MineSweeper written in Python with ' \
                    '<a href="http://pyjs.org" target="_blank">Pyjamas</a><p>' \
               '<p class="comments">Send comments to ' \
                    '<a href="mailto:[email protected]">' \
                        '[email protected]</a>.<p>'
        contents.setHTML(html)

        left = (Window.getClientWidth() - 294) / 2
        top = (Window.getClientHeight() - 112) / 2
        self.dialog.setPopupPosition(left, top)
        self.dialog.show()
예제 #6
0
파일: form.py 프로젝트: mcsquaredjr/Reports
    def onModuleLoad(self):
        '''Create initial view of the panel.
        '''
        # Container that keeps everything
        self.panel = VerticalPanel()
        self.panel.setSpacing(10)

        # Create list of projects 
        proj_list = ListBox(Height='34px')
       
        proj_list.addItem('')
       
        proj_list.setVisibleItemCount(0)
        proj_list.addChangeListener(getattr(self, 'on_project_changed'))
        proj_list.setStyleName('form-control input-lg')
        
        self.proj_row = Form_Row('Select project',
                            proj_list,
                            help='project, status of which you want to report')
        
        # Project-specific container
        self.project_panel = VerticalPanel()

        # Submit report button
        self.submit_btn = Button('Submit report', getattr(self, 'send_data'))
        self.submit_btn.setStyleName('btn btn-primary btn-lg')
        self.submit_btn.setEnabled(False)

        self.msg_lbl = HTMLPanel('', Width='475px')

        # Add controls here
        self.panel.add(self.proj_row.panel())
        self.panel.add(self.project_panel)
        self.panel.add(Label(Height='20px'))
        self.panel.add(self.msg_lbl)
        btn_holder = HorizontalPanel()
        btn_holder.add(self.submit_btn)
        help_btn = HTMLPanel('')

        help_btn.setHTML(MODAL_PNL)
        btn_holder.add(Label(Width='10px'))
        btn_holder.add(help_btn)
        self.panel.add(btn_holder)
        
        self.root = RootPanel('report')
        self.root.add(self.panel)
예제 #7
0
    def showDemo(self, name):
        """ Show the demonstration with the given name.
        """
        if self._curContents is not None:
            self._rightPanel.remove(self._curContents)
            self._curContents = None

        demo = None
        for d in self._demos:
            if d['name'] == name:
                demo = d
                break

        if demo is not None:
            exampleID = HTMLPanel.createUniqueId()

            html = []
            html.append('<div style="padding:20px">')
            html.append('<b>' + demo['title'] + '</b>')
            html.append('<p/>')
            html.append(self.docToHTML(demo['doc']))
            html.append('<p/>')
            html.append('<hr/>')
            html.append('<b>Working Example</b>')
            html.append('<p/>')
            html.append('<div style="padding-left:20px">')
            html.append('<span id="' + exampleID + '"></span>')
            html.append('</div>')
            html.append('<p/>')
            html.append('<hr/>')
            html.append('<b>Source Code</b>')
            html.append('<p/>')
            html.append(self.srcToHTML(demo['src']))
            html.append('</div>')

            panel = HTMLPanel("\n".join(html))
            panel.add(demo['example'], exampleID)

            self._rightPanel.add(panel)
            self._curContents = panel
        else:
            self._rightPanel.add(self._introPanel)
            self._curContents = self._introPanel
예제 #8
0
파일: Showcase.py 프로젝트: Afey/pyjs
    def showDemo(self, name):
        """ Show the demonstration with the given name.
        """
        if self._curContents is not None:
            self._rightPanel.remove(self._curContents)
            self._curContents = None

        demo = None
        for d in self._demos:
            if d['name'] == name:
                demo = d
                break

        if demo is not None:
            exampleID = HTMLPanel.createUniqueId()

            html = []
            html.append('<div style="padding:20px">')
            html.append('<b>' + demo['title'] + '</b>')
            html.append('<p/>')
            html.append(self.docToHTML(demo['doc']))
            html.append('<p/>')
            html.append('<hr/>')
            html.append('<b>Working Example</b>')
            html.append('<p/>')
            html.append('<div style="padding-left:20px">')
            html.append('<span id="' + exampleID + '"></span>')
            html.append('</div>')
            html.append('<p/>')
            html.append('<hr/>')
            html.append('<b>Source Code</b>')
            html.append('<p/>')
            html.append(self.srcToHTML(demo['src']))
            html.append('</div>')

            panel = HTMLPanel("\n".join(html))
            panel.add(demo['example'], exampleID)

            self._rightPanel.add(panel)
            self._curContents = panel
        else:
            self._rightPanel.add(self._introPanel)
            self._curContents = self._introPanel
예제 #9
0
    def __init__(self):
        SimplePanel.__init__(self)

        id1 = HTMLPanel.createUniqueId()
        id2 = HTMLPanel.createUniqueId()

        panel = HTMLPanel('<b>This is some HTML</b><br>' +
                          'First widget:<span id="' + id1 + '"></span><br>' +
                          'Second widget:<span id="' + id2 + '"></span><br>' +
                          'More <i>HTML</i>',
                          Width="150px")

        panel.add(Button("Hi there"), id1)
        panel.add(Label("This label intentionally left blank"), id2)

        self.add(panel)
예제 #10
0
    def onModuleLoad(self):
        '''Create initial view of the panel.
        '''
        # Container that keeps everything
        self.panel = VerticalPanel()
        self.panel.setSpacing(10)

        spacer1 = Label()
        spacer1.setHeight('10px')
        spacer2 = Label()
        spacer2.setHeight('10px')
        
        self.tbl_panel = VerticalPanel(Width='755px')
        # First is a row count
        self.grid = Reports_Grid()
        self.grid.create_grid(1, 4, ['Milestone Name', 'Milestone State', 'Start Date', 'End Date'])
        self.tbl_panel.add(self.grid)

        self.editor = Milestones_Editor()
        self.submit_btn = Button('Submit', getattr(self, 'send_data'))
        self.submit_btn.setStyleName('btn btn-primary btn-lg')

        hpanel = HorizontalPanel()
        hpanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
        hpanel.add(self.submit_btn)

        self.msg_lbl = HTMLPanel('', Width='755px')

        self.root = RootPanel('projects_')
        self.root.add(spacer1)
        self.root.add(self.editor.hpanel)
        self.root.add(spacer2)
        self.root.add(self.tbl_panel)

        spacer3 = Label()
        spacer3.setHeight('20px')

        self.root.add(self.msg_lbl)
        self.root.add(spacer3)
        self.root.add(hpanel)
        self.root.add(Label(Height='20px'))
        

        # Add listeners and initialize components
        self._add_listeners()
        self._iniate_states()
예제 #11
0
파일: htmlPanel.py 프로젝트: Afey/pyjs
    def __init__(self):
        SimplePanel.__init__(self)

        id1 = HTMLPanel.createUniqueId()
        id2 = HTMLPanel.createUniqueId()

        panel = HTMLPanel('<b>This is some HTML</b><br>' +
                          'First widget:<span id="' + id1 + '"></span><br>' +
                          'Second widget:<span id="' + id2 + '"></span><br>' +
                          'More <i>HTML</i>',
                          Width="150px")

        panel.add(Button("Hi there"), id1)
        panel.add(Label("This label intentionally left blank"), id2)

        self.add(panel)
예제 #12
0
    def __init__(self, name, html):
        DialogBox.__init__(self)
        self.setText(name)

        closeButton = Button("Close", self)

        htp = HTMLPanel(html)
        self.sp = ScrollPanel(htp)

        dock = DockPanel()
        dock.setSpacing(4)

        dock.add(closeButton, DockPanel.SOUTH)
        dock.add(self.sp, DockPanel.CENTER)

        dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT)
        dock.setCellWidth(self.sp, "100%")
        dock.setWidth("100%")
        self.setWidget(dock)
예제 #13
0
 def __init__(self, handle):
     self.log = logging.getConsoleLogger(type(self).__name__, lev)
     self.log.disabled = False
     self.log.debug('__init__: Instantiation')
     self._cacheBreaker = 0
     self._handle = handle 
     self.remoteService=DiagramService(handle.spinner)
     labelDisplay = Label('Diagram')
     self.display = HTMLPanel('No circuit created.')
     self.latex = TextArea()
     
     buttonPanel =  HorizontalPanel()
     
     labelFormatting = Label('Formatting')
     labelCheckbox = Label('Show: ')
     self.checkboxValue = CheckBox('value')
     self.checkboxValue.setID('CBXV1')
     self.checkboxValue.addClickListener(self.onCirctuiTikzClick)
     self.checkboxSymbol = CheckBox('symbol')
     self.checkboxSymbol.setID('CBXS1')
     self.checkboxSymbol.addClickListener(self.onCirctuiTikzClick)
     checkboxPanel =  HorizontalPanel()
     checkboxPanel.add(labelCheckbox)
     checkboxPanel.add(self.checkboxSymbol)
     checkboxPanel.add(self.checkboxValue)
     
     #layout
     self.layout=VerticalPanel(HorizontalAlignment=HasAlignment.ALIGN_LEFT, Spacing=10)
     self.layout.add(labelDisplay)
     self.layout.add(self.display)
     self.layout.add(Label('Circuitikz Markup'))
     self.layout.add(self.latex)
     self.layout.add(buttonPanel)
     self.layout.add(labelFormatting)
     self.layout.add(checkboxPanel)
     RootPanel().add(self.layout)
     
     #Set Default view
     self.actCircuitTikzLock(lock = True)
예제 #14
0
파일: Layouts.py 프로젝트: wkornewald/pyjs
    def __init__(self):
        Sink.__init__(self)

        text = """This is a <code>ScrollPanel</code> contained at 
        the center of a <code>DockPanel</code>. 
        By putting some fairly large contents 
        in the middle and setting its size explicitly, it becomes a 
        scrollable area within the page, but without requiring the use of 
        an IFRAME.
        Here's quite a bit more meaningless text that will serve primarily 
        to make this thing scroll off the bottom of its visible area.  
        Otherwise, you might have to make it really, really small in order 
        to see the nifty scroll bars!"""

        contents = HTML(text)
        scroller = ScrollPanel(contents, StyleName="ks-layouts-Scroller")

        dock = DockPanel(HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                         Spacing=10)
        north0 = HTML("This is the <i>first</i> north component", True)
        east = HTML("<center>This<br>is<br>the<br>east<br>component</center>",
                    True)
        south = HTML("This is the south component")
        west = HTML("<center>This<br>is<br>the<br>west<br>component</center>",
                    True)
        north1 = HTML("This is the <b>second</b> north component", True)
        dock.add(north0, DockPanel.NORTH)
        dock.add(east, DockPanel.EAST)
        dock.add(south, DockPanel.SOUTH)
        dock.add(west, DockPanel.WEST)
        dock.add(north1, DockPanel.NORTH)
        dock.add(scroller, DockPanel.CENTER)

        #Logger.write("Layouts", "TODO: flowpanel")
        flow = FlowPanel()
        for i in range(8):
            flow.add(CheckBox("Flow %d" % i))

        horz = HorizontalPanel(VerticalAlignment=HasAlignment.ALIGN_MIDDLE)
        horz.add(Button("Button"))
        horz.add(HTML("<center>This is a<br>very<br>tall thing</center>",
                      True))
        horz.add(Button("Button"))

        vert = VerticalPanel(HorizontalAlignment=HasAlignment.ALIGN_CENTER)
        vert.add(Button("Small"))
        vert.add(Button("--- BigBigBigBig ---"))
        vert.add(Button("tiny"))

        menu = MenuBar()
        menu0 = MenuBar(True)
        menu1 = MenuBar(True)
        menu.addItem("menu0", menu0)
        menu.addItem("menu1", menu1)
        menu0.addItem("child00")
        menu0.addItem("child01")
        menu0.addItem("child02")
        menu1.addItem("child10")
        menu1.addItem("child11")
        menu1.addItem("child12")

        #Logger.write("Layouts", "TODO: htmlpanel")
        id = HTMLPanel.createUniqueId()
        text = """This is an <code>HTMLPanel</code>.  It allows you to add 
            components inside existing HTML, like this: <span id='%s' />
            Notice how the menu just fits snugly in there?  Cute.""" % id
        html = HTMLPanel(text)

        DOM.setStyleAttribute(menu.getElement(), "display", "inline")
        html.add(menu, id)

        disclose = DisclosurePanel("Click to disclose")
        disclose.add(
            HTML("""<b>Ta-daaaaa!</b><br />Ok - it could have
                             been<br />more of a surprise."""))

        panel = VerticalPanel(Spacing=8,
                              HorizontalAlignment=HasAlignment.ALIGN_CENTER)

        panel.add(self.makeLabel("Dock Panel"))
        panel.add(dock)
        panel.add(self.makeLabel("Flow Panel"))
        panel.add(flow)
        panel.add(self.makeLabel("Horizontal Panel"))
        panel.add(horz)
        panel.add(self.makeLabel("Vertical Panel"))
        panel.add(vert)
        panel.add(self.makeLabel("HTML Panel"))
        panel.add(html)
        panel.add(self.makeLabel("Disclosure Panel"))
        panel.add(disclose)

        self.initWidget(panel)
        self.setStyleName("ks-layouts")
예제 #15
0
 def actClear(self):
     self.latex.setText('')
     self.layout.remove(self.display)
     self.display = HTMLPanel('No circuit created.')
     self.layout.insert(self.display, 1)
예제 #16
0
    def __init__(self):
        Sink.__init__(self)

        text="""This is a <code>ScrollPanel</code> contained at 
        the center of a <code>DockPanel</code>. 
        By putting some fairly large contents 
        in the middle and setting its size explicitly, it becomes a 
        scrollable area within the page, but without requiring the use of 
        an IFRAME.
        Here's quite a bit more meaningless text that will serve primarily 
        to make this thing scroll off the bottom of its visible area.  
        Otherwise, you might have to make it really, really small in order 
        to see the nifty scroll bars!"""
        
        contents = HTML(text)
        scroller = ScrollPanel(contents, StyleName="ks-layouts-Scroller")
        
        dock = DockPanel(HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                         Spacing=10)
        north0 = HTML("This is the <i>first</i> north component", True)
        east = HTML("<center>This<br>is<br>the<br>east<br>component</center>", True)
        south = HTML("This is the south component")
        west = HTML("<center>This<br>is<br>the<br>west<br>component</center>", True)
        north1 = HTML("This is the <b>second</b> north component", True)
        dock.add(north0, DockPanel.NORTH)
        dock.add(east, DockPanel.EAST)
        dock.add(south, DockPanel.SOUTH)
        dock.add(west, DockPanel.WEST)
        dock.add(north1, DockPanel.NORTH)
        dock.add(scroller, DockPanel.CENTER)
        
        #Logger.write("Layouts", "TODO: flowpanel")
        flow = FlowPanel()
        for i in range(8):
            flow.add(CheckBox("Flow %d" % i))

        horz = HorizontalPanel(VerticalAlignment=HasAlignment.ALIGN_MIDDLE)
        horz.add(Button("Button"))
        horz.add(HTML("<center>This is a<br>very<br>tall thing</center>", True))
        horz.add(Button("Button"))

        vert = VerticalPanel(HorizontalAlignment=HasAlignment.ALIGN_CENTER)
        vert.add(Button("Small"))
        vert.add(Button("--- BigBigBigBig ---"))
        vert.add(Button("tiny"))

        menu = MenuBar()
        menu0 = MenuBar(True)
        menu1 = MenuBar(True)
        menu.addItem("menu0", menu0)
        menu.addItem("menu1", menu1)
        menu0.addItem("child00")
        menu0.addItem("child01")
        menu0.addItem("child02")
        menu1.addItem("child10")
        menu1.addItem("child11")
        menu1.addItem("child12")

        #Logger.write("Layouts", "TODO: htmlpanel")
        id = HTMLPanel.createUniqueId()
        text="""This is an <code>HTMLPanel</code>.  It allows you to add 
            components inside existing HTML, like this: <span id='%s' />
            Notice how the menu just fits snugly in there?  Cute.""" % id
        html = HTMLPanel(text)
        
        DOM.setStyleAttribute(menu.getElement(), "display", "inline")
        html.add(menu, id)

        disclose = DisclosurePanel("Click to disclose")
        disclose.add(HTML("""<b>Ta-daaaaa!</b><br />Ok - it could have
                             been<br />more of a surprise."""))

        panel = VerticalPanel(Spacing=8,
                              HorizontalAlignment=HasAlignment.ALIGN_CENTER)
        
        panel.add(self.makeLabel("Dock Panel"))
        panel.add(dock)
        panel.add(self.makeLabel("Flow Panel"))
        panel.add(flow)
        panel.add(self.makeLabel("Horizontal Panel"))
        panel.add(horz)
        panel.add(self.makeLabel("Vertical Panel"))
        panel.add(vert)
        panel.add(self.makeLabel("HTML Panel"))
        panel.add(html)
        panel.add(self.makeLabel("Disclosure Panel"))
        panel.add(disclose)
        
        self.initWidget(panel)
        self.setStyleName("ks-layouts")
예제 #17
0
 def __init__(self, html="", **kwargs):
     self.hyperlinks = []
     HTMLPanel.__init__(self, html, **kwargs)
예제 #18
0
 def setHTML(self, html):
     self._clear_hyperlinks()
     HTMLPanel.setHTML(self, html)
예제 #19
0
파일: Anchor.py 프로젝트: ygyangguang/pyjs
    # EXAMPLE 1
    a1 = Anchor(
        Widget=HTML('Test 1: Anchor to external site using HTML widget.'),
        Href='http://pyjs.org',
        Title='Test1')
    RootPanel().add(a1)
    # EXAMPLE 2
    label = Label(text='Test 2: Click listener added to a label.')
    label.addClickListener(onClick)
    RootPanel().add(label)
    # EXAMPLE 3
    a2 = Hyperlink(text='Hyperlink', Element=DOM.createSpan())
    a2.setID('param1')
    a2.addClickListener(onClick)
    html2 = HTMLPanel(
        "Test 3: <span id ='t3'></span> added to HTMLPanel with click listener."
    )
    html2.add(a2, "t3")
    RootPanel().add(html2)
    # EXAMPLE 4
    hpanel = HorizontalPanel()
    hpanel.append(HTML('Test 4:  Anchor to external site using Image widget'))
    a3 = Anchor(Widget=Image('http://pyjs.org/assets/images/pyjs.128x128.png'),
                Href='http://pyjs.org',
                Title='Test4')
    hpanel.append(a3)
    RootPanel().add(hpanel)
    # EXAMPLE 5
    serverXml = \
"""
<html>
예제 #20
0
        else:
            self.row, self.column = level
            if level[0] <= current_level[0] and level[1] <= current_level[1]:
                self.grid.resize(*level)
                self.restart(no_of_bomb)
            else:
                self.grid_panel.remove(self.grid)
                self.create_grid()
                self.start(no_of_bomb)

    def restart(self, no_of_bomb=0):
        for one in self.get_all_cells():
            one.count = 0
            one.state = 0
            one.setStyleName('blank')
            DOM.setInnerHTML(one.getElement(), '')
        self.start(no_of_bomb)


if __name__ == '__main__':
    pyjd.setup("./public/minesweeper.html")
    LOG = HTMLPanel('', StyleName='log')
    SCORES = HTMLPanel('', StyleName='scores')
    game = Game(8, 8)

    RootPanel('content').add(game)
    RootPanel('content').add(SCORES)
    RootPanel('content').add(LOG)

    pyjd.run()
예제 #21
0
파일: Anchor.py 프로젝트: Afey/pyjs
    Window.alert('Make service request using %s'%sender.getID())
    
if __name__ == '__main__':
    pyjd.setup("public/Anchor.html")
    # EXAMPLE 1
    a1 = Anchor(Widget = HTML('Test 1: Anchor to external site using HTML widget.'), Href='http://pyjs.org', Title = 'Test1')
    RootPanel().add(a1) 
    # EXAMPLE 2
    label = Label(text = 'Test 2: Click listener added to a label.')
    label.addClickListener(onClick)
    RootPanel().add(label) 
    # EXAMPLE 3
    a2 = Hyperlink(text = 'Hyperlink', Element = DOM.createSpan())
    a2.setID('param1')
    a2.addClickListener(onClick)
    html2=HTMLPanel("Test 3: <span id ='t3'></span> added to HTMLPanel with click listener.")
    html2.add(a2, "t3")
    RootPanel().add(html2)
    # EXAMPLE 4
    hpanel = HorizontalPanel()
    hpanel.append(HTML('Test 4:  Anchor to external site using Image widget'))
    a3 = Anchor(Widget = Image('http://pyjs.org/assets/images/pyjs.128x128.png'), Href='http://pyjs.org', Title = 'Test4')
    hpanel.append(a3)
    RootPanel().add(hpanel) 
    # EXAMPLE 5
    serverXml = \
"""
<html>
  <head>
    <title>Example 5</title>
  </head>
예제 #22
0
 def __init__(self, sink, html="", title="", **kwargs):
     self.sink = sink
     self.title = title
     HTMLPanel.__init__(self, html, **kwargs)