Exemple #1
0
 def __init__(self, key, title, content):
     AbsolutePanel.__init__(self)
     self.edit_header = Label("Edit a Post", StyleName="header_label")
     self.edit_title_label = Label("Title:")
     self.edit_title = TextBox()
     self.edit_title.setMaxLength(255)
     self.edit_content = TextArea()
     self.edit_content.setVisibleLines(2)
     self.edit_button = Button("Save")
     self.edit_cancel_button = Button("Cancel")
     self.edit_hidden_key = Hidden()
     self.error_message_label = Label("", StyleName="error_message_label")
     edit_contents = VerticalPanel(StyleName="Contents", Spacing=4)
     edit_contents.add(self.edit_header)
     edit_contents.add(self.edit_title_label)
     edit_contents.add(self.edit_title)
     edit_contents.add(self.edit_content)
     edit_contents.add(self.edit_button)
     edit_contents.add(self.edit_cancel_button)
     edit_contents.add(self.error_message_label)
     edit_contents.add(self.edit_hidden_key)
     self.edit_dialog = DialogBox(glass=True)
     self.edit_dialog.setHTML('<b>Blog Post Form</b>')
     self.edit_dialog.setWidget(edit_contents)
     left = (Window.getClientWidth() - 900) / 2 + Window.getScrollLeft()
     top = (Window.getClientHeight() - 600) / 2 + Window.getScrollTop()
     self.edit_dialog.setPopupPosition(left, top)
     self.edit_dialog.hide()
Exemple #2
0
    def __init__(self):
        SimplePanel.__init__(self)

        self.form = FormPanel()
        self.form.setAction("http://google.com/search")
        self.form.setTarget("results")

        panel = VerticalPanel()
        panel.add(Hidden("q", "python pyjamas"))
        panel.add(Button("Search", getattr(self, "onBtnClick")))

        results = NamedFrame("results")
        panel.add(results)

        self.form.add(panel)
        self.add(self.form)