def drawFull(self, month, year): # should be called only once when we draw the calendar for # the first time self.vp = VerticalPanel() self.vp.setSpacing(2) self.vp.addStyleName("calendarbox calendar-module calendar") self.setWidget(self.vp) self.setVisible(False) # mth = int(month) yr = int(year) tp = HorizontalPanel() tp.addStyleName("calendar-top-panel") tp.setSpacing(5) h1 = Hyperlink('<<') h1.addClickListener(getattr(self, 'onPreviousYear')) h2 = Hyperlink('<') h2.addClickListener(getattr(self, 'onPreviousMonth')) h4 = Hyperlink('>') h4.addClickListener(getattr(self, 'onNextMonth')) h5 = Hyperlink('>>') h5.addClickListener(getattr(self, 'onNextYear')) tp.add(h1) tp.add(h2) # titlePanel can be changed, whenever we draw, so keep the reference txt = "<b>" txt += self.getMonthsOfYear()[mth - 1] + " " + str(yr) txt += "</b>" self.titlePanel = SimplePanel() self.titlePanel.setWidget(HTML(txt)) self.titlePanel.setStyleName("calendar-center") tp.add(self.titlePanel) tp.add(h4) tp.add(h5) tvp = VerticalPanel() tvp.setSpacing(10) tvp.add(tp) self.vp.add(tvp) # done with top panel self.middlePanel = SimplePanel() grid = self.drawGrid(mth, yr) self.middlePanel.setWidget(grid) self.vp.add(self.middlePanel) self.defaultGrid = grid self._gridShortcutsLinks() self._gridCancelLink() # # add code to test another way of doing the layout # self.setVisible(True) return
def InitialiseScreen(self): hpanel = HorizontalPanel() self.add(hpanel) vpanelMenu = VerticalPanel() hpanel.add(vpanelMenu) self.addbutton = Button("Add Triangle") vpanelMenu.add(self.addbutton) self.addbutton.addClickListener(getattr(self, "addtriangle")) self.canvas = GWTCanvas(self.CANVAS_WIDTH, self.CANVAS_HEIGHT) vpanelCanvas = VerticalPanel() self.canvas.setWidth(self.CANVAS_WIDTH) self.canvas.setHeight(self.CANVAS_HEIGHT) hpanel.add(vpanelCanvas) vpanelCanvas.add(self.canvas) self.canvas.addMouseListener(self) self.selecteditem = None self.selectedhandle = None self.mouseisdown = False dc = DocumentCollection.documentcollection DocumentCollection.documentcollection.edgelistener = self.EdgeListener if len(dc.documentsbyclass[model.Drawing.__name__]) == 0: drawing = model.Drawing(None) dc.AddDocumentObject(drawing) EdgePoster([a.asDict() for a in drawing.history.GetAllEdges()]) else: for k, v in dc.documentsbyclass[ model.Drawing.__name__].iteritems(): drawing = v self.drawingid = drawing.id self.Draw()
def __init__(self): AbsolutePanel.__init__(self) self.app = CompaniesApp() self.history = [] self.save = Button("save", self) self.selectDepartment = Button("select", self) self.selectEmployee = Button("select", self) self.edit = Button("edit", self) self.cut = Button("cut", self) self.back = Button("back", self) self.name = TextBox() self.address = TextBox() self.manager = TextBox() self.departments = ListBox(Size=("100%"), VisibleItemCount="5") self.employees = ListBox(Size=("100%"), VisibleItemCount="5") self.total = TextBox() self.errors = VerticalPanel() self.grid = Grid() self.allPanels = VerticalPanel() self.allPanels.add(self.grid) self.allPanels.add(self.errors) self.add(self.allPanels) self.initCompanyGUI()
def __init__(self, start_date, can_delete=True): # We need to use old form of inheritance because of pyjamas SimplePanel.__init__(self) self.vpanel = VerticalPanel() desc_panel = VerticalPanel() self.desc_box = TextBox() self.desc_box.setVisibleLength(44) self.desc_box.setStyleName('form-control') desc_lbl = Label('impediment description') desc_lbl.setStyleName('text-muted') desc_panel.add(self.desc_box) desc_panel.add(desc_lbl) # Set to False if loaded from database self.can_delete = can_delete status_panel = VerticalPanel() self.status_lst = ListBox(Height='34px') self.status_lst.setStyleName('form-control input-lg') self.status_lst.addItem('Open') self.status_lst.addItem('Closed') # we put date here self.status_lbl = Label('') self.set_start_date(start_date) self.status_lbl.setStyleName('text-muted') status_panel = VerticalPanel() status_panel.add(self.status_lst) status_panel.add(self.status_lbl) self.comment = Text_Area_Row('', 'why it exists or is being closed') hpanel = HorizontalPanel() hpanel.add(desc_panel) hpanel.add(Label(Width='10px')) hpanel.add(status_panel) self.vpanel.add(hpanel) self.vpanel.add(self.comment.panel())
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)
def __init__(self): self.WEIGHT_TYPES = [ ProductWeights, OrderDependentWeights, PODWeights, ProjectionDependentWeights ] self._add_dialog, self._wtype = self._create_add_dialog() self.panel = VerticalPanel() self._list_panel = VerticalPanel(Spacing=8) self.panel.add(self._list_panel) link = Hyperlink("add...", StyleName="action") link.addClickListener(getattr(self, 'show_add_dialog')) self.panel.add(link) self._weights = [] self._dimension = 0
def __init__(self, subCategoryName='', subCategoryClassName='', openList=True): self.list = VerticalPanel(StyleName='block_list') self.list.setStyleAttribute("display", "block") VerticalPanel.__init__(self, StyleName='SubCategoryPanel') self.subCategoryName = subCategoryName if subCategoryName != '': self.title = Element(Element=DOM.createElement('dt'), StyleName=subCategoryClassName) DOM.setInnerHTML(self.title.getElement(), self.subCategoryName) self.collapse = FocusWidget(Element=DOM.createDiv(), StyleName='collapse close_up') self.collapse.addClickListener(self.showHide) self.title.add(self.collapse) self.add(self.title) if openList: self.list.setStyleAttribute("display", "block") self.collapse.setStyleName('collapse close_up') else: self.list.setStyleAttribute("display", "none") self.collapse.setStyleName('collapse open_down') self.add(self.list) self.blocks = [] self.count = 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()
def __init__(self, parent): AbsolutePanel.__init__(self) self.roleList = ListBox() self.roleList.setWidth('300px') self.roleList.setVisibleItemCount(6) self.roleList.addChangeListener(self.onListChange) #self.roleList.addKeyboardListener(self) self.roleCombo = ListBox() self.roleCombo.addKeyboardListener(self) self.roleCombo.addChangeListener(self.onComboChange) self.addBtn = Button("Add") self.addBtn.setEnabled(False) self.removeBtn = Button("Remove") self.removeBtn.setEnabled(False) vpanel = VerticalPanel() vpanel.add(self.roleList) hpanel = HorizontalPanel() hpanel.add(self.roleCombo) hpanel.add(self.addBtn) hpanel.add(self.removeBtn) vpanel.add(hpanel) self.add(vpanel) self.clearForm() return
def get_case_panel(self): panel = VerticalPanel() title = HTML("""Case""") panel.add(title) tree = self.get_case_tree() panel.add(tree) return panel
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)
def __init__(self, **kwargs): DialogWindow.__init__(self, modal=True, close=True) v = VerticalPanel() v.setWidth(300) # v.setHeight(500) self.setText("definition") self.setPopupPosition(100, 100) self.setStyleAttribute("background-color", "#ffffff") self.setStyleAttribute("color", "#9847a2") self.setStyleAttribute("border-width", "5px") self.setStyleAttribute("border-style", "solid") h = HorizontalPanel() self.textbox_name = TextBox() h.add(Label("name")) h.add(self.textbox_name) v.add(h) h = HorizontalPanel() self.textbox_scheme = TextBox() h.add(Label("print scheme")) h.add(self.textbox_scheme) v.add(h) self.add(v) self.theorems = list() self.radios = list() for t in Theorem.theorems: if t.formula.is_in_unique_form(): self.theorems.append(t) self.radios.append(RadioButton("group1", "")) h = HorizontalPanel() h.add(self.radios[-1]) im = Image() im.setUrl(latex_to_url(t.formula.to_latex())) h.add(im) v.add(h) v.add(Button("Done", self.done_click))
def __init__(self, tabBar=None, **kwargs): self.children = [] # TODO: can self.children be used instead? self.tab_names = {} self.deck = kwargs.pop('Deck', None) floatingtab = kwargs.pop('FloatingTab', False) if self.deck is None: self.deck = DeckPanel(StyleName="gwt-TabPanelBottom") if tabBar is None: self.tabBar = TabBar() else: self.tabBar = tabBar self.tabListeners = [] # this is awkward: VerticalPanel is the composite, # so we get the element here, and pass it in to VerticalPanel. element = kwargs.pop('Element', None) panel = VerticalPanel(Element=element) if not floatingtab: panel.add(self.tabBar) if self.deck.getParent() is None: panel.add(self.deck) panel.setCellHeight(self.deck, "100%") self.tabBar.setWidth("100%") self.tabBar.addTabListener(self) kwargs['StyleName'] = kwargs.get('StyleName', "gwt-TabPanel") PanelBase.__init__(self) Composite.__init__(self, panel, **kwargs)
def __init__(self): Sink.__init__(self) self.vp = VerticalPanel() self.initWidget(self.vp) self.loaded = False
def onModuleLoad(self): self.remote = DataService() vPanel = VerticalPanel() # create div to hold map mapPanel = SimplePanel() mapPanel.setSize('700px', '400px') # initiate getting gps data from web2py self.remote.getPoints(self) # create slider div slider = SimplePanel() self.slider = slider # add map and slide to main panel vPanel.add(mapPanel) vPanel.add(slider) # add everything to page's GreedyPyJs div root = RootPanelCls(DOM.getElementById("GreedPyJs")) root.add(vPanel) # Create initial google map self.map = GMap2(mapPanel.getElement()) self.map.setCenter(GLatLng(37.4419, -122.1419), 13) # create place to hold gps positions # these will be in tuples: (date, latitude, longitude) self.positions = []
def __init__(self, calendar): Composite.__init__(self) self.calendar = calendar self.dayCheckBoxListener = DayCheckBoxListener(calendar) self.outer = VerticalPanel() self.initWidget(self.outer) self.setStyleName("DynaTable-DayFilterWidget") self.outer.add(DayCheckBox(self, "Sunday", 0)) self.outer.add(DayCheckBox(self, "Monday", 1)) self.outer.add(DayCheckBox(self, "Tuesday", 2)) self.outer.add(DayCheckBox(self, "Wednesday", 3)) self.outer.add(DayCheckBox(self, "Thursday", 4)) self.outer.add(DayCheckBox(self, "Friday", 5)) self.outer.add(DayCheckBox(self, "Saturday", 6)) self.buttonAll = Button("All", self) self.buttonNone = Button("None", self) hp = HorizontalPanel() hp.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) hp.add(self.buttonAll) hp.add(self.buttonNone) self.outer.add(hp) self.outer.setCellVerticalAlignment(hp, HasAlignment.ALIGN_BOTTOM) self.outer.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_CENTER)
def __init__(self): SimplePanel.__init__(self) vert = VerticalPanel() vert.setSpacing("10px") self.add(vert) panel = ScrollPanel(Size=("300px", "100px")) contents = HTML("<b>Tao Te Ching, Chapter One</b><p>" + "The Way that can be told of is not an unvarying " + "way;<p>The names that can be named are not " + "unvarying names.<p>It was from the Nameless that " + "Heaven and Earth sprang;<p>The named is but the " + "mother that rears the ten thousand creatures, " + "each after its kind.") panel.add(contents) vert.add(panel) container = SimplePanel(Width="400px", Height="200px") contents2 = HTML( 50 * "Dont forget to grab the css for SuperScrollPanel in Showcase.css! " ) panel2 = SuperScrollPanel(contents2) container.add(panel2) vert.add(container)
def __init__(self): layout = VerticalPanel() layout.add( HTML( "<b style=\"color:#f00;\">Stroke Gradients currently not working correctly in IE. RadialGradients are not supported in VML. Contributor assistance welcome :).</b>" )) Composite.__init__(self, layout)
def __init__(self, chart): self.chart = chart self.canvas = chart.canvas self.b2 = Button("Compositing", self) self.b3 = Button("Paths & shapes", self) self.b4 = Button("Arcs & circles", self) self.b1 = Button("Bezier curves", self) self.b6 = Button("Colors", self) self.b7 = Button("Translating", self) self.b8 = Button("Scaling", self) self.b5 = Button("Rotating", self) self.b10 = Button("Transparency", self) self.b11 = Button("Lines", self) self.b9 = Button("Animations", self) hp = HorizontalPanel() vp = VerticalPanel() vp.setHorizontalAlignment(HasAlignment.ALIGN_LEFT) vp.add(Label("MENU")) vp.setSpacing(6) vp.add(self.b2) vp.add(self.b3) vp.add(self.b4) vp.add(self.b1) vp.add(self.b6) vp.add(self.b7) vp.add(self.b8) vp.add(self.b5) vp.add(self.b10) vp.add(self.b11) vp.add(self.b9) hp.add(vp) Composite.__init__(self, hp)
def __init__(self): SimplePanel.__init__(self) self.form = FormPanel() self.form.setEncoding(FormPanel.ENCODING_MULTIPART) self.form.setMethod(FormPanel.METHOD_POST) self.url = "http://localhost/pyjamas_upload_demo" self.form.setAction(self.url) self.form.setTarget("results") vPanel = VerticalPanel() hPanel = HorizontalPanel() hPanel.setSpacing(5) hPanel.add(Label("Upload file:")) self.field = FileUpload() self.field.setName("file") hPanel.add(self.field) hPanel.add(Button("Submit", getattr(self, "onBtnClick"))) vPanel.add(hPanel) self.simple = CheckBox("Simple mode? ") #self.simple.setChecked(True) vPanel.add(self.simple) self.progress = Label('0%') results = NamedFrame("results") vPanel.add(results) vPanel.add(self.progress) self.form.add(vPanel) self.add(self.form)
def onModuleLoad(self): self.panel = VerticalPanel() self.player = self.getPlayer() # Add the Player to the Panel self.panel.add(self.player) RootPanel().add(self.panel)
def __init__(self): SimplePanel.__init__(self) panel = VerticalPanel() panel.setBorderWidth(1) panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) part1 = Label("Part 1") part2 = Label("Part 2") part3 = Label("Part 3") part4 = Label("Part 4") panel.add(part1) panel.add(part2) panel.add(part3) panel.add(part4) panel.setCellHeight(part1, "10%") panel.setCellHeight(part2, "70%") panel.setCellHeight(part3, "10%") panel.setCellHeight(part4, "10%") panel.setCellHorizontalAlignment(part3, HasAlignment.ALIGN_RIGHT) panel.setWidth("50%") panel.setHeight("300px") self.add(panel)
def __init__(self, theorem, **kwargs): DialogWindow.__init__(self, modal=True, close=True) self.theorem = theorem v = VerticalPanel() v.setWidth(300) # v.setHeight(500) self.setText("save") self.setPopupPosition(100, 100) self.setStyleAttribute("background-color", "#ffffff") self.setStyleAttribute("color", "red") self.setStyleAttribute("border-width", "5px") self.setStyleAttribute("border-style", "solid") self.im = Image() self.im.setUrl(latex_to_url(self.theorem.formula.to_latex())) v.add(self.im) h = HorizontalPanel() self.radio = RadioButton("group1", "Existing folder:") h.add(self.radio) self.list = ListBox() self.list.setVisibleItemCount(1) for f in Theorem.get_all_folders(): self.list.addItem(f) h.add(self.list) v.add(h) h = HorizontalPanel() h.add(RadioButton("group1", "New folder:")) self.radio.setChecked(True) self.textbox = TextBox() h.add(self.textbox) v.add(h) v.add(Button("Done", self.done_click)) self.add(v)
def onModuleLoad(self): self.curInfo = '' self.curAlgorithm = None self.description = HTML() self.Algorithm_list = AlgorithmList() self.panel = DockPanel() self.loadAlgorithms() self.AlgorithmContainer = DockPanel() self.AlgorithmContainer.setStyleName("ks-Algorithm") vp = VerticalPanel() vp.setWidth("100%") vp.add(self.description) vp.add(self.AlgorithmContainer) self.description.setStyleName("ks-Info") self.panel.add(self.Algorithm_list, DockPanel.WEST) self.panel.add(vp, DockPanel.CENTER) self.panel.setCellVerticalAlignment(self.Algorithm_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 loadChapters(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") #self.nf = NamedFrame("section") #self.nf.setWidth("100%") #self.nf.setHeight("10000") self.sp = ScrollPanel(self.sinkContainer) #self.sp = VerticalSplitPanel() self.sp.setWidth("100%") self.sp.setHeight("100%") #self.sp.setTopWidget(self.sinkContainer) #self.sp.setBottomWidget(self.nf) #self.sp.setSplitPosition(10000) # deliberately high - max out. vp = VerticalPanel() vp.setWidth("99%") vp.setHeight("100%") vp.add(self.description) vp.add(self.sp) authors = [("2008, 2009", "Kenneth Casson Leighton", "*****@*****.**")] for years, name, email in authors: authors_html = \ '© %s <a href="mailto:%s">%s</a><br />' %\ (years, email, name) authors_panel = HTML() authors_panel.setStyleName("ks-Authors") authors_panel.setHTML(authors_html[:-6]) left_panel = DockPanel(Height="100%") left_panel.add(self.sink_list, DockPanel.NORTH) left_panel.add(authors_panel, DockPanel.SOUTH) self.description.setStyleName("ks-Intro") self.panel.add(left_panel, DockPanel.WEST) self.panel.add(vp, DockPanel.CENTER) self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP) self.panel.setCellWidth(vp, "100%") self.panel.setCellHeight(vp, "100%") Window.addWindowResizeListener(self) History.addHistoryListener(self) RootPanel().add(self.panel) self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
def __init__(self): SimplePanel.__init__(self) panel = VerticalPanel(BorderWidth=1, HorizontalAlignment=HasAlignment.ALIGN_CENTER, VerticalAlignment=HasAlignment.ALIGN_MIDDLE, Width="50%", Height="300px") part1 = Label("Part 1") part2 = Label("Part 2") part3 = Label("Part 3") part4 = Label("Part 4") panel.add(part1) panel.add(part2) panel.add(part3) panel.add(part4) panel.setCellHeight(part1, "10%") panel.setCellHeight(part2, "70%") panel.setCellHeight(part3, "10%") panel.setCellHeight(part4, "10%") panel.setCellHorizontalAlignment(part3, HasAlignment.ALIGN_RIGHT) self.add(panel)
def __init__(self): Composite.__init__(self) self.contacts = [] self.contacts.append(Contact("Benoit Mandelbrot", "*****@*****.**")) self.contacts.append(Contact("Albert Einstein", "*****@*****.**")) self.contacts.append(Contact("Rene Descartes", "*****@*****.**")) self.contacts.append(Contact("Bob Saget", "*****@*****.**")) self.contacts.append( Contact("Ludwig von Beethoven", "*****@*****.**")) self.contacts.append(Contact("Richard Feynman", "*****@*****.**")) self.contacts.append(Contact("Alan Turing", "*****@*****.**")) self.contacts.append(Contact("John von Neumann", "*****@*****.**")) self.panel = VerticalPanel() # Add all the contacts to the list. i = 0 while (i < len(self.contacts)): self.addContact(self.contacts[i]) i = i + 1 self.initWidget(self.panel) self.setStyleName("mail-Contacts")
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) initToken = History.getToken() if len(initToken): self.onHistoryChanged(initToken) else: self.showIntro()
def __init__(self): """ Constructs a new EditPanel. """ self.TEXT_WAITING = "Waiting for response..." self.TEXT_ERROR = "Server Error" # self.remote_py = RegionNamesServicePython() self.panel = VerticalPanel() top_panel = HorizontalPanel() top_panel.setSpacing(8) self.panel.add(top_panel) refresh = Button("Refresh", self) top_panel.add(refresh) self.status = Label() top_panel.add(self.status) edit_panel = HorizontalPanel() self.panel.add(edit_panel) self.tree = Tree() self.tree.addTreeListener(self) edit_panel.add(self.tree) upload_item = TreeItem("Upload") self.tree.add(upload_item) map_item = TreeItem("Map") self.tree.add(map_item)
def __init__(self): SimplePanel.__init__(self) self.form = FormPanel() self.form.setEncoding(FormPanel.ENCODING_MULTIPART) self.form.setMethod(FormPanel.METHOD_POST) self.form.setAction("http://nonexistent.com") self.form.setTarget("results") vPanel = VerticalPanel() hPanel = HorizontalPanel() hPanel.setSpacing(5) hPanel.add(Label("Upload file:")) self.field = FileUpload() self.field.setName("file") hPanel.add(self.field) hPanel.add(Button("Submit", getattr(self, "onBtnClick"))) vPanel.add(hPanel) results = NamedFrame("results") vPanel.add(results) self.form.add(vPanel) self.add(self.form)