Example #1
0
    def __init__(self):
        Sink.__init__(self)
        self.frame = Frame(self.baseURL() + "rembrandt/LaMarcheNocturne.html")

        self.frame.setWidth("100%")
        self.frame.setHeight("48em")
        self.initWidget(self.frame)
Example #2
0
File: Text.py Project: Afey/pyjs
    def __init__(self):
        Sink.__init__(self)
        self.fPasswordText = PasswordTextBox()
        self.fTextArea = TextArea()
        self.fTextBox = TextBox()

        panel = VerticalPanel()
        panel.setSpacing(8)
        panel.add(HTML("Normal text box:"))
        panel.add(self.createTextThing(self.fTextBox))
        panel.add(HTML("Password text box:"))
        panel.add(self.createTextThing(self.fPasswordText))
        panel.add(HTML("Text area:"))
        panel.add(self.createTextThing(self.fTextArea))

        panel.add(HTML("""Textarea below demos oninput event. oninput allows
to detect when the content of an element has changed. This is different
from examples above, where changes are detected only if they are made with
keyboard. oninput occurs when the content is changed through any user
interface(keyboard, mouse, etc.). For example, at first type few chars, but
then paste some text to the text areas above and below by selecting 'Paste'
command from context menu or by dragging&dropping and see the difference.
oninput is similar to onchange event, but onchange event fires only when a
text-entry widget loses focus."""))
        vp = VerticalPanel()
        self.echo = HTML()
        textArea = TextArea()
        vp.add(textArea)
        vp.add(self.echo)
        textArea.addInputListener(self)
        panel.add(vp)

        self.initWidget(panel)
Example #3
0
    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)           
Example #4
0
    def __init__(self):
        Sink.__init__(self)

        self.fTabs = TabPanel()
        self.fTabs.addTabListener(self)
        self.fTabs.add(
            self.createImage(self.baseURL() + "rembrandt/JohannesElison.jpg"),
            "1634")
        self.fTabs.add(
            self.createImage(self.baseURL() +
                             "rembrandt/SelfPortrait1640.jpg"), "1640")
        self.fTabs.add(
            self.createImage(self.baseURL() +
                             "rembrandt/LaMarcheNocturne.jpg"), "1642")
        self.fTabs.add(
            self.createImage(self.baseURL() +
                             "rembrandt/TheReturnOfTheProdigalSon.jpg"),
            "1662")
        self.fTabs.add(
            self.createImage(self.baseURL() +
                             "rembrandt/TheReturnOfTheProdigalSon.jpg"),
            "1662 (disabled)")
        self.fTabs.selectTab(0)

        self.fTabs.setWidth("100%")
        self.fTabs.setHeight("100%")
        self.initWidget(self.fTabs)
Example #5
0
    def __init__(self):
        Sink.__init__(self)
        colour_grid = ColourGridCanvas()
        rotated = RotatedCanvas()
        spheres = SpheresCanvas()
        #pattern = PatternCanvas()
        spiro = SpiroCanvas()
        self.solar = SolarCanvas()

        row0 = HorizontalPanel()
        row0.setSpacing(8)
        row0.add(colour_grid)
        row0.add(rotated)
        row0.add(spheres)
        #row0.add(pattern)

        row1 = HorizontalPanel()
        row1.setSpacing(8)
        row1.add(self.solar)
        row1.add(spiro)

        panel = VerticalPanel()
        panel.add(row0)
        panel.add(row1)

        self.setWidget(panel)
Example #6
0
    def __init__(self):
        Sink.__init__(self)
        self.fPasswordText = PasswordTextBox()
        self.fTextArea = TextArea()
        self.fTextBox = TextBox()

        panel = VerticalPanel()
        panel.setSpacing(8)
        panel.add(HTML("Normal text box:"))
        panel.add(self.createTextThing(self.fTextBox))
        panel.add(HTML("Password text box:"))
        panel.add(self.createTextThing(self.fPasswordText))
        panel.add(HTML("Text area:"))
        panel.add(self.createTextThing(self.fTextArea))

        panel.add(
            HTML("""Textarea below demos oninput event. oninput allows
to detect when the content of an element has changed. This is different
from examples above, where changes are detected only if they are made with
keyboard. oninput occurs when the content is changed through any user
interface(keyboard, mouse, etc.). For example, at first type few chars, but
then paste some text to the text areas above and below by selecting 'Paste'
command from context menu or by dragging&dropping and see the difference.
oninput is similar to onchange event, but onchange event fires only when a
text-entry widget loses focus."""))
        vp = VerticalPanel()
        self.echo = HTML()
        textArea = TextArea()
        vp.add(textArea)
        vp.add(self.echo)
        textArea.addInputListener(self)
        panel.add(vp)

        self.initWidget(panel)
Example #7
0
    def __init__(self):

        Sink.__init__(self)

        self.formula = AX_REG
        self.image1 = Image(latex_to_url(self.formula.fill_with_placeholders().to_latex()))
        self.cnf=self.formula.simplify().to_cnf()
        self.image2 = Image(latex_to_url(self.cnf.to_latex()))
        self.vars=self.cnf.get_vars()

        self.vars_with_proto = [{"var": var, "proto": Proto(var.name)} for var in self.vars]
        self.fProto = [
            Proto("Beethoven", [x["proto"] for x in self.vars_with_proto])
        ]

        self.fTree = Tree()

        for i in range(len(self.fProto)):
            self.createItem(self.fProto[i])
            self.fTree.addItem(self.fProto[i].item)

        self.fTree.addTreeListener(self)

        self.panel = HorizontalPanel(VerticalAlignment=HasAlignment.ALIGN_TOP)
        self.panel.setSpacing(40)
        self.panel.add(self.fTree)

        self.panel.add(self.image1)
        self.panel.add(self.image2)

        self.initWidget(self.panel)
Example #8
0
    def __init__(self):
        Sink.__init__(self)
        colour_grid = ColourGridCanvas()
        rotated = RotatedCanvas()
        spheres = SpheresCanvas()
        #pattern = PatternCanvas()
        spiro = SpiroCanvas()
        self.solar = SolarCanvas()

        row0 = HorizontalPanel()
        row0.setSpacing(8)
        row0.add(colour_grid)
        row0.add(rotated)
        row0.add(spheres)
        #row0.add(pattern)

        row1 = HorizontalPanel()
        row1.setSpacing(8)
        row1.add(self.solar)
        row1.add(spiro)

        panel = VerticalPanel()
        panel.add(row0)
        panel.add(row1)

        self.setWidget(panel)
Example #9
0
 def __init__(self):
     Sink.__init__(self)
     self.frame=Frame(self.baseURL() + "rembrandt/LaMarcheNocturne.html")
     
     self.frame.setWidth("100%")
     self.frame.setHeight("48em")
     self.initWidget(self.frame)
Example #10
0
File: Slide.py Project: Afey/pyjs
    def __init__(self):

        Sink.__init__(self)

        text="<div class='infoProse'>This is the Kitchen Sink sample.  "

        self.vp = VerticalPanel()
        self.initWidget(self.vp)
        self.loaded = False
Example #11
0
    def __init__(self):

        Sink.__init__(self)

        text = "<div class='infoProse'>This is the Kitchen Sink sample.  "

        self.vp = VerticalPanel()
        self.initWidget(self.vp)
        self.loaded = False
Example #12
0
    def __init__(self):
        colours = ['Azure', 'Red', 'Rust', 'Green', 'Beige', 'Brass', 'Brown', 'Bronze', 'Blue', 'Black', 'Burgundy', 'Pink', 'Gold', 'Gray', 'Purple', 'Yellow', 'White']
        Sink.__init__(self)
        self.colour_input = AutoCompleteTextBox()
        self.colour_input.setCompletionItems(colours)
        
        panel = HorizontalPanel()
        panel.add(HTML("Enter a colour: "))
        panel.add(self.colour_input)

        panel.setSpacing(8)
        self.setWidget(panel)
Example #13
0
    def __init__(self):

        Sink.__init__(self)

        text="<div class='infoProse'>This is the Kitchen Sink sample.  "
        text+="It demonstrates many of the widgets in the Google Web Toolkit."
        text+="<p>This sample also demonstrates something else really useful in GWT: "
        text+="history support.  "
        text+="When you click on a link at the left, the location bar will be "
        text+="updated with the current <i>history token</i>, which keeps the app "
        text+="in a bookmarkable state.  The back and forward buttons work properly "
        text+="as well.  Finally, notice that you can right-click a link and 'open "
        text+="in new window' (or middle-click for a new tab in Firefox).</p></div>"
        self.initWidget(HTML(text, True))
Example #14
0
File: Tabs.py Project: Afey/pyjs
    def __init__(self):
        Sink.__init__(self)

        self.fTabs = TabPanel()
        self.fTabs.addTabListener(self)
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/JohannesElison.jpg"), "1634")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/SelfPortrait1640.jpg"), "1640")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"), "1642")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662")
        self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662 (disabled)")
        self.fTabs.selectTab(0)

        self.fTabs.setWidth("100%")
        self.fTabs.setHeight("100%")
        self.initWidget(self.fTabs)
Example #15
0
    def __init__(self):
        colours = [
            'Azure', 'Red', 'Rust', 'Green', 'Beige', 'Brass', 'Brown',
            'Bronze', 'Blue', 'Black', 'Burgundy', 'Pink', 'Gold', 'Gray',
            'Purple', 'Yellow', 'White'
        ]
        Sink.__init__(self)
        self.colour_input = AutoCompleteTextBox()
        self.colour_input.setCompletionItems(colours)

        panel = HorizontalPanel()
        panel.add(HTML("Enter a colour: "))
        panel.add(self.colour_input)

        panel.setSpacing(8)
        self.setWidget(panel)
Example #16
0
    def __init__(self):
        Sink.__init__(self)
        inner = Grid(10, 5, Width="100%", BorderWidth="1")
        outer = FlexTable(Width="100%", BorderWidth="1")

        outer.setWidget(0, 0, Image(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"))
        outer.getFlexCellFormatter().setColSpan(0, 0, 2)
        outer.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER)

        outer.setHTML(1, 0, "Look to the right...<br>That's a nested table component ->")
        outer.setWidget(1, 1, inner)
        outer.getCellFormatter().setColSpan(1, 1, 2)
        
        for i in range(10):
            for j in range(5):
                inner.setText(i, j, "%d" % i + ",%d" % j)

        self.initWidget(outer)
Example #17
0
    def __init__(self):
        Sink.__init__(self)
        inner = Grid(10, 5, Width="100%", BorderWidth="1")
        outer = FlexTable(Width="100%", BorderWidth="1")

        outer.setWidget(0, 0, Image(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"))
        outer.getFlexCellFormatter().setColSpan(0, 0, 2)
        outer.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER)

        outer.setHTML(1, 0, "Look to the right...<br>That's a nested table component ->")
        outer.setWidget(1, 1, inner)
        outer.getCellFormatter().setColSpan(1, 1, 2)

        for i in range(10):
            for j in range(5):
                inner.setText(i, j, "%d" % i + ",%d" % j)

        self.initWidget(outer)
Example #18
0
    def __init__(self):
        Sink.__init__(self)

        self.fDialogButton = Button("Show Dialog", self)
        self.fPopupButton = Button("Show Popup", self)
        self.fMultipleDialogButton = Button("Show muliple dialogs", self)
        
        panel = VerticalPanel()
        panel.add(self.fPopupButton)
        panel.add(self.fDialogButton)
        panel.add(self.fMultipleDialogButton)
        
        list = ListBox()
        list.setVisibleItemCount(5)
        for i in range(10):
            list.addItem("list item %d" % i)
        panel.add(list)
        
        panel.setSpacing(8)
        self.initWidget(panel)
Example #19
0
    def __init__(self):
        Sink.__init__(self)

        self.fDialogButton = Button("Show Dialog", self)
        self.fPopupButton = Button("Show Popup", self)
        self.fMultipleDialogButton = Button("Show muliple dialogs", self)

        panel = VerticalPanel()
        panel.add(self.fPopupButton)
        panel.add(self.fDialogButton)
        panel.add(self.fMultipleDialogButton)

        list = ListBox()
        list.setVisibleItemCount(5)
        for i in range(10):
            list.addItem("list item %d" % i)
        panel.add(list)

        panel.setSpacing(8)
        self.initWidget(panel)
Example #20
0
    def __init__(self):

        Sink.__init__(self)

        disabledButton = Button("Disabled Button")
        disabledCheck = CheckBox("Disabled Check")
        normalButton = Button("Normal Button")
        normalCheck = CheckBox("Normal Check")
        panel = VerticalPanel()
        radio0 = RadioButton("group0", "Choice 0")
        radio1 = RadioButton("group0", "Choice 1")
        radio2 = RadioButton("group0", "Choice 2 (Disabled)")
        radio3 = RadioButton("group0", "Choice 3")

        hp = HorizontalPanel()
        panel.add(hp)
        hp.setSpacing(8)
        hp.add(normalButton)
        hp.add(disabledButton)

        hp = HorizontalPanel()
        panel.add(hp)
        hp.setSpacing(8)
        hp.add(normalCheck)
        hp.add(disabledCheck)

        hp = HorizontalPanel()
        panel.add(hp)
        hp.setSpacing(8)
        hp.add(radio0)
        hp.add(radio1)
        hp.add(radio2)
        hp.add(radio3)

        disabledButton.setEnabled(False)
        disabledCheck.setEnabled(False)
        radio2.setEnabled(False)

        panel.setSpacing(8)
        self.initWidget(panel)
Example #21
0
    def __init__(self):
        Sink.__init__(self)
        self.menu = MenuBar()

        subMenu = MenuBar(True)
        subMenu.addItem("<code>Code</code>", True, self)
        subMenu.addItem("<strike>Strikethrough</strike>", True, self)
        subMenu.addItem("<u>Underlined</u>", True, self)

        menu0 = MenuBar(True)
        menu0.addItem("<b>Bold</b>", True, self)
        menu0.addItem("<i>Italicized</i>", True, self)
        menu0.addItem("More &#187;", True, subMenu)
        menu1 = MenuBar(True)
        menu1.addItem("<font color='#FF0000'><b>Apple</b></font>", True, self)
        menu1.addItem("<font color='#FFFF00'><b>Banana</b></font>", True, self)
        menu1.addItem("<font color='#FFFFFF'><b>Coconut</b></font>", True,
                      self)
        menu1.addItem("<font color='#8B4513'><b>Donut</b></font>", True, self)
        menu2 = MenuBar(True)
        menu2.addItem("Bling", self)
        menu2.addItem("Ginormous", self)
        menu2.addItem("<code>w00t!</code>", True, self)

        self.menu.addItem(MenuItem("Style", menu0))
        self.menu.addItem(MenuItem("Fruit", menu1))
        self.menu.addItem(MenuItem("Term", menu2))

        self.menu.setWidth("100%")

        self.panel = VerticalPanel()
        self.context = HTML("""Right-Click me<br/>to show a context menu.<br />
                               Left-click me<br />to do absolutely nothing.""")

        self.panel.add(self.menu)
        self.panel.add(self.context)

        self.initWidget(self.panel)

        self.context.setContextMenu(self)
Example #22
0
    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)
Example #23
0
    def __init__(self):
        Sink.__init__(self)
        img = Image("images/num1.png")
        img.addMouseListener(TooltipListener("An image: " + img.getUrl()))
        
        img2 = Image("images/num2.png")
        img2.addMouseListener(TooltipListener("An image: " + img2.getUrl()))

        html = HTML("Some <i>HTML</i> text.")
        html.addMouseListener(TooltipListener("An HTML component."))
        
        panel_h = HorizontalPanel()
        panel_h.add(img)
        panel_h.add(img2)       
        panel_h.setSpacing(8)
        
        panel = VerticalPanel()
        panel.add(panel_h)
        panel.add(html)
        
        panel.setSpacing(8)
        self.setWidget(panel)
Example #24
0
    def __init__(self):
        Sink.__init__(self)
        self.menu = MenuBar()
        
        subMenu = MenuBar(True)
        subMenu.addItem("<code>Code</code>", True, self)
        subMenu.addItem("<strike>Strikethrough</strike>", True, self)
        subMenu.addItem("<u>Underlined</u>", True, self)
        
        menu0 = MenuBar(True)
        menu0.addItem("<b>Bold</b>", True, self)
        menu0.addItem("<i>Italicized</i>", True, self)
        menu0.addItem("More &#187;", True, subMenu)
        menu1 = MenuBar(True)
        menu1.addItem("<font color='#FF0000'><b>Apple</b></font>", True, self)
        menu1.addItem("<font color='#FFFF00'><b>Banana</b></font>", True, self)
        menu1.addItem("<font color='#FFFFFF'><b>Coconut</b></font>", True, self)
        menu1.addItem("<font color='#8B4513'><b>Donut</b></font>", True, self)
        menu2 = MenuBar(True)
        menu2.addItem("Bling", self)
        menu2.addItem("Ginormous", self)
        menu2.addItem("<code>w00t!</code>", True, self)
        
        self.menu.addItem(MenuItem("Style", menu0))
        self.menu.addItem(MenuItem("Fruit", menu1))
        self.menu.addItem(MenuItem("Term", menu2))
        
        self.menu.setWidth("100%")
        
        self.panel = VerticalPanel()
        self.context = HTML("""Right-Click me<br/>to show a context menu.<br />
                               Left-click me<br />to do absolutely nothing.""")

        self.panel.add(self.menu)
        self.panel.add(self.context)

        self.initWidget(self.panel)

        self.context.setContextMenu(self)
Example #25
0
    def __init__(self):
        Sink.__init__(self)
        img = Image("images/num1.png")
        img.addMouseListener(TooltipListener("An image: " + img.getUrl()))

        img2 = Image("images/num2.png")
        img2.addMouseListener(TooltipListener("An image: " + img2.getUrl()))

        html = HTML("Some <i>HTML</i> text.")
        html.addMouseListener(TooltipListener("An HTML component."))

        panel_h = HorizontalPanel()
        panel_h.add(img)
        panel_h.add(img2)
        panel_h.setSpacing(8)

        panel = VerticalPanel()
        panel.add(panel_h)
        panel.add(html)

        panel.setSpacing(8)
        self.setWidget(panel)
Example #26
0
File: Lists.py Project: Afey/pyjs
    def __init__(self):
        Sink.__init__(self)

        self.sStrings=[["foo0", "bar0", "baz0", "toto0", "tintin0"],
            ["foo1", "bar1", "baz1", "toto1", "tintin1"],
            ["foo2", "bar2", "baz2", "toto2", "tintin2"],
            ["foo3", "bar3", "baz3", "toto3", "tintin3"],
            ["foo4", "bar4", "baz4", "toto4", "tintin4"]]

        self.combo=ListBox(VisibleItemCount=1)
        self.list=ListBox(MultipleSelect=True, VisibleItemCount=10)
        self.echo=Label()

        self.combo.addChangeListener(self)

        for i in range(len(self.sStrings)):
            txt = "List %d" % i
            self.combo.addItem(txt)
            # test setItemText
            self.combo.setItemText(i, txt + " using set text")
        self.combo.setSelectedIndex(0)
        self.fillList(0)
        self.list.setItemSelected(0, False)
        self.list.setItemSelected(1, True)

        self.list.addChangeListener(self)

        horz = HorizontalPanel(VerticalAlignment=HasAlignment.ALIGN_TOP,
                               Spacing=8)
        horz.add(self.combo)
        horz.add(self.list)

        panel = VerticalPanel(HorizontalAlignment=HasAlignment.ALIGN_LEFT)
        panel.add(horz)
        panel.add(self.echo)
        self.initWidget(panel)

        self.echoSelection()
Example #27
0
    def __init__(self):
        Sink.__init__(self)

        self.sStrings = [["foo0", "bar0", "baz0", "toto0", "tintin0"],
                         ["foo1", "bar1", "baz1", "toto1", "tintin1"],
                         ["foo2", "bar2", "baz2", "toto2", "tintin2"],
                         ["foo3", "bar3", "baz3", "toto3", "tintin3"],
                         ["foo4", "bar4", "baz4", "toto4", "tintin4"]]

        self.combo = ListBox(VisibleItemCount=1)
        self.list = ListBox(MultipleSelect=True, VisibleItemCount=10)
        self.echo = Label()

        self.combo.addChangeListener(self)

        for i in range(len(self.sStrings)):
            txt = "List %d" % i
            self.combo.addItem(txt)
            # test setItemText
            self.combo.setItemText(i, txt + " using set text")
        self.combo.setSelectedIndex(0)
        self.fillList(0)
        self.list.setItemSelected(0, False)
        self.list.setItemSelected(1, True)

        self.list.addChangeListener(self)

        horz = HorizontalPanel(VerticalAlignment=HasAlignment.ALIGN_TOP,
                               Spacing=8)
        horz.add(self.combo)
        horz.add(self.list)

        panel = VerticalPanel(HorizontalAlignment=HasAlignment.ALIGN_LEFT)
        panel.add(horz)
        panel.add(self.echo)
        self.initWidget(panel)

        self.echoSelection()
Example #28
0
 def __init__(self):
     text="<div class='infoProse'>Welcome to the Addons Gallery.  "
     text+="This app shows off the addon components for Pyjamas.</div>"
     Sink.__init__(self)
     self.setWidget(HTML(text, True))
Example #29
0
    def __init__(self):
        Sink.__init__(self)
        self.fProto = [
            Proto("Beethoven", [
                Proto("Concertos", [
                    Proto("No. 1 - C"), 
                    Proto("No. 2 - B-Flat Major"), 
                    Proto("No. 3 - C Minor"), 
                    Proto("No. 4 - G Major"), 
                    Proto("No. 5 - E-Flat Major")
                ]),
                Proto("Quartets", [
                    Proto("Six String Quartets"), 
                    Proto("Three String Quartets"), 
                    Proto("Grosse Fugue for String Quartets")
                ]),
                Proto("Sonatas", [
                    Proto("Sonata in A Minor"), 
                    Proto("Sonata in F Major")
                ]),
                Proto("Symphonies", [
                    Proto("No. 1 - C Major"), 
                    Proto("No. 2 - D Major"), 
                    Proto("No. 3 - E-Flat Major"), 
                    Proto("No. 4 - B-Flat Major"), 
                    Proto("No. 5 - C Minor"), 
                    Proto("No. 6 - F Major"), 
                    Proto("No. 7 - A Major"), 
                    Proto("No. 8 - F Major"), 
                    Proto("No. 9 - D Minor")
                ])
            ]),
        
            Proto("Brahms", [
                Proto("Concertos", [
                    Proto("Violin Concerto"),
                    Proto("Double Concerto - A Minor"),
                    Proto("Piano Concerto No. 1 - D Minor"),
                    Proto("Piano Concerto No. 2 - B-Flat Major")
                ]),
                Proto("Quartets", [
                    Proto("Piano Quartet No. 1 - G Minor"),
                    Proto("Piano Quartet No. 2 - A Major"),
                    Proto("Piano Quartet No. 3 - C Minor"),
                    Proto("String Quartet No. 3 - B-Flat Minor")
                ]),
                Proto("Sonatas", [
                    Proto("Two Sonatas for Clarinet - F Minor"),
                    Proto("Two Sonatas for Clarinet - E-Flat Major")
                ]),
                Proto("Symphonies", [
                    Proto("No. 1 - C Minor"),
                    Proto("No. 2 - D Minor"),
                    Proto("No. 3 - F Major"),
                    Proto("No. 4 - E Minor")
                ])      
            ]),
        
            Proto("Mozart", [
                Proto("Concertos", [
                    Proto("Piano Concerto No. 12"),
                    Proto("Piano Concerto No. 17"),
                    Proto("Clarinet Concerto"),
                    Proto("Violin Concerto No. 5"),
                    Proto("Violin Concerto No. 4")
                ]),
            ])
        ]

        self.fTree = Tree()
        
        for i in range(len(self.fProto)):
            self.createItem(self.fProto[i])
            self.fTree.addItem(self.fProto[i].item)
        
        self.fTree.addTreeListener(self)
        self.initWidget(self.fTree)
Example #30
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")
Example #31
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")
Example #32
0
 def __init__(self):
   Sink.__init__(self)
   self.context.setContextMenu(self)
Example #33
0
 def __init__(self):
     text = "<div class='infoProse'>Welcome to the Addons Gallery.  "
     text += "This app shows off the addon components for Pyjamas.</div>"
     Sink.__init__(self)
     self.setWidget(HTML(text, True))