|
|
@ -94,10 +94,10 @@ class AlertRenderer(Widget): |
|
|
|
# Return current alert |
|
|
|
# Return current alert |
|
|
|
return Alert(text1=ss.alertText1, text2=ss.alertText2, size=ss.alertSize, status=ss.alertStatus) |
|
|
|
return Alert(text1=ss.alertText1, text2=ss.alertText2, size=ss.alertSize, status=ss.alertStatus) |
|
|
|
|
|
|
|
|
|
|
|
def _render(self, rect: rl.Rectangle) -> None: |
|
|
|
def _render(self, rect: rl.Rectangle) -> bool: |
|
|
|
alert = self.get_alert(ui_state.sm) |
|
|
|
alert = self.get_alert(ui_state.sm) |
|
|
|
if not alert: |
|
|
|
if not alert: |
|
|
|
return |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
alert_rect = self._get_alert_rect(rect, alert.size) |
|
|
|
alert_rect = self._get_alert_rect(rect, alert.size) |
|
|
|
self._draw_background(alert_rect, alert) |
|
|
|
self._draw_background(alert_rect, alert) |
|
|
@ -109,6 +109,7 @@ class AlertRenderer(Widget): |
|
|
|
alert_rect.height - 2 * ALERT_PADDING |
|
|
|
alert_rect.height - 2 * ALERT_PADDING |
|
|
|
) |
|
|
|
) |
|
|
|
self._draw_text(text_rect, alert) |
|
|
|
self._draw_text(text_rect, alert) |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
def _get_alert_rect(self, rect: rl.Rectangle, size: int) -> rl.Rectangle: |
|
|
|
def _get_alert_rect(self, rect: rl.Rectangle, size: int) -> rl.Rectangle: |
|
|
|
if size == log.SelfdriveState.AlertSize.full: |
|
|
|
if size == log.SelfdriveState.AlertSize.full: |
|
|
|