def __init__(self, default_notification_time=2.5, blinking_time=0.3, display_lines=[], *a, **k): super(NotificationComponent, self).__init__(*a, **k) self._display_lines = get_element(display_lines) self._token_control = _TokenControlElement() self._align_text_fn = self._default_align_text_fn self._message_box = MessageBoxComponent(parent=self) self._message_box.set_enabled(False) self._default_notification_time = default_notification_time self._blinking_time = blinking_time self._original_text = None self._blink_text = None self._blink_text_task = self._tasks.add( task.loop( task.sequence( task.run(lambda: self._message_box.__setattr__( 'text', self._original_text)), task.wait(self._blinking_time), task.run(lambda: self._message_box.__setattr__( 'text', self._blink_text)), task.wait(self._blinking_time)))).kill() return
def __init__(self, default_notification_time = 2.5, blinking_time = 0.3, display_lines = [], *a, **k): super(NotificationComponent, self).__init__(*a, **k) self._display_lines = get_element(display_lines) self._token_control = _TokenControlElement() self._align_text_fn = self._default_align_text_fn self._message_box = self.register_component(MessageBoxComponent()) self._message_box.set_enabled(False) self._default_notification_time = default_notification_time self._blinking_time = blinking_time self._original_text = None self._blink_text = None self._blink_text_task = self._tasks.add(task.loop(task.sequence(task.run(lambda : self._message_box.__setattr__('text', self._original_text)), task.wait(self._blinking_time), task.run(lambda : self._message_box.__setattr__('text', self._blink_text)), task.wait(self._blinking_time)))).kill()