def onModuleLoad(self): self.curInfo='' self.curSink=None self.description=HTML() self.sink_list=SinkList() self.panel=DockPanel() self.loadSinks() self.sinkContainer = DockPanel() self.sinkContainer.setStyleName("ks-Sink") vp=VerticalPanel() vp.setWidth("100%") vp.add(self.description) vp.add(self.sinkContainer) self.description.setStyleName("ks-Info") self.panel.add(self.sink_list, DockPanel.WEST) self.panel.add(vp, DockPanel.CENTER) self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP) self.panel.setCellWidth(vp, "100%") History().addHistoryListener(self) RootPanel().add(self.panel) #RootPanel().add(Logger()) #Show the initial screen. initToken = History().getToken() if len(initToken): self.onHistoryChanged(initToken) else: self.showInfo()
def __init__(self, owner): Composite.__init__(self) self.owner = owner self.bar = DockPanel() self.gotoFirst = Button("<<", self) self.gotoNext = Button(">", self) self.gotoPrev = Button("<", self) self.status = HTML() self.initWidget(self.bar) self.bar.setStyleName("navbar") self.status.setStyleName("status") buttons = HorizontalPanel() buttons.add(self.gotoFirst) buttons.add(self.gotoPrev) buttons.add(self.gotoNext) self.bar.add(buttons, DockPanel.EAST) self.bar.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT) self.bar.add(self.status, DockPanel.CENTER) self.bar.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) self.bar.setCellHorizontalAlignment(self.status, HasAlignment.ALIGN_RIGHT) self.bar.setCellVerticalAlignment(self.status, HasAlignment.ALIGN_MIDDLE) self.bar.setCellWidth(self.status, "100%") self.gotoPrev.setEnabled(False) self.gotoFirst.setEnabled(False)
def onModuleLoad(self): self.panel=DockPanel() east = Label("east") self.panel.add(east, DockPanel.EAST) self.panel.add(Label("west"), DockPanel.WEST) self.panel.add(Label("north"), DockPanel.NORTH) self.panel.add(Label("south"), DockPanel.SOUTH) self.south2 = Label("south2") self.panel.add(self.south2, DockPanel.SOUTH) self.center = Label("center") self.panel.add(self.center, DockPanel.CENTER) self.panel.setWidth("300px") self.panel.setHeight("300px") self.panel.setBorderWidth("1px") self.panel.setCellVerticalAlignment(east, HasAlignment.ALIGN_BOTTOM) self.panel.setCellHorizontalAlignment(east, HasAlignment.ALIGN_RIGHT) self.r = Button("remove", self) self.a = Button("add", self) RootPanel().add(self.panel) RootPanel().add(self.r) RootPanel().add(self.a)
class DynaTableWidget(Composite): def __init__(self, provider, columns, columnStyles, rowCount): Composite.__init__(self) self.acceptor = RowDataAcceptorImpl(self) self.outer = DockPanel() self.startRow = 0 self.grid = Grid() self.navbar = NavBar(self) self.provider = provider self.initWidget(self.outer) self.grid.setStyleName("table") self.outer.add(self.navbar, DockPanel.NORTH) self.outer.add(self.grid, DockPanel.CENTER) self.initTable(columns, columnStyles, rowCount) self.setStyleName("DynaTable-DynaTableWidget") def initTable(self, columns, columnStyles, rowCount): self.grid.resize(rowCount + 1, len(columns)) for i in range(len(columns)): self.grid.setText(0, i, columns[i]) if columnStyles: self.grid.cellFormatter.setStyleName(0, i, columnStyles[i] + "header") def setStatusText(self, text): self.navbar.status.setText(text) def clearStatusText(self, text): self.navbar.status.setHTML(" ") def refresh(self): self.navbar.gotoFirst.setEnabled(False) self.navbar.gotoPrev.setEnabled(False) self.navbar.gotoNext.setEnabled(False) self.setStatusText("Please wait...") self.provider.updateRowData(self.startRow, self.grid.getRowCount() - 1, self.acceptor) def setRowCount(self, rows): self.grid.resizeRows(rows) def getDataRowCount(self): return self.grid.getRowCount() - 1
def __init__(self): Sink.__init__(self) self.curImage=0 self.image=Image() self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif") self.nextButton = Image(self.baseURL() + "rembrandt/forward.gif") self.prevButton = Image(self.baseURL() + "rembrandt/back.gif") self.sImages=["rembrandt/JohannesElison.jpg", "rembrandt/LaMarcheNocturne.jpg", "rembrandt/SelfPortrait1628.jpg", "rembrandt/SelfPortrait1640.jpg", "rembrandt/TheArtistInHisStudio.jpg", "rembrandt/TheReturnOfTheProdigalSon.jpg"] for i in range(len(self.sImages)): self.sImages[i]=self.baseURL() + self.sImages[i] self.image.addLoadListener(self) self.prevButton.addClickListener(self) self.nextButton.addClickListener(self) topPanel = DockPanel() topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) topPanel.add(self.prevButton, DockPanel.WEST) topPanel.add(self.nextButton, DockPanel.EAST) topPanel.add(self.loadingImage, DockPanel.CENTER) panel = VerticalPanel() panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) panel.add(HTML("<h2>A Bit of Rembrandt</h2>", True)) panel.add(topPanel) panel.add(self.image) panel.setWidth("100%") self.initWidget(panel) self.image.setStyleName("ks-images-Image") self.nextButton.setStyleName("ks-images-Button") self.prevButton.setStyleName("ks-images-Button") self.loadImage(0)
def __init__(self, provider, columns, columnStyles, rowCount): Composite.__init__(self) self.acceptor = RowDataAcceptorImpl(self) self.outer = DockPanel() self.startRow = 0 self.grid = Grid() self.navbar = NavBar(self) self.provider = provider self.initWidget(self.outer) self.grid.setStyleName("table") self.outer.add(self.navbar, DockPanel.NORTH) self.outer.add(self.grid, DockPanel.CENTER) self.initTable(columns, columnStyles, rowCount) self.setStyleName("DynaTable-DynaTableWidget")
def __init__(self, classes, class_content): Composite.__init__(self) self.class_content = class_content t = Trees(self, classes) clspan = DockPanel() clspan.setWidth("100%%") self.clstext = HTML() txtscroll = ScrollPanel(self.clstext) clsscroll = ScrollPanel(t) clspan.add(clsscroll, DockPanel.WEST) clspan.add(txtscroll, DockPanel.EAST) clspan.setCellWidth(txtscroll, "100%%") clspan.setCellWidth(clsscroll, "260px") t.setWidth("250px") title = bigtitle('Classes') self.initWidget(section(title, 'classes', clspan)) self.clspan = clspan self.txtscroll = txtscroll self.clsscroll = clsscroll self.t = t
def onModuleLoad(self): Window.addWindowResizeListener(self) panel = DockPanel() RootPanel().add(panel) self.panel = panel panel.setWidth("100%") #panel.setHeight("100%") panel.setSpacing(5) title = HTML('<h1>Timer</h1>') description = HTML("""""") #panel.add(title, DockPanel.NORTH) panel.add(description, DockPanel.NORTH) links = VerticalPanel() links.setSpacing(8) panel.add(links, DockPanel.NORTH) head = HTML(""" <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>Timer</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/Timer.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/Timer.py</a></font></td></tr></table> """) panel.add(head, DockPanel.NORTH) docs = HTML("""""") panel.add(docs, DockPanel.NORTH) tp = TabPanel() tp.setWidth("100%") self.tp = tp panel.add(tp, DockPanel.SOUTH) #panel.setCellHeight(tp, "100%") classes = [ Proto('Timer'), ] class_content = { 'Timer': r'''<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="Timer">class <strong>Timer</strong></a></font></td></tr> <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Timer-__init__"><strong>__init__</strong></a>(self, time, notify)</dt></dl> <dl><dt><a name="Timer-cancel"><strong>cancel</strong></a>(self)</dt></dl> <dl><dt><a name="Timer-getID"><strong>getID</strong></a>(self)</dt></dl> <dl><dt><a name="Timer-notify"><strong>notify</strong></a>(self, *args)</dt></dl> </td></tr></table>''', } self.class_doc = ClassDoc(classes, class_content) tp.add(self.class_doc, 'Classes') functions = ['<dl><dt><a name="-timeout_add"><strong>timeout_add</strong></a>(...)</dt></dl>\n'] title = bigtitle('Functions') contents = section(title, 'functions', HTML('\n'.join(functions))) tp.add(contents, 'Functions') tp.addTabListener(self) tp.selectTab(0) # Call the window resized handler to get the initial sizes setup. Doing # this in a deferred command causes it to occur after all widgets' sizes # have been computed by the browser. DeferredCommand().add(self)
def onModuleLoad(self): Window.addWindowResizeListener(self) panel = DockPanel() RootPanel().add(panel) self.panel = panel panel.setWidth("100%") #panel.setHeight("100%") panel.setSpacing(5) title = HTML('<h1>DeferredCommand</h1>') description = HTML("""""") #panel.add(title, DockPanel.NORTH) panel.add(description, DockPanel.NORTH) links = VerticalPanel() links.setSpacing(8) panel.add(links, DockPanel.NORTH) head = HTML(""" <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>DeferredCommand</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/DeferredCommand.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/DeferredCommand.py</a></font></td></tr></table> """) panel.add(head, DockPanel.NORTH) docs = HTML("""""") panel.add(docs, DockPanel.NORTH) tp = TabPanel() tp.setWidth("100%") self.tp = tp panel.add(tp, DockPanel.SOUTH) #panel.setCellHeight(tp, "100%") classes = [ Proto('DeferredCommand'), ] class_content = { 'DeferredCommand': r'''<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="DeferredCommand">class <strong>DeferredCommand</strong></a></font></td></tr> <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="DeferredCommand-add"><strong>add</strong></a>(self, cmd)</dt></dl> <dl><dt><a name="DeferredCommand-flushDeferredCommands"><strong>flushDeferredCommands</strong></a>(self)</dt></dl> <dl><dt><a name="DeferredCommand-maybeSetDeferredCommandTimer"><strong>maybeSetDeferredCommandTimer</strong></a>(self)</dt></dl> <dl><dt><a name="DeferredCommand-onTimer"><strong>onTimer</strong></a>(self, sender)</dt></dl> </td></tr></table>''', } self.class_doc = ClassDoc(classes, class_content) tp.add(self.class_doc, 'Classes') data = [r'''<strong>deferredCommands</strong> = []''',r'''<strong>timerIsActive</strong> = False'''] title = bigtitle('Data') contents = section(title, 'data', HTML('\n'.join(data))) tp.add(contents, 'Data') tp.addTabListener(self) tp.selectTab(0) # Call the window resized handler to get the initial sizes setup. Doing # this in a deferred command causes it to occur after all widgets' sizes # have been computed by the browser. DeferredCommand().add(self)
def onModuleLoad(self): Window.addWindowResizeListener(self) panel = DockPanel() RootPanel().add(panel) self.panel = panel panel.setWidth("100%") #panel.setHeight("100%") panel.setSpacing(5) title = HTML('<h1>History</h1>') description = HTML("""""") #panel.add(title, DockPanel.NORTH) panel.add(description, DockPanel.NORTH) links = VerticalPanel() links.setSpacing(8) panel.add(links, DockPanel.NORTH) head = HTML(""" <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>History</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/History.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/History.py</a></font></td></tr></table> """) panel.add(head, DockPanel.NORTH) docs = HTML("""""") panel.add(docs, DockPanel.NORTH) tp = TabPanel() tp.setWidth("100%") self.tp = tp panel.add(tp, DockPanel.SOUTH) #panel.setCellHeight(tp, "100%") classes = [ Proto('History'), ] class_content = { 'History': r'''<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="History">class <strong>History</strong></a></font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> <td colspan=2><tt>Simple <a href="#History">History</a> management class for back/forward button support.<br> <br> This class allows your AJAX application to use a history. Each time you<br> call <a href="#History-newItem">newItem</a>(), a new item is added to the history and the history<br> listeners are notified. If the user clicks the browser's forward or back <br> buttons, the appropriate item (a string passed to newItem) is fetched<br> from the history and the history listeners are notified.<br> <br> The address bar of the browser contains the current token, using <br> the "#" seperator (for implementation reasons, not because we love <br> the # mark).<br> <br> You may want to check whether the hash already contains a history<br> token when the page loads and use that to show appropriate content;<br> this allows users of the site to store direct links in their<br> bookmarks or send them in emails.<br> <br> To make this work properly in all browsers, you must add a specially<br> named iframe to your html page, like this:<br> <br> <iframe id='__pygwt_historyFrame' style='width:0;height:0;border:0'></iframe><br> </tt></td></tr> <tr><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="History-addHistoryListener"><strong>addHistoryListener</strong></a>(self, listener)</dt></dl> <dl><dt><a name="History-back"><strong>back</strong></a>(self)</dt></dl> <dl><dt><a name="History-fireHistoryChangedAndCatch"><strong>fireHistoryChangedAndCatch</strong></a>(self)</dt><dd><tt># TODO</tt></dd></dl> <dl><dt><a name="History-fireHistoryChangedImpl"><strong>fireHistoryChangedImpl</strong></a>(self, historyToken)</dt></dl> <dl><dt><a name="History-forward"><strong>forward</strong></a>(self)</dt></dl> <dl><dt><a name="History-getToken"><strong>getToken</strong></a>(self)</dt></dl> <dl><dt><a name="History-newItem"><strong>newItem</strong></a>(self, historyToken)</dt></dl> <dl><dt><a name="History-onHistoryChanged"><strong>onHistoryChanged</strong></a>(self, historyToken)</dt><dd><tt># TODO - fireHistoryChangedAndCatch not implemented</tt></dd></dl> <dl><dt><a name="History-removeHistoryListener"><strong>removeHistoryListener</strong></a>(self, listener)</dt></dl> </td></tr></table>''', } self.class_doc = ClassDoc(classes, class_content) tp.add(self.class_doc, 'Classes') functions = ['<dl><dt><a name="-init"><strong>init</strong></a>()</dt></dl>\n'] title = bigtitle('Functions') contents = section(title, 'functions', HTML('\n'.join(functions))) tp.add(contents, 'Functions') data = [r'''<strong>historyListeners</strong> = []''',r'''<strong>historyToken</strong> = '''''] title = bigtitle('Data') contents = section(title, 'data', HTML('\n'.join(data))) tp.add(contents, 'Data') tp.addTabListener(self) tp.selectTab(0) # Call the window resized handler to get the initial sizes setup. Doing # this in a deferred command causes it to occur after all widgets' sizes # have been computed by the browser. DeferredCommand().add(self)
def onModuleLoad(self): Window.addWindowResizeListener(self) panel = DockPanel() RootPanel().add(panel) self.panel = panel panel.setWidth("100%") #panel.setHeight("100%") panel.setSpacing(5) title = HTML('<h1>Location</h1>') description = HTML("""""") #panel.add(title, DockPanel.NORTH) panel.add(description, DockPanel.NORTH) links = VerticalPanel() links.setSpacing(8) panel.add(links, DockPanel.NORTH) head = HTML(""" <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>Location</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/Location.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/Location.py</a></font></td></tr></table> """) panel.add(head, DockPanel.NORTH) docs = HTML("""""") panel.add(docs, DockPanel.NORTH) tp = TabPanel() tp.setWidth("100%") self.tp = tp panel.add(tp, DockPanel.SOUTH) #panel.setCellHeight(tp, "100%") modules = [r'''<a href="docpyjslib.html">pyjslib</a>'''] contents = self.multicolumn(modules) title = bigtitle('Modules') contents = section(title, 'module', contents) tp.add(contents, 'Modules') classes = [ Proto('Location'), ] class_content = { 'Location': r'''<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="Location">class <strong>Location</strong></a></font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> <td colspan=2><tt>Retrieve this class by calling Window.getLocation().<br> <br> This provides a pyjs wrapper for the current location,<br> with some utility methods for convenience.<br> </tt></td></tr> <tr><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Location-__init__"><strong>__init__</strong></a>(self, location)</dt></dl> <dl><dt><a name="Location-getHash"><strong>getHash</strong></a>(self)</dt></dl> <dl><dt><a name="Location-getHashDict"><strong>getHashDict</strong></a>(self)</dt></dl> <dl><dt><a name="Location-getHost"><strong>getHost</strong></a>(self)</dt></dl> <dl><dt><a name="Location-getHostname"><strong>getHostname</strong></a>(self)</dt></dl> <dl><dt><a name="Location-getHref"><strong>getHref</strong></a>(self)</dt></dl> <dl><dt><a name="Location-getPageHref"><strong>getPageHref</strong></a>(self)</dt><dd><tt>Return href with any search or hash stripped</tt></dd></dl> <dl><dt><a name="Location-getPathname"><strong>getPathname</strong></a>(self)</dt></dl> <dl><dt><a name="Location-getPort"><strong>getPort</strong></a>(self)</dt></dl> <dl><dt><a name="Location-getProtocol"><strong>getProtocol</strong></a>(self)</dt></dl> <dl><dt><a name="Location-getSearch"><strong>getSearch</strong></a>(self)</dt></dl> <dl><dt><a name="Location-getSearchDict"><strong>getSearchDict</strong></a>(self)</dt></dl> <dl><dt><a name="Location-getSearchVar"><strong>getSearchVar</strong></a>(self, key)</dt></dl> <dl><dt><a name="Location-reload"><strong>reload</strong></a>(self)</dt></dl> <dl><dt><a name="Location-setHash"><strong>setHash</strong></a>(self, hash)</dt></dl> <dl><dt><a name="Location-setHashDict"><strong>setHashDict</strong></a>(self, hashDict)</dt></dl> <dl><dt><a name="Location-setHref"><strong>setHref</strong></a>(self, href)</dt></dl> <dl><dt><a name="Location-setSearch"><strong>setSearch</strong></a>(self, search)</dt></dl> <dl><dt><a name="Location-setSearchDict"><strong>setSearchDict</strong></a>(self, searchDict)</dt></dl> </td></tr></table>''', } self.class_doc = ClassDoc(classes, class_content) tp.add(self.class_doc, 'Classes') functions = ['<dl><dt><a name="-makeUrlDict"><strong>makeUrlDict</strong></a>(s)</dt></dl>\n', '<dl><dt><a name="-makeUrlStringFromDict"><strong>makeUrlStringFromDict</strong></a>(d)</dt></dl>\n'] title = bigtitle('Functions') contents = section(title, 'functions', HTML('\n'.join(functions))) tp.add(contents, 'Functions') tp.addTabListener(self) tp.selectTab(0) # Call the window resized handler to get the initial sizes setup. Doing # this in a deferred command causes it to occur after all widgets' sizes # have been computed by the browser. DeferredCommand().add(self)
def onModuleLoad(self): Window.addWindowResizeListener(self) panel = DockPanel() RootPanel().add(panel) self.panel = panel panel.setWidth("100%") # panel.setHeight("100%") panel.setSpacing(5) title = HTML("<h1>HTTPRequest</h1>") description = HTML("""""") # panel.add(title, DockPanel.NORTH) panel.add(description, DockPanel.NORTH) links = VerticalPanel() links.setSpacing(8) panel.add(links, DockPanel.NORTH) head = HTML( """ <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>HTTPRequest</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/HTTPRequest.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/HTTPRequest.py</a></font></td></tr></table> """ ) panel.add(head, DockPanel.NORTH) docs = HTML("""""") panel.add(docs, DockPanel.NORTH) tp = TabPanel() tp.setWidth("100%") self.tp = tp panel.add(tp, DockPanel.SOUTH) # panel.setCellHeight(tp, "100%") modules = [r"""<a href="docpyjamas.Cookies.html">pyjamas.Cookies</a>""", r"""<a href="docsys.html">sys</a>"""] contents = self.multicolumn(modules) title = bigtitle("Modules") contents = section(title, "module", contents) tp.add(contents, "Modules") classes = [Proto("HTTPRequest")] class_content = { "HTTPRequest": r"""<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="HTTPRequest">class <strong>HTTPRequest</strong></a></font></td></tr> <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="HTTPRequest-asyncGet"><strong>asyncGet</strong></a>(self, user, pwd, url, handler)</dt><dd><tt># also callable as: <a href="#HTTPRequest-asyncGet">asyncGet</a>(self, url, handler)</tt></dd></dl> <dl><dt><a name="HTTPRequest-asyncGetImpl"><strong>asyncGetImpl</strong></a>(self, user, pwd, url, handler)</dt></dl> <dl><dt><a name="HTTPRequest-asyncPost"><strong>asyncPost</strong></a>(self, user, pwd, url, postData<font color="#909090">=None</font>, handler<font color="#909090">=None</font>)</dt><dd><tt># also callable as: <a href="#HTTPRequest-asyncPost">asyncPost</a>(self, url, postData, handler)</tt></dd></dl> <dl><dt><a name="HTTPRequest-asyncPostImpl"><strong>asyncPostImpl</strong></a>(self, user, pwd, url, postData, handler)</dt></dl> <dl><dt><a name="HTTPRequest-createXmlHTTPRequest"><strong>createXmlHTTPRequest</strong></a>(self)</dt></dl> <dl><dt><a name="HTTPRequest-doCreateXmlHTTPRequest"><strong>doCreateXmlHTTPRequest</strong></a>(self)</dt></dl> <dl><dt><a name="HTTPRequest-onReadyStateChange"><strong>onReadyStateChange</strong></a>(self, xmlHttp, event, ignorearg)</dt></dl> </td></tr></table>""" } self.class_doc = ClassDoc(classes, class_content) tp.add(self.class_doc, "Classes") tp.addTabListener(self) tp.selectTab(0) # Call the window resized handler to get the initial sizes setup. Doing # this in a deferred command causes it to occur after all widgets' sizes # have been computed by the browser. DeferredCommand().add(self)
def onModuleLoad(self): Window.addWindowResizeListener(self) panel = DockPanel() RootPanel().add(panel) self.panel = panel panel.setWidth("100%") # panel.setHeight("100%") panel.setSpacing(5) title = HTML("<h1>pyjslib</h1>") description = HTML("""""") # panel.add(title, DockPanel.NORTH) panel.add(description, DockPanel.NORTH) links = VerticalPanel() links.setSpacing(8) panel.add(links, DockPanel.NORTH) head = HTML( """ <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>pyjslib</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/pyjslib.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/pyjslib.py</a></font></td></tr></table> """ ) panel.add(head, DockPanel.NORTH) docs = HTML( """<tt># Copyright 2006 James Tauber and contributors<br> #<br> # Licensed under the Apache License, Version 2.0 (the "License");<br> # you may not use this file except in compliance with the License.<br> # You may obtain a copy of the License at<br> #<br> # <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a><br> #<br> # Unless required by applicable law or agreed to in writing, software<br> # distributed under the License is distributed on an "AS IS" BASIS,<br> # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br> # See the License for the specific language governing permissions and<br> # limitations under the License.</tt>""" ) panel.add(docs, DockPanel.NORTH) tp = TabPanel() tp.setWidth("100%") self.tp = tp panel.add(tp, DockPanel.SOUTH) # panel.setCellHeight(tp, "100%") classes = [Proto("Class"), Proto("Dict"), Proto("List", [Proto("Tuple"), Proto("Tuple")]), Proto("Object")] class_content = { "Tuple": r"""<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="Tuple">class <strong>Tuple</strong></a>(<a href="docpyjslib.html#List">List</a>)</font></td></tr> <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Tuple-__init__"><strong>__init__</strong></a>(self, data)</dt></dl> <hr> Methods inherited from <a href="docpyjslib.html#List">List</a>:<br> <dl><dt><a name="Tuple-__contains__"><strong>__contains__</strong></a>(self, value)</dt></dl> <dl><dt><a name="Tuple-__delitem__"><strong>__delitem__</strong></a>(self, index)</dt></dl> <dl><dt><a name="Tuple-__getitem__"><strong>__getitem__</strong></a>(self, index)</dt></dl> <dl><dt><a name="Tuple-__iter__"><strong>__iter__</strong></a>(self)</dt></dl> <dl><dt><a name="Tuple-__len__"><strong>__len__</strong></a>(self)</dt></dl> <dl><dt><a name="Tuple-__setitem__"><strong>__setitem__</strong></a>(self, index, value)</dt></dl> <dl><dt><a name="Tuple-append"><strong>append</strong></a>(self, item)</dt></dl> <dl><dt><a name="Tuple-getArray"><strong>getArray</strong></a>(self)</dt><dd><tt>Access the javascript Array that is used internally by this <a href="#list">list</a></tt></dd></dl> <dl><dt><a name="Tuple-index"><strong>index</strong></a>(self, value, start<font color="#909090">=0</font>)</dt></dl> <dl><dt><a name="Tuple-insert"><strong>insert</strong></a>(self, index, value)</dt></dl> <dl><dt><a name="Tuple-pop"><strong>pop</strong></a>(self, index<font color="#909090">=-1</font>)</dt></dl> <dl><dt><a name="Tuple-remove"><strong>remove</strong></a>(self, value)</dt></dl> <dl><dt><a name="Tuple-slice"><strong>slice</strong></a>(self, lower, upper)</dt></dl> <dl><dt><a name="Tuple-sort"><strong>sort</strong></a>(self, compareFunc<font color="#909090">=None</font>, keyFunc<font color="#909090">=None</font>, reverse<font color="#909090">=False</font>)</dt></dl> </td></tr></table>""", "list": r"""<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><strong>list</strong> = <a name="list">class List</a></font></td></tr> <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="List-__contains__"><strong>__contains__</strong></a>(self, value)</dt></dl> <dl><dt><a name="List-__delitem__"><strong>__delitem__</strong></a>(self, index)</dt></dl> <dl><dt><a name="List-__getitem__"><strong>__getitem__</strong></a>(self, index)</dt></dl> <dl><dt><a name="List-__init__"><strong>__init__</strong></a>(self, data<font color="#909090">=None</font>)</dt></dl> <dl><dt><a name="List-__iter__"><strong>__iter__</strong></a>(self)</dt></dl> <dl><dt><a name="List-__len__"><strong>__len__</strong></a>(self)</dt></dl> <dl><dt><a name="List-__setitem__"><strong>__setitem__</strong></a>(self, index, value)</dt></dl> <dl><dt><a name="List-append"><strong>append</strong></a>(self, item)</dt></dl> <dl><dt><a name="List-getArray"><strong>getArray</strong></a>(self)</dt><dd><tt>Access the javascript Array that is used internally by this <a href="#list">list</a></tt></dd></dl> <dl><dt><a name="List-index"><strong>index</strong></a>(self, value, start<font color="#909090">=0</font>)</dt></dl> <dl><dt><a name="List-insert"><strong>insert</strong></a>(self, index, value)</dt></dl> <dl><dt><a name="List-pop"><strong>pop</strong></a>(self, index<font color="#909090">=-1</font>)</dt></dl> <dl><dt><a name="List-remove"><strong>remove</strong></a>(self, value)</dt></dl> <dl><dt><a name="List-slice"><strong>slice</strong></a>(self, lower, upper)</dt></dl> <dl><dt><a name="List-sort"><strong>sort</strong></a>(self, compareFunc<font color="#909090">=None</font>, keyFunc<font color="#909090">=None</font>, reverse<font color="#909090">=False</font>)</dt></dl> </td></tr></table>""", "Object": r"""<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="Object">class <strong>Object</strong></a></font></td></tr> <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> <td width="100%"></td></tr></table>""", "List": r"""<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="List">class <strong>List</strong></a></font></td></tr> <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="List-__contains__"><strong>__contains__</strong></a>(self, value)</dt></dl> <dl><dt><a name="List-__delitem__"><strong>__delitem__</strong></a>(self, index)</dt></dl> <dl><dt><a name="List-__getitem__"><strong>__getitem__</strong></a>(self, index)</dt></dl> <dl><dt><a name="List-__init__"><strong>__init__</strong></a>(self, data<font color="#909090">=None</font>)</dt></dl> <dl><dt><a name="List-__iter__"><strong>__iter__</strong></a>(self)</dt></dl> <dl><dt><a name="List-__len__"><strong>__len__</strong></a>(self)</dt></dl> <dl><dt><a name="List-__setitem__"><strong>__setitem__</strong></a>(self, index, value)</dt></dl> <dl><dt><a name="List-append"><strong>append</strong></a>(self, item)</dt></dl> <dl><dt><a name="List-getArray"><strong>getArray</strong></a>(self)</dt><dd><tt>Access the javascript Array that is used internally by this <a href="#list">list</a></tt></dd></dl> <dl><dt><a name="List-index"><strong>index</strong></a>(self, value, start<font color="#909090">=0</font>)</dt></dl> <dl><dt><a name="List-insert"><strong>insert</strong></a>(self, index, value)</dt></dl> <dl><dt><a name="List-pop"><strong>pop</strong></a>(self, index<font color="#909090">=-1</font>)</dt></dl> <dl><dt><a name="List-remove"><strong>remove</strong></a>(self, value)</dt></dl> <dl><dt><a name="List-slice"><strong>slice</strong></a>(self, lower, upper)</dt></dl> <dl><dt><a name="List-sort"><strong>sort</strong></a>(self, compareFunc<font color="#909090">=None</font>, keyFunc<font color="#909090">=None</font>, reverse<font color="#909090">=False</font>)</dt></dl> </td></tr></table>""", "tuple": r"""<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><strong>tuple</strong> = <a name="tuple">class Tuple</a>(<a href="docpyjslib.html#List">List</a>)</font></td></tr> <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Tuple-__init__"><strong>__init__</strong></a>(self, data)</dt></dl> <hr> Methods inherited from <a href="docpyjslib.html#List">List</a>:<br> <dl><dt><a name="Tuple-__contains__"><strong>__contains__</strong></a>(self, value)</dt></dl> <dl><dt><a name="Tuple-__delitem__"><strong>__delitem__</strong></a>(self, index)</dt></dl> <dl><dt><a name="Tuple-__getitem__"><strong>__getitem__</strong></a>(self, index)</dt></dl> <dl><dt><a name="Tuple-__iter__"><strong>__iter__</strong></a>(self)</dt></dl> <dl><dt><a name="Tuple-__len__"><strong>__len__</strong></a>(self)</dt></dl> <dl><dt><a name="Tuple-__setitem__"><strong>__setitem__</strong></a>(self, index, value)</dt></dl> <dl><dt><a name="Tuple-append"><strong>append</strong></a>(self, item)</dt></dl> <dl><dt><a name="Tuple-getArray"><strong>getArray</strong></a>(self)</dt><dd><tt>Access the javascript Array that is used internally by this <a href="#list">list</a></tt></dd></dl> <dl><dt><a name="Tuple-index"><strong>index</strong></a>(self, value, start<font color="#909090">=0</font>)</dt></dl> <dl><dt><a name="Tuple-insert"><strong>insert</strong></a>(self, index, value)</dt></dl> <dl><dt><a name="Tuple-pop"><strong>pop</strong></a>(self, index<font color="#909090">=-1</font>)</dt></dl> <dl><dt><a name="Tuple-remove"><strong>remove</strong></a>(self, value)</dt></dl> <dl><dt><a name="Tuple-slice"><strong>slice</strong></a>(self, lower, upper)</dt></dl> <dl><dt><a name="Tuple-sort"><strong>sort</strong></a>(self, compareFunc<font color="#909090">=None</font>, keyFunc<font color="#909090">=None</font>, reverse<font color="#909090">=False</font>)</dt></dl> </td></tr></table>""", "dict": r"""<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><strong>dict</strong> = <a name="dict">class Dict</a></font></td></tr> <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Dict-__contains__"><strong>__contains__</strong></a>(self, key)</dt></dl> <dl><dt><a name="Dict-__delitem__"><strong>__delitem__</strong></a>(self, key)</dt></dl> <dl><dt><a name="Dict-__getitem__"><strong>__getitem__</strong></a>(self, key)</dt></dl> <dl><dt><a name="Dict-__init__"><strong>__init__</strong></a>(self, data<font color="#909090">=None</font>)</dt></dl> <dl><dt><a name="Dict-__iter__"><strong>__iter__</strong></a>(self)</dt></dl> <dl><dt><a name="Dict-__len__"><strong>__len__</strong></a>(self)</dt></dl> <dl><dt><a name="Dict-__setitem__"><strong>__setitem__</strong></a>(self, key, value)</dt></dl> <dl><dt><a name="Dict-get"><strong>get</strong></a>(self, key, default_value<font color="#909090">=None</font>)</dt></dl> <dl><dt><a name="Dict-getObject"><strong>getObject</strong></a>(self)</dt><dd><tt>Return the javascript <a href="#Object">Object</a> which this class uses to store dictionary keys and values</tt></dd></dl> <dl><dt><a name="Dict-has_key"><strong>has_key</strong></a>(self, key)</dt></dl> <dl><dt><a name="Dict-iteritems"><strong>iteritems</strong></a>(self)</dt></dl> <dl><dt><a name="Dict-iterkeys"><strong>iterkeys</strong></a>(self)</dt></dl> <dl><dt><a name="Dict-itervalues"><strong>itervalues</strong></a>(self)</dt></dl> <dl><dt><a name="Dict-keys"><strong>keys</strong></a>(self)</dt></dl> <dl><dt><a name="Dict-setdefault"><strong>setdefault</strong></a>(self, key, default_value)</dt></dl> <dl><dt><a name="Dict-update"><strong>update</strong></a>(self, d)</dt></dl> <dl><dt><a name="Dict-values"><strong>values</strong></a>(self)</dt></dl> </td></tr></table>""", "Dict": r"""<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="Dict">class <strong>Dict</strong></a></font></td></tr> <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Dict-__contains__"><strong>__contains__</strong></a>(self, key)</dt></dl> <dl><dt><a name="Dict-__delitem__"><strong>__delitem__</strong></a>(self, key)</dt></dl> <dl><dt><a name="Dict-__getitem__"><strong>__getitem__</strong></a>(self, key)</dt></dl> <dl><dt><a name="Dict-__init__"><strong>__init__</strong></a>(self, data<font color="#909090">=None</font>)</dt></dl> <dl><dt><a name="Dict-__iter__"><strong>__iter__</strong></a>(self)</dt></dl> <dl><dt><a name="Dict-__len__"><strong>__len__</strong></a>(self)</dt></dl> <dl><dt><a name="Dict-__setitem__"><strong>__setitem__</strong></a>(self, key, value)</dt></dl> <dl><dt><a name="Dict-get"><strong>get</strong></a>(self, key, default_value<font color="#909090">=None</font>)</dt></dl> <dl><dt><a name="Dict-getObject"><strong>getObject</strong></a>(self)</dt><dd><tt>Return the javascript <a href="#Object">Object</a> which this class uses to store dictionary keys and values</tt></dd></dl> <dl><dt><a name="Dict-has_key"><strong>has_key</strong></a>(self, key)</dt></dl> <dl><dt><a name="Dict-iteritems"><strong>iteritems</strong></a>(self)</dt></dl> <dl><dt><a name="Dict-iterkeys"><strong>iterkeys</strong></a>(self)</dt></dl> <dl><dt><a name="Dict-itervalues"><strong>itervalues</strong></a>(self)</dt></dl> <dl><dt><a name="Dict-keys"><strong>keys</strong></a>(self)</dt></dl> <dl><dt><a name="Dict-setdefault"><strong>setdefault</strong></a>(self, key, default_value)</dt></dl> <dl><dt><a name="Dict-update"><strong>update</strong></a>(self, d)</dt></dl> <dl><dt><a name="Dict-values"><strong>values</strong></a>(self)</dt></dl> </td></tr></table>""", "Class": r"""<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="Class">class <strong>Class</strong></a></font></td></tr> <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Class-__init__"><strong>__init__</strong></a>(self, name)</dt></dl> <dl><dt><a name="Class-__str___"><strong>__str___</strong></a>(self)</dt></dl> </td></tr></table>""", } self.class_doc = ClassDoc(classes, class_content) tp.add(self.class_doc, "Classes") functions = [ '<dl><dt><a name="-cmp"><strong>cmp</strong></a>(a, b)</dt></dl>\n', '<dl><dt><a name="-dir"><strong>dir</strong></a>(obj)</dt></dl>\n', '<dl><dt><a name="-filter"><strong>filter</strong></a>(obj, method, sequence<font color="#909090">=None</font>)</dt></dl>\n', '<dl><dt><a name="-getattr"><strong>getattr</strong></a>(obj, method)</dt></dl>\n', '<dl><dt><a name="-hasattr"><strong>hasattr</strong></a>(obj, method)</dt></dl>\n', '<dl><dt><a name="-hash"><strong>hash</strong></a>(obj)</dt></dl>\n', '<dl><dt><a name="-isArray"><strong>isArray</strong></a>(a)</dt></dl>\n', '<dl><dt><a name="-isFunction"><strong>isFunction</strong></a>(a)</dt></dl>\n', '<dl><dt><a name="-isIteratable"><strong>isIteratable</strong></a>(a)</dt></dl>\n', '<dl><dt><a name="-isNull"><strong>isNull</strong></a>(a)</dt></dl>\n', '<dl><dt><a name="-isNumber"><strong>isNumber</strong></a>(a)</dt></dl>\n', '<dl><dt><a name="-isObject"><strong>isObject</strong></a>(a)</dt><dd><tt># type functions from Douglas Crockford\'s Remedial Javascript: <a href="http://www.crockford.com/javascript/remedial.html">http://www.crockford.com/javascript/remedial.html</a></tt></dd></dl>\n', '<dl><dt><a name="-isString"><strong>isString</strong></a>(a)</dt></dl>\n', '<dl><dt><a name="-isUndefined"><strong>isUndefined</strong></a>(a)</dt></dl>\n', '<dl><dt><a name="-len"><strong>len</strong></a>(object)</dt></dl>\n', '<dl><dt><a name="-map"><strong>map</strong></a>(obj, method, sequence<font color="#909090">=None</font>)</dt></dl>\n', '<dl><dt><a name="-printFunc"><strong>printFunc</strong></a>(objs)</dt></dl>\n', '<dl><dt><a name="-range"><strong>range</strong></a>()</dt><dd><tt># taken from mochikit: <a href="#-range">range</a>( [start,] stop[, step] )</tt></dd></dl>\n', '<dl><dt><a name="-slice"><strong>slice</strong></a>(object, lower, upper)</dt></dl>\n', '<dl><dt><a name="-toJSObjects"><strong>toJSObjects</strong></a>(x)</dt><dd><tt>Convert the pyjs pythonic <a href="#List">List</a> and <a href="#Dict">Dict</a> objects into javascript <a href="#Object">Object</a> and Array<br>\nobjects, recursively.</tt></dd></dl>\n', ] title = bigtitle("Functions") contents = section(title, "functions", HTML("\n".join(functions))) tp.add(contents, "Functions") data = [r"""<strong>next_hash_id</strong> = 0"""] title = bigtitle("Data") contents = section(title, "data", HTML("\n".join(data))) tp.add(contents, "Data") tp.addTabListener(self) tp.selectTab(0) # Call the window resized handler to get the initial sizes setup. Doing # this in a deferred command causes it to occur after all widgets' sizes # have been computed by the browser. DeferredCommand().add(self)
def onModuleLoad(self): panel = DockPanel() RootPanel().add(panel) panel.setWidth("100%") panel.setHeight("100%") panel.setSpacing(5) title = HTML('<h1>Hello</h1>') description = HTML("""""") panel.add(title, DockPanel.NORTH) panel.add(description, DockPanel.SOUTH) links = VerticalPanel() links.setSpacing(8) panel.add(links, DockPanel.NORTH) head = HTML(""" <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>Hello</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/examples/helloworld/Hello.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/examples/helloworld/Hello.py</a></font></td></tr></table> """) panel.add(head, DockPanel.NORTH) docs = HTML("""<tt><a href="#Hello">Hello</a> World Example</tt>""") panel.add(docs, DockPanel.NORTH) modules = eval(r'''['<a href="pyjamas.DOM.html">pyjamas.DOM</a>', '<a href="pyjamas.Window.html">pyjamas.Window</a>']''') contents = self.multicolumn(modules) contents = self.bigsection('Modules', '#fffff', '#aa55cc', contents) panel.add(contents, DockPanel.NORTH) classes = eval(r'''['<dl>\n<dt><font face="helvetica, arial"><a href="Hello.html#Hello">Hello</a>\n</font></dt></dl>\n', '<p>\n<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">\n<tr bgcolor="#ffc8d8">\n<td colspan=3 valign=bottom> <br>\n<font color="#000000" face="helvetica, arial"><a name="Hello">class <strong>Hello</strong></a></font></td></tr>\n \n<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>\n<td width="100%">Methods defined here:<br>\n<dl><dt><a name="Hello-onBrowserEvent"><strong>onBrowserEvent</strong></a>(self, event)</dt></dl>\n\n<dl><dt><a name="Hello-onModuleLoad"><strong>onModuleLoad</strong></a>(self)</dt></dl>\n\n<dl><dt><a name="Hello-onTimer"><strong>onTimer</strong></a>(self)</dt></dl>\n\n<dl><dt><a name="Hello-onWindowResized"><strong>onWindowResized</strong></a>(self, width, height)</dt></dl>\n\n</td></tr></table>']''') contents = self.multicolumn(modules) contents = self.bigsection( 'Classes', '#ffffff', '#ee77aa', HTML('\n'.join(classes))) panel.add(contents, DockPanel.NORTH) functions = eval(r'''['<dl><dt><a name="-greet"><strong>greet</strong></a>(sender, event)</dt></dl>\n']''') contents = self.multicolumn(modules) contents = self.bigsection( 'Functions', '#ffffff', '#eeaa77', HTML('\n'.join(functions))) panel.add(contents, DockPanel.NORTH) data = eval(r'''["<strong>test</strong> = 'hello'"]''') contents = self.multicolumn(modules) contents = self.bigsection( 'Data', '#ffffff', '#55aa55', HTML('\n'.join(data))) panel.add(contents, DockPanel.NORTH)
def __init__(self): DialogBox.__init__(self) # Use this opportunity to set the dialog's caption. self.setText("About the Mail Sample") # Create a DockPanel to contain the 'about' label and the 'OK' button. outer = DockPanel() outer.setSpacing(4) outer.add(Image(AboutDialog.LOGO_IMAGE), DockPanel.WEST) # Create the 'OK' button, along with a listener that hides the dialog # when the button is clicked. Adding it to the 'south' position within # the dock causes it to be placed at the bottom. buttonPanel = HorizontalPanel() buttonPanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) buttonPanel.add(Button("Close", self)) outer.add(buttonPanel, DockPanel.SOUTH) # Create the 'about' label. Placing it in the 'rest' position within the # dock causes it to take up any remaining space after the 'OK' button # has been laid out. textplain = "This sample application demonstrates the construction " textplain += "of a complex user interface using pyjamas' built-in widgets. Have a look " textplain += "at the code to see how easy it is to build your own apps!" text = HTML(textplain) text.setStyleName("mail-AboutText") outer.add(text, DockPanel.CENTER) # Add a bit of spacing and margin to the dock to keep the components from # being placed too closely together. outer.setSpacing(8) self.setWidget(outer)
def __init__(self): Sink.__init__(self) text="This is a <code>ScrollPanel</code> contained at " text+= "the center of a <code>DockPanel</code>. " text+= "By putting some fairly large contents " text+= "in the middle and setting its size explicitly, it becomes a " text+= "scrollable area within the page, but without requiring the use of " text+= "an IFRAME." text+= "Here's quite a bit more meaningless text that will serve primarily " text+= "to make this thing scroll off the bottom of its visible area. " text+= "Otherwise, you might have to make it really, really small in order " text+= "to see the nifty scroll bars!" contents = HTML(text) scroller = ScrollPanel(contents) scroller.setStyleName("ks-layouts-Scroller") dock = DockPanel() dock.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) 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() horz.setVerticalAlignment(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() vert.setHorizontalAlignment(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 " text+="components inside existing HTML, like this:" + "<span id='" + id text+="'></span>" + "Notice how the menu just fits snugly in there? Cute." html = HTMLPanel(text) #DOM.setStyleAttribute(menu.getElement(), "display", "inline") html.add(menu, id) panel = VerticalPanel() panel.setSpacing(8) panel.setHorizontalAlignment(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) self.initWidget(panel) self.setStyleName("ks-layouts")
def onModuleLoad(self): Window.addWindowResizeListener(self) panel = DockPanel() RootPanel().add(panel) self.panel = panel panel.setWidth("100%") #panel.setHeight("100%") panel.setSpacing(5) title = HTML('<h1>EventDelegate</h1>') description = HTML("""""") #panel.add(title, DockPanel.NORTH) panel.add(description, DockPanel.NORTH) links = VerticalPanel() links.setSpacing(8) panel.add(links, DockPanel.NORTH) head = HTML(""" <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>EventDelegate</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/EventDelegate.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/EventDelegate.py</a></font></td></tr></table> """) panel.add(head, DockPanel.NORTH) docs = HTML("""""") panel.add(docs, DockPanel.NORTH) tp = TabPanel() tp.setWidth("100%") self.tp = tp panel.add(tp, DockPanel.SOUTH) #panel.setCellHeight(tp, "100%") classes = [ Proto('EventDelegate'), ] class_content = { 'EventDelegate': r'''<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="EventDelegate">class <strong>EventDelegate</strong></a></font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> <td colspan=2><tt>Create the equivalent of a bound method. This also prepends extra <br> args, if any, to the called method's argument list when it calls it.<br> <br> Pass the method name you want to implement (javascript doesn't<br> support callables).<br> <br> @type args: list<br> @param args: If given, the arguments will be prepended to the <br> arguments passed to the event callback<br> </tt></td></tr> <tr><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="EventDelegate-__init__"><strong>__init__</strong></a>(self, eventMethodName, obj, method, *args)</dt></dl> <dl><dt><a name="EventDelegate-onEvent"><strong>onEvent</strong></a>(self, *args)</dt></dl> </td></tr></table>''', } self.class_doc = ClassDoc(classes, class_content) tp.add(self.class_doc, 'Classes') tp.addTabListener(self) tp.selectTab(0) # Call the window resized handler to get the initial sizes setup. Doing # this in a deferred command causes it to occur after all widgets' sizes # have been computed by the browser. DeferredCommand().add(self)
def onModuleLoad(self): Window.addWindowResizeListener(self) panel = DockPanel() RootPanel().add(panel) self.panel = panel panel.setWidth("100%") #panel.setHeight("100%") panel.setSpacing(5) title = HTML('<h1>JSONParser</h1>') description = HTML("""""") #panel.add(title, DockPanel.NORTH) panel.add(description, DockPanel.NORTH) links = VerticalPanel() links.setSpacing(8) panel.add(links, DockPanel.NORTH) head = HTML(""" <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>JSONParser</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/JSONParser.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/JSONParser.py</a></font></td></tr></table> """) panel.add(head, DockPanel.NORTH) docs = HTML("""<tt>This module contains a JSON Parser class<br> <br> JSONEncode:<br> +---------------+-------------------+---------------+<br> | PYGWT | Python | JSON |<br> +===============+===================+===============+<br> | pyjslib_Dict | dict | object |<br> +---------------+-------------------+---------------+<br> | pyjslib_List | list, tuple | array |<br> +---------------+-------------------+---------------+<br> | string | str, unicode | string |<br> +---------------+-------------------+---------------+<br> | number | int, long, float | number |<br> +---------------+-------------------+---------------+<br> | true | True | true |<br> +---------------+-------------------+---------------+<br> | false | False | false |<br> +---------------+-------------------+---------------+<br> | null | None | null |<br> +---------------+-------------------+---------------+<br> <br> <br> JSONDecode:<br> +---------------+-------------------+--------------+<br> | JSON | Python | PYGWT |<br> +===============+===================+==============+<br> | object | dict | pyjslib_Dict |<br> +---------------+-------------------+--------------+<br> | array | list | pyjslib_List |<br> +---------------+-------------------+--------------+<br> | string | unicode | string |<br> +---------------+-------------------+--------------+<br> | number (int) | int, long | number |<br> +---------------+-------------------+--------------+<br> | number (real) | float | number |<br> +---------------+-------------------+--------------+<br> | true | True | true |<br> +---------------+-------------------+--------------+<br> | false | False | false |<br> +---------------+-------------------+--------------+<br> | null | None | null |<br> +---------------+-------------------+--------------+</tt>""") panel.add(docs, DockPanel.NORTH) tp = TabPanel() tp.setWidth("100%") self.tp = tp panel.add(tp, DockPanel.SOUTH) #panel.setCellHeight(tp, "100%") classes = [ Proto('JSONParser'), ] class_content = { 'JSONParser': r'''<p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="JSONParser">class <strong>JSONParser</strong></a></font></td></tr> <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="JSONParser-decode"><strong>decode</strong></a>(self, str)</dt></dl> <dl><dt><a name="JSONParser-decodeAsObject"><strong>decodeAsObject</strong></a>(self, str)</dt></dl> <dl><dt><a name="JSONParser-encode"><strong>encode</strong></a>(self, obj)</dt></dl> <dl><dt><a name="JSONParser-jsObjectToPy"><strong>jsObjectToPy</strong></a>(self, obj)</dt></dl> <dl><dt><a name="JSONParser-jsObjectToPyObject"><strong>jsObjectToPyObject</strong></a>(self, obj)</dt><dd><tt># TODO: __init__ parameters</tt></dd></dl> <dl><dt><a name="JSONParser-parseJSON"><strong>parseJSON</strong></a>(self, str)</dt></dl> <dl><dt><a name="JSONParser-toJSONString"><strong>toJSONString</strong></a>(self, obj)</dt><dd><tt># modified to detect __pyjslib_List & __pyjslib_Dict</tt></dd></dl> </td></tr></table>''', } self.class_doc = ClassDoc(classes, class_content) tp.add(self.class_doc, 'Classes') tp.addTabListener(self) tp.selectTab(0) # Call the window resized handler to get the initial sizes setup. Doing # this in a deferred command causes it to occur after all widgets' sizes # have been computed by the browser. DeferredCommand().add(self)
def __init__(self): DialogBox.__init__(self) self.setText("Sample DialogBox with embedded Frame") iframe = Frame(Popups().baseURL() + "rembrandt/LaMarcheNocturne.html") closeButton = Button("Close", self) msg = HTML("<center>This is an example of a standard dialog box component.<br> You can put pretty much anything you like into it,<br>such as the following IFRAME:</center>", True) dock = DockPanel() dock.setSpacing(4) dock.add(closeButton, DockPanel.SOUTH) dock.add(msg, DockPanel.NORTH) dock.add(iframe, DockPanel.CENTER) dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT) dock.setCellWidth(iframe, "100%") dock.setWidth("100%") iframe.setWidth("36em") iframe.setHeight("20em") self.setWidget(dock)
def __init__(self): Composite.__init__(self) panel = VerticalPanel() headerPanel = VerticalPanel() self.subject = HTML() self.sender = HTML() self.recipient = HTML() self.body = HTML() self.scroller = ScrollPanel(self.body) self.body.setWordWrap(True) headerPanel.add(self.subject) headerPanel.add(self.sender) headerPanel.add(self.recipient) headerPanel.setWidth("100%") innerPanel = DockPanel() innerPanel.add(headerPanel, DockPanel.NORTH) innerPanel.add(self.scroller, DockPanel.CENTER) innerPanel.setCellHeight(self.scroller, "100%") panel.add(innerPanel) innerPanel.setSize("100%", "100%") self.scroller.setSize("100%", "100%") self.initWidget(panel) self.setStyleName("mail-Detail") headerPanel.setStyleName("mail-DetailHeader") innerPanel.setStyleName("mail-DetailInner") self.subject.setStyleName("mail-DetailSubject") self.sender.setStyleName("mail-DetailSender") self.recipient.setStyleName("mail-DetailRecipient") self.body.setStyleName("mail-DetailBody")
class KitchenSink: def onHistoryChanged(self, token): print "history changed", token info = self.sink_list.find(token) if info: self.show(info, False) else: self.showInfo() def onModuleLoad(self): self.curInfo='' self.curSink=None self.description=HTML() self.sink_list=SinkList() self.panel=DockPanel() self.loadSinks() self.sinkContainer = DockPanel() self.sinkContainer.setStyleName("ks-Sink") vp=VerticalPanel() vp.setWidth("100%") vp.add(self.description) vp.add(self.sinkContainer) self.description.setStyleName("ks-Info") self.panel.add(self.sink_list, DockPanel.WEST) self.panel.add(vp, DockPanel.CENTER) self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP) self.panel.setCellWidth(vp, "100%") History().addHistoryListener(self) RootPanel().add(self.panel) #RootPanel().add(Logger()) #Show the initial screen. initToken = History().getToken() if len(initToken): self.onHistoryChanged(initToken) else: self.showInfo() def show(self, info, affectHistory): if info == self.curInfo: return self.curInfo = info #Logger().write("", "showing " + info.getName()) if self.curSink <> None: self.curSink.onHide() #Logger().write("", "removing " + self.curSink) self.sinkContainer.remove(self.curSink) self.curSink = info.getInstance() self.sink_list.setSinkSelection(info.getName()) self.description.setHTML(info.getDescription()) if (affectHistory): History().newItem(info.getName()) self.sinkContainer.add(self.curSink, DockPanel.CENTER) self.sinkContainer.setCellWidth(self.curSink, "100%") self.sinkContainer.setCellHeight(self.curSink, "100%") self.sinkContainer.setCellVerticalAlignment(self.curSink, HasAlignment.ALIGN_TOP) self.curSink.onShow() def loadSinks(self): self.sink_list.addSink(Info.init()) self.sink_list.addSink(Buttons.init()) self.sink_list.addSink(Menus.init()) self.sink_list.addSink(Images.init()) self.sink_list.addSink(Layouts.init()) self.sink_list.addSink(Lists.init()) self.sink_list.addSink(Popups.init()) self.sink_list.addSink(Tables.init()) self.sink_list.addSink(Text.init()) self.sink_list.addSink(Trees.init()) self.sink_list.addSink(Frames.init()) self.sink_list.addSink(Tabs.init()) def showInfo(self): self.show(self.sink_list.find("Info"), False)
class NavBar(Composite): def __init__(self, owner): Composite.__init__(self) self.owner = owner self.bar = DockPanel() self.gotoFirst = Button("<<", self) self.gotoNext = Button(">", self) self.gotoPrev = Button("<", self) self.status = HTML() self.initWidget(self.bar) self.bar.setStyleName("navbar") self.status.setStyleName("status") buttons = HorizontalPanel() buttons.add(self.gotoFirst) buttons.add(self.gotoPrev) buttons.add(self.gotoNext) self.bar.add(buttons, DockPanel.EAST) self.bar.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT) self.bar.add(self.status, DockPanel.CENTER) self.bar.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) self.bar.setCellHorizontalAlignment(self.status, HasAlignment.ALIGN_RIGHT) self.bar.setCellVerticalAlignment(self.status, HasAlignment.ALIGN_MIDDLE) self.bar.setCellWidth(self.status, "100%") self.gotoPrev.setEnabled(False) self.gotoFirst.setEnabled(False) def onClick(self, sender): if sender == self.gotoNext: self.owner.startRow += self.owner.getDataRowCount() self.owner.refresh() elif sender == self.gotoPrev: self.owner.startRow -= self.owner.getDataRowCount() if self.owner.startRow < 0: self.owner.startRow = 0 self.owner.refresh() elif sender == self.gotoFirst: self.owner.startRow = 0 self.owner.refresh()