def onModuleLoad(self): self.TEXT_WAITING = "Waiting for response..." self.TEXT_ERROR = "Server Error" self.remote = JSONProxy("../api", ["hello"]) self.status = Label() self.text_box = TextBox() self.button_send = Button("Send", self) buttons = HorizontalPanel() buttons.add(self.button_send) buttons.setSpacing(8) info = """<h2>JSON-RPC Example</h2> <p>This example demonstrates the calling of server services with <a href="http://json-rpc.org/">JSON-RPC</a>. </p> <p>Enter your name below.</p>""" panel = VerticalPanel() panel.add(HTML(info)) panel.add(self.text_box) #panel.add(method_panel) panel.add(buttons) panel.add(self.status) RootPanel().add(panel)
def onModuleLoad(self): self.TEXT_WAITING = "Waiting for response..." self.TEXT_ERROR = "Server Error" self.METHOD_ECHO = "Echo" self.METHOD_REVERSE = "Reverse" self.METHOD_UPPERCASE = "UPPERCASE" self.METHOD_LOWERCASE = "lowercase" self.methods = [self.METHOD_ECHO, self.METHOD_REVERSE, self.METHOD_UPPERCASE, self.METHOD_LOWERCASE] self.remote_php = EchoServicePHP() self.remote_py = EchoServicePython() self.status=Label() self.text_area = TextArea() self.text_area.setText("""{'Test'} [\"String\"] \tTest Tab Test Newline\n after newline """ + r"""Literal String: {'Test'} [\"String\"] """) self.text_area.setCharacterWidth(80) self.text_area.setVisibleLines(8) self.method_list = ListBox() self.method_list.setName("hello") self.method_list.setVisibleItemCount(1) for method in self.methods: self.method_list.addItem(method) self.method_list.setSelectedIndex(0) method_panel = HorizontalPanel() method_panel.add(HTML("Remote string method to call: ")) method_panel.add(self.method_list) method_panel.setSpacing(8) self.button_php = Button("Send to PHP Service", self) self.button_py = Button("Send to Python Service", self) buttons = HorizontalPanel() buttons.add(self.button_php) buttons.add(self.button_py) buttons.setSpacing(8) info = """<h2>JSON-RPC Example</h2> <p>This example demonstrates the calling of server services with <a href="http://json-rpc.org/">JSON-RPC</a>. </p> <p>Enter some text below, and press a button to send the text to an Echo service on your server. An echo service simply sends the exact same text back that it receives. </p>""" panel = VerticalPanel() panel.add(HTML(info)) panel.add(self.text_area) panel.add(method_panel) panel.add(buttons) panel.add(self.status) RootPanel().add(panel)
def onModuleLoad(self): try: setCookie(COOKIE_NAME, "setme", 100000) except: pass self.status = Label() self.text_area = TextArea() self.text_area.setText(r"Me eat cookie!") self.text_area.setCharacterWidth(80) self.text_area.setVisibleLines(8) self.button_py_set = Button("Set Cookie", self) self.button_py_read = Button("Read Cookie ", self) buttons = HorizontalPanel() buttons.add(self.button_py_set) buttons.add(self.button_py_read) buttons.setSpacing(8) info = r"This demonstrates setting and reading information using cookies." panel = VerticalPanel() panel.add(HTML(info)) panel.add(self.text_area) panel.add(buttons) panel.add(self.status) RootPanel().add(panel)
class ControlPanel(Composite): def __init__(self): Composite.__init__(self) self.buttons = HorizontalPanel() self.buttons.setSpacing("10px") self.refresh_button = ControlButton("images/refresh.png", "images/refresh_down.png", "reload", "reload" ) self.refresh_button.addMouseListener(ReloadButtonListner()) self.refresh_button.base = self self.start_button = ControlButton("images/start.png" , "images/pause.png" , " start" , " pause" ) self.start_button.addMouseListener(StartButtonListner()) self.start_button.base = self self.buttons.add(self.refresh_button) self.buttons.add(self.start_button) self.initWidget(self.buttons)
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)
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 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 onCellClicked(self, sender, row, col): if self.drill == 0: self.drill += 1 self.vp.clear() self.grid.clear() self.vp.add(self.up) self.vp.add(self.grid) gridcols = self.grid.getColumnCount() album = self.albums[row + col + (row * (gridcols - 1))] url = "http://picasaweb.google.com/data/feed/base/user/" + self.userid + "/albumid/" + album[ "id"] + "?alt=json-in-script&kind=photo&hl=en_US&callback=restCb" self.doRESTQuery(url, self.timer) elif self.drill == 1: self.drill += 1 gridcols = self.grid.getColumnCount() self.pos = row + col + (row * (gridcols - 1)) photo = self.photos[self.pos] self.vp.clear() self.fullsize = HTML('<img src="' + photo["full"] + '"/>') hp = HorizontalPanel() hp.add(self.up) hp.add(self.prev) hp.add(self.next) hp.setSpacing(8) self.vp.add(hp) self.vp.add(self.fullsize)
def __init__(self): Composite.__init__(self) self.signOutLink = HTML("<a href='javascript:;'>Sign Out</a>") self.aboutLink = HTML("<a href='javascript:;'>About</a>") outer = HorizontalPanel() inner = VerticalPanel() outer.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) inner.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) links = HorizontalPanel() links.setSpacing(4) links.add(self.signOutLink) links.add(self.aboutLink) outer.add(inner) inner.add(HTML("<b>Welcome back, [email protected]</b>")) inner.add(links) self.signOutLink.addClickListener(self) self.aboutLink.addClickListener(self) self.initWidget(outer) inner.setStyleName("mail-TopPanel") links.setStyleName("mail-TopPanelLinks")
def onModuleLoad(self): try: setCookie(COOKIE_NAME, "setme", 100000) except: pass self.status = Label() self.text_area = TextArea() self.text_area.setText(r"Me eat cookie!") self.text_area.setCharacterWidth(80) self.text_area.setVisibleLines(8) self.button_py_set = Button("Set Cookie", self) self.button_py_read = Button("Read Cookie ", self) buttons = HorizontalPanel() buttons.add(self.button_py_set) buttons.add(self.button_py_read) buttons.setSpacing(8) info = r'This demonstrates setting and reading information using cookies.' panel = VerticalPanel() panel.add(HTML(info)) panel.add(self.text_area) panel.add(buttons) panel.add(self.status) RootPanel().add(panel)
def onCellClicked(self, sender, row, col): if self.drill==0: self.drill += 1 self.vp.clear() self.grid.clear() self.vp.add(self.up) self.vp.add(self.grid) gridcols = self.grid.getColumnCount() album = self.albums[row+col+(row*(gridcols-1))] url = "http://picasaweb.google.com/data/feed/base/user/" + self.userid + "/albumid/" + album["id"] + "?alt=json-in-script&kind=photo&hl=en_US&callback=restCb" self.doRESTQuery(url, self.timer) elif self.drill==1: self.drill += 1 gridcols = self.grid.getColumnCount() self.pos =row+col+(row*(gridcols-1)) photo = self.photos[self.pos] self.vp.clear() self.fullsize = HTML('<img src="' + photo["full"] + '"/>') hp = HorizontalPanel() hp.add(self.up) hp.add(self.prev) hp.add(self.next) hp.setSpacing(8) self.vp.add(hp) self.vp.add(self.fullsize)
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 __init__(self, app): DialogBox.__init__(self) self.app = app self.table=FlexTable() self.table.setText(0, 0, "Please enter username and password") self.table.getFlexCellFormatter().setColSpan(0, 0, 2) self.table.setText(1, 0, "Username") self.handle = TextBox() h = getCookie('handle') self.handle.setText(h) self.table.setWidget(1, 1, self.handle) self.table.setText(2, 0, "Password") self.pwd = PasswordTextBox() self.table.setWidget(2, 1, self.pwd) self.table.setHTML(3,0,"") self.table.getFlexCellFormatter().setColSpan(3, 0, 2) h = HorizontalPanel() self.table.setWidget(4,0, h) self.table.getFlexCellFormatter().setColSpan(4, 0, 2) h.add(Button("Ok", getattr(self, "onOk"))) h.add(Button("Cancel", getattr(self, "onClose"))) h.setSpacing(4) self.setHTML("<b>Login</b>") self.setWidget(self.table) left = (Window.getClientWidth() - 200) / 2 top = (Window.getClientHeight() - 100) / 2 self.setPopupPosition(left,top)
def __init__(self): self.form = FormPanel() self.form.setAction("/Accession/searchByName/") # Because we're going to add a FileUpload widget, we'll need to set the # form to use the POST method, and multipart MIME encoding. self.form.setEncoding(FormPanel.ENCODING_MULTIPART) self.form.setMethod(FormPanel.METHOD_POST) # Create a panel to hold all of the form widgets. vpanel = VerticalPanel() self.form.setWidget(vpanel) self.colour_input = AutoCompleteByURLTextBox('/Accession/autoComplete') hpanel = HorizontalPanel() hpanel.add(HTML("Enter an ecotype name: ")) hpanel.add(self.colour_input) hpanel.setSpacing(8) # Add a 'submit' button. hpanel.add(Button("Submit", self)) vpanel.add(hpanel) # Add an event handler to the form. self.form.addFormHandler(self) self.setWidget(self.form)
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 __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, text, imageUrl): DecoratorPanel.__init__(self, DecoratorPanel.DECORATE_ALL) p = HorizontalPanel() p.setSpacing(3) self.img = Image(imageUrl) self.txt = HTML(text) p.add(self.img) p.add(self.txt) self.add(p)
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)
def onModuleLoad(self): p = HorizontalPanel() p.setSpacing(10) sc = SliderClass(False) p.add(sc) sc = SliderClass(True) p.add(sc) sc = SliderClass(True) p.add(sc) RootPanel().add(p)
def __init__(self, **kwargs): VerticalPanel.__init__(self, **kwargs) info = """<h2>JSON-RPC Example</h2> #<p>This example demonstrates the calling of server services with # <a href="http://json-rpc.org/">JSON-RPC</a>. #</p> #<p>Choose a service below, and press a the "call service" button to initiate it. An echo service simply sends the exact same text back that it receives. # </p>""" self.status = Label() self.dockey = TextBox(Text="12") self.TEXT_WAITING = "Waiting for response..." self.METHOD_ECHO = "Echo" self.METHOD_DOCTYPES = "get doc types" self.METHOD_UPPERCASE = "get schema" self.METHOD_GETINBOX = "get inbox" self.METHOD_GETDOCS = "get documents" self.methods = [ self.METHOD_ECHO, self.METHOD_DOCTYPES, self.METHOD_UPPERCASE, self.METHOD_GETINBOX, self.METHOD_GETDOCS ] self.method_list = ListBox() self.method_list.setName("hello") self.method_list.setVisibleItemCount(1) for method in self.methods: self.method_list.addItem(method) self.method_list.setSelectedIndex(0) method_panel = HorizontalPanel() method_panel.add(HTML("Remote string method to call: ")) method_panel.add(self.method_list) method_panel.setSpacing(8) self.button_action = Button("Call Service", self) buttons = HorizontalPanel() buttons.add(self.button_action) buttons.setSpacing(8) panel = VerticalPanel() panel.add(HTML(info)) panel.add(HTML("Primary key of the patient in the database:")) panel.add(self.dockey) panel.add(method_panel) panel.add(buttons) panel.add(self.status) self.add(panel)
def __init__(self, format='%d-%m-%Y'): DateSelectedHandler.__init__(self) if self.img_base is None: self.img_base = pygwt.getImageBaseURL(True) if self.icon_img is None: self.icon_img = self.img_base + 'icon_calendar.gif' self.format = format self.tbox = TextBox() self.tbox.setVisibleLength(10) # assume valid sep is - / . or nothing if format.find('-') >= 0: self.sep = '-' elif format.find('/') >= 0: self.sep = '/' elif format.find('.') >= 0: self.sep = '.' else: self.sep = '' # self.sep = format[2] # is this too presumptious? self.calendar = Calendar() self.img = Image(self.icon_img) self.img.addStyleName(self.icon_style) self.calendarLink = HyperlinkImage(self.img) self.todayLink = Hyperlink(self.today_text) self.todayLink.addStyleName(self.today_style) # # lay it out # hp = HorizontalPanel() hp.setSpacing(2) vp = VerticalPanel() hp.add(self.tbox) vp.add(self.calendarLink) vp.add(self.todayLink) #vp.add(self.calendar) hp.add(vp) Composite.__init__(self) self.initWidget(hp) # # done with layout, so now set up some listeners # self.tbox.addFocusListener(self) # hook to onLostFocus self.calendar.addSelectedDateListener(getattr(self, "onDateSelected")) self.todayLink.addClickListener(getattr(self, "onTodayClicked")) self.calendarLink.addClickListener(getattr(self, "onShowCalendar")) self.tbox.addChangeListener(getattr(self, "onFieldChanged")) self.tbox.addInputListener(getattr(self, "onFieldChanged")) self._last_date = None
class Toggle: def onModuleLoad(self): self.label = Label("Not set yet") self.button = Button("Probe button", self) self.image_up = Image("./images/logo.png") self.image_up3 = Image("./images/logo.png") self.image_down = Image("./images/logo.png") self.image_down3 = Image("./images/logo.png") self.toggle = ToggleButton(self.image_up, self.image_down, self) self.toggle2 = ToggleButton("up", "down", getattr(self, "onToggleUD")) self.push = PushButton(self.image_up3, self.image_down3) self.vpanel = VerticalPanel() self.togglePanel = HorizontalPanel() self.togglePanel.setSpacing(10) self.togglePanel.add(self.toggle) self.togglePanel.add(self.toggle2) self.togglePanel.add(self.push) self.vpanel.add(self.label) self.vpanel.add(self.button) self.vpanel.add(self.togglePanel) RootPanel().add(self.vpanel) self.i = False def onToggleUD(self, sender): self.label.setText(" Toggle2 isdown: "+str(self.toggle2.isDown())) def onClick(self, sender): if sender == self.button: if self.i: self.i = False text = ">>>>UP<<<<" self.toggle.setCurrentFace(self.toggle.getUpFace()) else: self.i = True text = ">>>DOWN<<<" self.toggle.setCurrentFace(self.toggle.getDownFace()) #self.label.setText("self.toggle.style_name: "+ # self.toggle.style_name+", self.toggle.getStyleName():"+ # self.toggle.getStyleName()+" ") self.label.setText(text) elif sender == self.toggle: text = ">>>DOWN<<<" if self.i: text = ">>>>UP<<<<" self.i = not self.i self.label.setText(text+" isdown: "+str(self.toggle.isDown()))
class Toggle: def onModuleLoad(self): self.label = Label("Not set yet") self.button = Button("Probe button", self) self.image_up = Image("./images/logo.png") self.image_up3 = Image("./images/logo.png") self.image_down = Image("./images/logo.png") self.image_down3 = Image("./images/logo.png") self.toggle = ToggleButton(self.image_up, self.image_down, self) self.toggle2 = ToggleButton("up", "down", getattr(self, "onToggleUD")) self.push = PushButton(self.image_up3, self.image_down3) self.vpanel = VerticalPanel() self.togglePanel = HorizontalPanel() self.togglePanel.setSpacing(10) self.togglePanel.add(self.toggle) self.togglePanel.add(self.toggle2) self.togglePanel.add(self.push) self.vpanel.add(self.label) self.vpanel.add(self.button) self.vpanel.add(self.togglePanel) RootPanel().add(self.vpanel) self.i = False def onToggleUD(self, sender): self.label.setText(" Toggle2 isdown: " + str(self.toggle2.isDown())) def onClick(self, sender): if sender == self.button: if self.i: self.i = False text = ">>>>UP<<<<" self.toggle.setCurrentFace(self.toggle.getUpFace()) else: self.i = True text = ">>>DOWN<<<" self.toggle.setCurrentFace(self.toggle.getDownFace()) #self.label.setText("self.toggle.style_name: "+ # self.toggle.style_name+", self.toggle.getStyleName():"+ # self.toggle.getStyleName()+" ") self.label.setText(text) elif sender == self.toggle: text = ">>>DOWN<<<" if self.i: text = ">>>>UP<<<<" self.i = not self.i self.label.setText(text + " isdown: " + str(self.toggle.isDown()))
def __init__(self, **kwargs): VerticalPanel.__init__(self, **kwargs) info = """<h2>JSON-RPC Example</h2> #<p>This example demonstrates the calling of server services with # <a href="http://json-rpc.org/">JSON-RPC</a>. #</p> #<p>Choose a service below, and press a the "call service" button to initiate it. An echo service simply sends the exact same text back that it receives. # </p>""" self.status=Label() self.dockey = TextBox(Text="12") self.TEXT_WAITING = "Waiting for response..." self.METHOD_ECHO = "Echo" self.METHOD_DOCTYPES = "get doc types" self.METHOD_UPPERCASE = "get schema" self.METHOD_GETINBOX = "get inbox" self.METHOD_GETDOCS = "get documents" self.methods = [self.METHOD_ECHO, self.METHOD_DOCTYPES, self.METHOD_UPPERCASE, self.METHOD_GETINBOX, self.METHOD_GETDOCS] self.method_list = ListBox() self.method_list.setName("hello") self.method_list.setVisibleItemCount(1) for method in self.methods: self.method_list.addItem(method) self.method_list.setSelectedIndex(0) method_panel = HorizontalPanel() method_panel.add(HTML("Remote string method to call: ")) method_panel.add(self.method_list) method_panel.setSpacing(8) self.button_action = Button("Call Service", self) buttons = HorizontalPanel() buttons.add(self.button_action) buttons.setSpacing(8) panel = VerticalPanel() panel.add(HTML(info)) panel.add(HTML("Primary key of the patient in the database:")) panel.add(self.dockey) panel.add(method_panel) panel.add(buttons) panel.add(self.status) self.add(panel)
def make_footer(self): self.time = {} self.time['hour'] = ListBox() self.time['hour'].setVisibleItemCount(1) for hour in range(24): self.time['hour'].addItem('%02d' % hour) self.time['hour'].setSelectedIndex(12) self.time['minute'] = ListBox() self.time['minute'].setVisibleItemCount(1) for minute in range(0, 60, 5): self.time['minute'].addItem('%02d' % minute) self.time['minute'].setSelectedIndex(0) time_panel = HorizontalPanel() time_panel.setVerticalAlignment('center') time_panel.add(self.time['hour']) time_panel.add(Label(':')) time_panel.add(self.time['minute']) self.table.setWidget(1, 0, time_panel) weekdays_panel = HorizontalPanel() weekdays_panel.setSpacing(5) self.weekdays = {} for i in range(7): self.weekdays[i] = CheckBox(AlarmWidget.weekday_name[i]) self.weekdays[i].setChecked(i < 6) weekdays_panel.add(self.weekdays[i]) self.table.setWidget(1, 1, weekdays_panel) self.duration = ListBox() self.duration.setVisibleItemCount(1) choices = [ 1, 2, 3, 4, 5, 7, 10, 15, 20, 25, 30, 40, 50, 60 ] for seconds in choices: self.duration.addItem( '%ds' % seconds if seconds < 60 else '%dm' % (seconds / 60), seconds) self.duration.setSelectedIndex(2) self.table.setWidget(1, 2, self.duration) image = Image('icons/plus.png') image.setTitle('add'); image.addClickListener(self.plus_clicked) self.table.setWidget(1, 3, image) for col in range(4): self.table.getCellFormatter().setStyleName(1, col, 'tablecell noborder')
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)
def createTextThing(self, textBox): p = HorizontalPanel() p.setSpacing(4) p.add(textBox) echo = HTML() select_all = Button("select all") p.add(select_all) p.add(echo) listener=TextBoxListener(self, textBox, echo, select_all) select_all.addClickListener(listener) textBox.addKeyboardListener(listener) textBox.addClickListener(listener) return p
def createTextThing(self, textBox): p = HorizontalPanel() p.setSpacing(4) p.add(textBox) echo = HTML() select_all = Button("select all") p.add(select_all) p.add(echo) listener = TextBoxListener(self, textBox, echo, select_all) select_all.addClickListener(listener) textBox.addKeyboardListener(listener) textBox.addClickListener(listener) return p
def onModuleLoad(self): self.status = Label() self.button = Button( "Display list of all published memories and fields", self) self.buttonupdate = Button("Update data from AMS publisher", self) buttons = HorizontalPanel() buttons.add(self.button) buttons.add(self.buttonupdate) buttons.setSpacing(8) info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>""" self.panel = VerticalPanel() self.panel.add(HTML(info)) self.panel.add(buttons) self.panel.add(self.status) RootPanel().add(self.panel) self.commobj = AMS_Comm() self.tree = None if AMSJavascript.sent > AMSJavascript.recv: self.status.setText('Press button again: AMSJavascript.sent ' + str(AMSJavascript.sent) + ' AMSJavascript.recv ' + str(AMSJavascript.recv)) return if self.commobj.commname == 'No AMS publisher running': self.status.setText(self.commobj.commname) else: self.status.setText('Memories for AMS Comm: ' + str(AMSJavascript.sent) + str(AMSJavascript.recv) + self.commobj.commname) result = self.commobj.get_memory_list() if self.tree: self.panel.remove(self.tree) self.tree = Tree() for i in result: subtree = TreeItem(i) memory = self.commobj.memory_attach(i) fields = memory.get_field_list() for j in fields: field = memory.get_field_info(j) subtree.addItem(j + ' = ' + str(field[4])) self.tree.addItem(subtree) self.panel.add(self.tree)
def onModuleLoad(self): p = HorizontalPanel() p.setSpacing(10) p.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM) sc = SliderClass(False) p.add(sc) sc = SliderClass(True) p.add(sc) sc = SliderClass(True) p.add(sc) sc = HorizontalSliderClass(False) p.add(sc) sc = HorizontalSliderClass(True) p.add(sc) RootPanel().add(p)
def onModuleLoad(self): self.status=Label() self.button = Button("Display list of all published memories and fields", self) self.buttonupdate = Button("Update data from AMS publisher", self) buttons = HorizontalPanel() buttons.add(self.button) buttons.add(self.buttonupdate) buttons.setSpacing(8) info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>""" self.panel = VerticalPanel() self.panel.add(HTML(info)) self.panel.add(buttons) self.panel.add(self.status) RootPanel().add(self.panel) self.commobj = AMS_Comm() self.tree = None
def onModuleLoad(self): global statusbar statusbar = Label() self.button = Button("Display Current Stack Frames", self) self.buttonupdate = Button("Update data from AMS publisher", self) buttons = HorizontalPanel() buttons.add(self.button) buttons.add(self.buttonupdate) buttons.setSpacing(8) info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>""" self.panel = VerticalPanel() self.panel.add(HTML(info)) self.panel.add(buttons) self.panel.add(statusbar) RootPanel().add(self.panel) self.commobj = AMS.AMS_Comm() self.textarea = None
def __init__(self, contact): # The popup's constructor's argument is a boolean specifying that it # auto-close itself when the user clicks outside of it. PopupPanel.__init__(self, True) inner = VerticalPanel() nameLabel = Label(contact.name) emailLabel = Label(contact.email) inner.add(nameLabel) inner.add(emailLabel) panel = HorizontalPanel() panel.setSpacing(4) panel.add(Image(contact.photo)) panel.add(inner) self.add(panel) self.setStyleName("mail-ContactPopup") nameLabel.setStyleName("mail-ContactPopupName") emailLabel.setStyleName("mail-ContactPopupEmail")
def __init__(self, mailObject): Composite.__init__(self) self.countLabel = HTML() self.newerButton = HTML("<a href='javascript:;'>< newer</a>", True) self.olderButton = HTML("<a href='javascript:;'>older ></a>", True) self.startIndex = 0 self.selectedRow = -1 self.table = FlexTable() self.navBar = HorizontalPanel() self.mailObject = mailObject # Setup the table. self.table.setCellSpacing(0) self.table.setCellPadding(2) self.table.setWidth("100%") # Hook up events. self.table.addTableListener(self) self.newerButton.addClickListener(self) self.olderButton.addClickListener(self) # Create the 'navigation' bar at the upper-right. innerNavBar = HorizontalPanel() innerNavBar.setSpacing(8) innerNavBar.add(self.newerButton) innerNavBar.add(self.countLabel) innerNavBar.add(self.olderButton) self.navBar.setStyleName("mail-ListNavBar") self.navBar.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) self.navBar.add(innerNavBar) self.navBar.setWidth("100%") self.initWidget(self.table) self.setStyleName("mail-List") self.initTable() self.update()
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)
def onModuleLoad(self): v = VerticalPanel(Spacing=10) p = HorizontalPanel(Spacing=10, VerticalAlignment=HasAlignment.ALIGN_BOTTOM) sc = SliderClass(False) p.add(CaptionPanel("clickable only", sc)) sc = SliderClass(True) p.add(CaptionPanel("draggable", sc)) sc = SliderClass(True) p.add(CaptionPanel("draggable", sc)) v.add(CaptionPanel("Vertical Sliders with inputboxes", p)) p = HorizontalPanel() p.setSpacing(10) p.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM) sc = HSliderClass(False) p.add(CaptionPanel("clickable only", sc)) sc = HSliderClass(True) p.add(CaptionPanel("draggable", sc)) v.add(CaptionPanel("Horizontal Sliders with inputboxes", p)) p = HorizontalPanel() p.setSpacing(10) p.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM) sc = ASliderClass(False) p.add(CaptionPanel("clickable only", sc)) sc = ASliderClass(True) p.add(CaptionPanel("draggable", sc)) v.add(CaptionPanel("2D Controls: Inputboxes are draggable as well", p)) RootPanel().add(v)
def onModuleLoad(self): self.status=Label() self.button = Button("Display list of all published memories and fields", self) self.buttonupdate = Button("Update data from AMS publisher", self) buttons = HorizontalPanel() buttons.add(self.button) buttons.add(self.buttonupdate) buttons.setSpacing(8) info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>""" self.panel = VerticalPanel() self.panel.add(HTML(info)) self.panel.add(buttons) self.panel.add(self.status) RootPanel().add(self.panel) self.commobj = AMS_Comm() self.tree = None if AMSJavascript.sent > AMSJavascript.recv: self.status.setText('Press button again: AMSJavascript.sent '+str(AMSJavascript.sent)+' AMSJavascript.recv '+str(AMSJavascript.recv)) return if self.commobj.commname == 'No AMS publisher running': self.status.setText(self.commobj.commname) else: self.status.setText('Memories for AMS Comm: '+str(AMSJavascript.sent)+str(AMSJavascript.recv)+self.commobj.commname) result = self.commobj.get_memory_list() if self.tree: self.panel.remove(self.tree) self.tree = Tree() for i in result: subtree = TreeItem(i) memory = self.commobj.memory_attach(i) fields = memory.get_field_list() for j in fields: field = memory.get_field_info(j) subtree.addItem(j+' = '+str(field[4])) self.tree.addItem(subtree) self.panel.add(self.tree)
def __init__(self, **kwargs): element = None if kwargs.has_key('Element'): element = kwargs.pop('Element') panel = VerticalPanel(Element=element) Composite.__init__(self, panel, **kwargs) self.TEXT_WAITING = "Please wait..." self.TEXT_ERROR = "Server Error" self.remote_py = EchoServicePython() self.status = Label() self.subject = TextBox() self.subject.setVisibleLength(60) self.sender = TextBox() self.sender.setVisibleLength(40) self.message = TextArea() self.message.setCharacterWidth(60) self.message.setVisibleLines(15) self.button_py = Button("Send", self) buttons = HorizontalPanel() buttons.add(self.button_py) buttons.setSpacing(8) panel.add(HTML("Subject:")) panel.add(self.subject) panel.add(HTML("From:")) panel.add(self.sender) panel.add( HTML("Your Message - please keep it to under 1,000 characters")) panel.add(self.message) panel.add(buttons) panel.add(self.status)
def __init__(self): SimplePanel.__init__(self) hPanel = HorizontalPanel() hPanel.setSpacing(10) self.list1 = ListBox() self.list1.setVisibleItemCount(10) self.list1.addItem("Item 1") self.list1.addItem("Item 2") self.list1.addItem("Item 3") self.list1.addChangeListener(getattr(self, "onList1ItemSelected")) self.list2 = ListBox() self.list2.setVisibleItemCount(1) self.list2.addItem("Item A") self.list2.addItem("Item B") self.list2.addItem("Item C") self.list2.addChangeListener(getattr(self, "onList2ItemSelected")) hPanel.add(self.list1) hPanel.add(self.list2) self.add(hPanel)
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)
class Trees(Sink): 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) def onTreeItemSelected(self, item): var=None for vwb in self.vars_with_proto: if vwb['proto'] == item.userObject: var=vwb['var'] def after(formula): self.cnf=self.cnf.substitute(Formula([var]),formula) self.image2.setUrl(latex_to_url(self.cnf.to_latex())) dlg = FormulaBuilder([op for op in operations if op.available and op.type==Operation.EXPRESSION],after,type='expr') dlg.show() def onTreeItemStateChanged(self, item): child = item.getChild(0) if hasattr(child, "isPendingItem"): item.removeItem(child) proto = item.getUserObject() for i in range(len(proto.children)): self.createItem(proto.children[i]) index = self.getSortIndex(item, proto.children[i].text) # demonstrate insertItem. addItem is easy. item.insertItem(proto.children[i].item, index) def getSortIndex(self, parent, text): nodes = parent.getChildCount() node = 0 text = text.lower() while node < nodes: item = parent.getChild(node) if cmp(text, item.getText().lower()) < 0: break; else: node += 1 return node def createItem(self, proto): proto.item = TreeItem(proto.text) proto.item.setUserObject(proto) if len(proto.children) > 0: proto.item.addItem(PendingItem())
nameLabel = Label('') currentValueLabel = Label('') newValueLabel = Label('') resetButton = Button('Reset', doReset) stepButton = Button('Step', doStep) datapathCanvas = DatapathCanvas(nameLabel, currentValueLabel, newValueLabel) datapathCanvas.addNode(n1) datapathCanvas.addNode(n2) datapathCanvas.addNode(n3) datapathCanvas.addEdge(addr) datapathCanvas.addEdge(ins) controlPanel.setSpacing(20) controlPanel.add(resetButton) controlPanel.add(stepButton) controlPanel.add(nameLabel) controlPanel.add(currentValueLabel) controlPanel.add(newValueLabel) mainPanel.add(datapathCanvas) mainPanel.add(controlPanel) mainPanel.add(debugLabel) RootPanel().add(mainPanel) doReset()
class InfoDirectory: def onModuleLoad(self): self.remote = InfoServicePython() self.tree_width = 200 self.tp = HorizontalPanel() self.tp.setWidth("%dpx" % (self.tree_width)) self.treeview = Trees() self.treeview.fTree.addTreeListener(self) self.sp = ScrollPanel() self.tp.add(self.treeview) self.sp.add(self.tp) self.sp.setHeight("100%") self.horzpanel1 = HorizontalPanel() self.horzpanel1.setSize("100%", "100%") self.horzpanel1.setBorderWidth(1) self.horzpanel1.setSpacing("10px") self.rp = RightPanel() self.rps = ScrollPanel() self.rps.add(self.rp) self.rps.setWidth("100%") self.rp.setWidth("100%") self.cp1 = CollapserPanel(self) self.cp1.setWidget(self.sp) self.cp1.setHTML(" ") self.midpanel = MidPanel(self) self.cp2 = CollapserPanel(self) self.cp2.setWidget(self.midpanel) self.cp2.setHTML(" ") self.horzpanel1.add(self.cp1) self.horzpanel1.add(self.cp2) self.horzpanel1.add(self.rps) self.cp1.setInitialWidth("%dpx" % self.tree_width) self.cp2.setInitialWidth("200px") RootPanel().add(self.horzpanel1) width = Window.getClientWidth() height = Window.getClientHeight() self.onWindowResized(width, height) Window.addWindowResizeListener(self) def setCollapserWidth(self, widget, width): self.horzpanel1.setCellWidth(widget, width) def onWindowResized(self, width, height): #self.hp.setWidth("%dpx" % (width - self.tree_width)) #self.hp.setHeight("%dpx" % (height - 20)) self.cp1.setHeight("%dpx" % (height - 30)) self.cp2.setHeight("%dpx" % (height - 30)) self.rps.setHeight("%dpx" % (height - 30)) self.horzpanel1.setHeight("%dpx" % (height - 20)) def onTreeItemStateChanged(self, item): if item.isSelected(): self.onTreeItemSelected(item) def onTreeItemSelected(self, item): obj = item.getUserObject() if len(obj.children) != 0: self.clear_mid_panel() return self.remote.get_midpanel_data(obj.root + "/" + obj.text, self) self.cp2.setHTML(obj.text) self.clear_right_panel() def clear_right_panel(self): self.horzpanel1.remove(2) self.horzpanel1.insert(HTML(""), 2) self.rp.setTitle(" ") def clear_mid_panel(self): self.clear_right_panel() #self.horzpanel2.setLeftWidget(HTML("")) def set_mid_panel(self, response): self.midpanel.set_items(response) self.cp2.setWidget(self.midpanel) def select_right_grid(self, location, name): self.horzpanel1.remove(2) self.horzpanel1.insert(self.rps, 2) self.rp.setTitle(name) self.remote.get_rightpanel_datanames(location, self) def get_rightpanel_datasets(self, datasets): self.rp.clear_items() self.rp.setup_panels(datasets) for i in range(len(datasets)): item = datasets[i] fname = item[0] self.remote.get_rightpanel_data(fname, fname, i, self) def fill_right_grid(self, data): index = data.get('index') name = data.get('name') if data.has_key('items'): self.rp.add_items(data.get('items'), name, index) elif data.has_key('html'): self.rp.add_html(data.get('html'), name, index) def onRemoteResponse(self, response, request_info): method = request_info.method if method == "get_midpanel_data": self.set_mid_panel(response) elif method == "get_rightpanel_datanames": self.get_rightpanel_datasets(response) elif method == "get_rightpanel_data": self.fill_right_grid(response) def onRemoteError(self, code, message, request_info): RootPanel().add(HTML("Server Error or Invalid Response: ERROR " + code)) RootPanel().add(HTML(message))
def onModuleLoad(self): self.TEXT_WAITING = "Waiting for response..." self.TEXT_ERROR = "Server Error" self.METHOD_ECHO = "Echo" self.METHOD_REVERSE = "Reverse" self.METHOD_UPPERCASE = "UPPERCASE" self.METHOD_LOWERCASE = "lowercase" self.METHOD_NONEXISTANT = "Non existant" self.methods = [ self.METHOD_ECHO, self.METHOD_REVERSE, self.METHOD_UPPERCASE, self.METHOD_LOWERCASE, self.METHOD_NONEXISTANT ] self.remote_php = EchoServicePHP() self.remote_py = EchoServicePython() self.status = Label() self.text_area = TextArea() self.text_area.setText("""{'Test'} [\"String\"] \tTest Tab Test Newline\n after newline """ + r"""Literal String: {'Test'} [\"String\"] """) self.text_area.setCharacterWidth(80) self.text_area.setVisibleLines(8) self.method_list = ListBox() self.method_list.setName("hello") self.method_list.setVisibleItemCount(1) for method in self.methods: self.method_list.addItem(method) self.method_list.setSelectedIndex(0) method_panel = HorizontalPanel() method_panel.add(HTML("Remote string method to call: ")) method_panel.add(self.method_list) method_panel.setSpacing(8) self.button_php = Button("Send to PHP Service", self) self.button_py = Button("Send to Python Service", self) buttons = HorizontalPanel() buttons.add(self.button_php) buttons.add(self.button_py) buttons.setSpacing(8) info = """<h2>JSON-RPC Example</h2> <p>This example demonstrates the calling of server services with <a href="http://json-rpc.org/">JSON-RPC</a>. </p> <p>Enter some text below, and press a button to send the text to an Echo service on your server. An echo service simply sends the exact same text back that it receives. </p>""" panel = VerticalPanel() panel.add(HTML(info)) panel.add(self.text_area) panel.add(method_panel) panel.add(buttons) panel.add(self.status) RootPanel().add(panel)
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(0) self.vp.setPadding(0) self.vp.addStyleName("calendarbox calendar-module calendar") self.setWidget(self.vp) self.setVisible(False) # mth = int(month) yr = int(year) tp = HorizontalPanel(Width="100%") tp.addStyleName("calendar-top-panel") tp.setSpacing(0) tp.setPadding(0) self.h1 = None self.h2 = None self.h4 = None self.h5 = None if self.backyear: self.h1 = self.bkls(self.backyear, StyleName="calendar-arrows") self.h1.addClickListener(getattr(self, 'onPreviousYear')) tp.add(self.h1) tp.setCellHorizontalAlignment(self.h1, "left") if self.backmonth: self.h2 = self.bkls(self.backmonth, StyleName="calendar-arrows") self.h2.addClickListener(getattr(self, 'onPreviousMonth')) tp.add(self.h2) tp.setCellHorizontalAlignment(self.h2, "left") # 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.setCellHorizontalAlignment(self.titlePanel, "center") tp.setCellWidth(self.titlePanel, "100%") if self.fwdmonth: self.h4 = self.bkls(self.fwdmonth, StyleName="calendar-arrows") self.h4.addClickListener(getattr(self, 'onNextMonth')) tp.add(self.h4) tp.setCellHorizontalAlignment(self.h4, "right") tp.setCellWidth(self.h4, "100%") self.h4.setWidth("100%") if self.fwdyear: self.h5 = self.bkls(self.fwdyear, StyleName="calendar-arrows") self.h5.addClickListener(getattr(self, 'onNextYear')) tp.add(self.h5) tp.setCellHorizontalAlignment(self.h5, "right") tvp = VerticalPanel(Width="100%") tvp.setSpacing(2) 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 if self.addbuttons: # # some links & handlers # bh1 = Hyperlink(self.yesterday) bh1.addClickListener(getattr(self, 'onYesterday')) bh2 = Hyperlink(self.today) bh2.addClickListener(getattr(self, 'onToday')) bh3 = Hyperlink(self.tomorrow) bh3.addClickListener(getattr(self, 'onTomorrow')) bh4 = Hyperlink(self.cancel) bh4.addClickListener(getattr(self, 'onCancel')) # # add code to test another way of doing the layout # b = HorizontalPanel() b.add(bh1) b.add(bh2) b.add(bh3) b.addStyleName("calendar-shortcuts") self.vp.add(b) b2 = SimplePanel() b2.add(bh4) b2.addStyleName("calendar-cancel") self.vp.add(b2) self.checkLinks(mth, yr) self.setVisible(True)