Пример #1
0
    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)
Пример #2
0
    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)