Display an in-app notification. Args: text: The text or message of the notification. queue: If True, the notification will be queued. action: A dict containing the action to be called. timeout: Toast timeout. timeout: Toas
(
self,
text: str,
queue: bool | None = False,
action: _NotificationAction | None = None,
timeout=5,
priority=Adw.ToastPriority.NORMAL,
)
| 558 | self.provider["trans"].recent_dest_langs = self.dest_langs |
| 559 | |
| 560 | def send_notification( |
| 561 | self, |
| 562 | text: str, |
| 563 | queue: bool | None = False, |
| 564 | action: _NotificationAction | None = None, |
| 565 | timeout=5, |
| 566 | priority=Adw.ToastPriority.NORMAL, |
| 567 | ): |
| 568 | """ |
| 569 | Display an in-app notification. |
| 570 | |
| 571 | Args: |
| 572 | text: The text or message of the notification. |
| 573 | queue: If True, the notification will be queued. |
| 574 | action: A dict containing the action to be called. |
| 575 | timeout: Toast timeout. |
| 576 | timeout: Toast priority. |
| 577 | """ |
| 578 | |
| 579 | def toast_dismissed(_toast: Adw.Toast): |
| 580 | self.toast = None |
| 581 | |
| 582 | if not queue and self.toast is not None: |
| 583 | self.toast.dismiss() |
| 584 | self.toast = Adw.Toast(title=text) |
| 585 | self.toast.connect("dismissed", toast_dismissed) |
| 586 | if action is not None: |
| 587 | self.toast.props.button_label = action["label"] |
| 588 | self.toast.props.action_name = action["name"] |
| 589 | self.toast.props.timeout = timeout |
| 590 | self.toast.props.priority = priority |
| 591 | self.toast_overlay.add_toast(self.toast) |
| 592 | |
| 593 | def set_font_size(self, size: int): |
| 594 | self.src_text.font_size = size |
no outgoing calls
no test coverage detected