def __init__(self): super(NotificationCustomExample, self).__init__() self.setSpacing(True) caption = TextField('Caption', 'Message sent') caption.setDescription(('Main info; a short caption-only ' 'notification is often most effective.')) caption.setWidth('200px') self.addComponent(caption) description = RichTextArea() description.setWidth('100%') description.setValue('<p>to <i>[email protected]</i></p>') description.setCaption('Description') description.setDescription(('Additional information; ' 'try to keep it short.')) self.addComponent(description) horiz = HorizontalLayout() horiz.setSpacing(True) self.addComponent(horiz) position = NativeSelect('Position') position.setNullSelectionAllowed(False) horiz.addComponent(position) self.initPositionItems(position) style = NativeSelect('Style') style.setNullSelectionAllowed(False) horiz.addComponent(style) self.initTypeItems(style) delay = Slider('Delay (msec), -1 means click to hide') delay.setDescription( ('Delay before fading<br/>Pull all the way to ' 'the left to get -1, which means forever (click to hide).')) delay.setWidth('100%') # 'description' will push width delay.setMin(Notification.DELAY_FOREVER) delay.setMax(10000) self.addComponent(delay) # TODO icon select l = ShowListener(self, caption, description, style, position, delay) show = Button('Show notification', l) self.addComponent(show) self.setComponentAlignment(show, Alignment.MIDDLE_RIGHT)
def __init__(self): super(NotificationCustomExample, self).__init__() self.setSpacing(True) caption = TextField('Caption', 'Message sent') caption.setDescription(('Main info; a short caption-only ' 'notification is often most effective.')) caption.setWidth('200px') self.addComponent(caption) description = RichTextArea() description.setWidth('100%') description.setValue('<p>to <i>[email protected]</i></p>') description.setCaption('Description') description.setDescription(('Additional information; ' 'try to keep it short.')) self.addComponent(description) horiz = HorizontalLayout() horiz.setSpacing(True) self.addComponent(horiz) position = NativeSelect('Position') position.setNullSelectionAllowed(False) horiz.addComponent(position) self.initPositionItems(position) style = NativeSelect('Style') style.setNullSelectionAllowed(False) horiz.addComponent(style) self.initTypeItems(style) delay = Slider('Delay (msec), -1 means click to hide') delay.setDescription(('Delay before fading<br/>Pull all the way to ' 'the left to get -1, which means forever (click to hide).')) delay.setWidth('100%') # 'description' will push width delay.setMin(Notification.DELAY_FOREVER) delay.setMax(10000) self.addComponent(delay) # TODO icon select l = ShowListener(self, caption, description, style, position, delay) show = Button('Show notification', l) self.addComponent(show) self.setComponentAlignment(show, Alignment.MIDDLE_RIGHT)
def __init__(self): super(SliderVerticalExample, self).__init__() self.setSpacing(True) value = Label('0') value.setSizeUndefined() slider = Slider('Select a value between 0 and 100') slider.setOrientation(Slider.ORIENTATION_VERTICAL) slider.setHeight('200px') slider.setMin(0) slider.setMax(100) slider.setImmediate(True) slider.addListener(SliderListener(value), IValueChangeListener) self.addComponent(slider) self.addComponent(value) self.setComponentAlignment(slider, Alignment.TOP_CENTER) self.setComponentAlignment(value, Alignment.TOP_CENTER)
def __init__(self): super(SliderHorizontalExample, self).__init__() self.setSpacing(True) self.setWidth('100%') value = Label('0') value.setWidth('3em') slider = Slider('Select a value between 0 and 100') slider.setWidth('100%') slider.setMin(0) slider.setMax(100) slider.setImmediate(True) slider.addListener(SliderListener(value), IValueChangeListener) self.addComponent(slider) self.setExpandRatio(slider, 1) self.addComponent(value) self.setComponentAlignment(value, Alignment.BOTTOM_LEFT)