def createModeController(self): """ Creates and configures widget for booth mode controller. """ photo = Image('resources/icons/photo.png') video = Image('resources/icons/video.png') self.mode.add(photo) self.mode.add(self.modeLabel) self.mode.add(video) photo.onClick = lambda: self.setMode(PHOTO_MODE) video.onClick = lambda: self.setMode(VIDEO_MODE)
def __init__(self): inner = Grid(10, 5) outer = FlexTable() 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, "" + i + "," + j) inner.setWidth("100%") outer.setWidth("100%") inner.setBorderWidth(1) outer.setBorderWidth(1) self.setWidget(outer)
def __init__(self): DialogBox.__init__(self) # Use this opportunity to set the dialog's caption. self.setText("About the Mail Sample") # Create a DockPanel to contain the 'about' label and the 'OK' button. outer = DockPanel() outer.setSpacing(4) outer.add(Image(AboutDialog.LOGO_IMAGE), DockPanel.WEST) # Create the 'OK' button, along with a listener that hides the dialog # when the button is clicked. Adding it to the 'south' position within # the dock causes it to be placed at the bottom. buttonPanel = HorizontalPanel() buttonPanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) buttonPanel.add(Button("Close", self)) outer.add(buttonPanel, DockPanel.SOUTH) # Create the 'about' label. Placing it in the 'rest' position within the # dock causes it to take up any remaining space after the 'OK' button # has been laid out. textplain = "This sample application demonstrates the construction " textplain += "of a complex user interface using pyjamas' built-in widgets. Have a look " textplain += "at the code to see how easy it is to build your own apps!" text = HTML(textplain) text.setStyleName("mail-AboutText") outer.add(text, DockPanel.CENTER) # Add a bit of spacing and margin to the dock to keep the components from # being placed too closely together. outer.setSpacing(8) self.add(outer)
def createRecordButton(self): """ """ # TODO : Use centered button. container = Panel(orientation='horizontal', padding=30) button = Image('resources/icons/record.png') button.onClick = lambda: self.capture() container.add(button) self.sidebar.add(container)
def createImage(self, imageUrl): image = Image(imageUrl) image.setStyleName("ks-images-Image") p = VerticalPanel() p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) p.add(image) return p
def __init__(self, style, name, line, column, level, breadcrumb): super().__init__('{}{}'.format(level * ' ', name), '{} (line {})'.format(breadcrumb, line)) self.style = style self.name = name self.line = line self.column = column self.level = level self.breadcrumb = breadcrumb self.image = Image(style)
def __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 createSettings(self): """ Creates and configures widget for photo configuration. """ self.effects = self.camera.effects() self.currentEffect = 0 effectPanel = Panel(orientation='horizontal', padding=0) effectPanel.add(Image('resources/icons/filter.png')) container = Panel(orientation='horizontal', padding=10) prevEffect = Label('<', size='large') nextEffect = Label('>', size='large') self.effectLabel = Label(self.effects[self.currentEffect], size='large') container.add(prevEffect) container.add(self.effectLabel) container.add(nextEffect) effectPanel.add(container) self.sidebar.add(effectPanel)
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")