mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-05 09:05:43 +08:00
cleaner
This commit is contained in:
@@ -83,9 +83,7 @@ class ConfidenceBall(Widget, ConfidenceBallSP):
|
||||
top_dot_color = rl.Color(50, 50, 50, 255)
|
||||
bottom_dot_color = rl.Color(13, 13, 13, 255)
|
||||
|
||||
if self._visual == 0:
|
||||
if not self.update_confidence_visual(content_rect, status_dot_radius, dot_height, top_dot_color, bottom_dot_color):
|
||||
draw_circle_gradient(content_rect.x + content_rect.width - status_dot_radius,
|
||||
dot_height, status_dot_radius,
|
||||
top_dot_color, bottom_dot_color)
|
||||
else:
|
||||
self.update_confidence_visual(content_rect, status_dot_radius, dot_height, top_dot_color, bottom_dot_color)
|
||||
|
||||
@@ -27,7 +27,7 @@ class ConfidenceBallSP:
|
||||
# UIStatus.LONG_ONLY
|
||||
return BORDER_COLORS[UIStatus.LONG_ONLY]
|
||||
|
||||
def update_confidence_visual(self, content_rect, status_dot_radius, dot_height, top_dot_color, bottom_dot_color):
|
||||
def update_confidence_visual(self, content_rect, status_dot_radius, dot_height, top_dot_color, bottom_dot_color) -> bool:
|
||||
if self._visual == 2:
|
||||
bar_width = int(20 * self._scale)
|
||||
bar_x = content_rect.x + content_rect.width - bar_width
|
||||
@@ -35,7 +35,10 @@ class ConfidenceBallSP:
|
||||
fill_y = int(content_rect.y + (content_rect.height - fill_h))
|
||||
rl.draw_rectangle(int(bar_x), int(content_rect.y), bar_width, int(content_rect.height), rl.Color(20, 20, 20, 180))
|
||||
rl.draw_rectangle_gradient_v(int(bar_x), fill_y, bar_width, fill_h, top_dot_color, bottom_dot_color)
|
||||
return True
|
||||
elif self._visual == 1:
|
||||
rl.draw_circle_gradient(int(content_rect.x + content_rect.width - status_dot_radius),
|
||||
int(dot_height), status_dot_radius,
|
||||
top_dot_color, bottom_dot_color)
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -20,7 +20,7 @@ class AugmentedRoadViewSP:
|
||||
def __init__(self):
|
||||
self._fade_texture = gui_app.texture("icons_mici/onroad/onroad_fade.png")
|
||||
self._fade_alpha_filter = FirstOrderFilter(0, 0.1, 1 / gui_app.target_fps)
|
||||
self._confidence_visual = ConfidenceBall(scale=1.5, visual=False)
|
||||
self._confidence_visual = ConfidenceBall(scale=1.5)
|
||||
|
||||
def update_fade_out_bottom_overlay(self, _content_rect):
|
||||
# Fade out bottom of overlays for looks (only when engaged)
|
||||
@@ -34,9 +34,6 @@ class AugmentedRoadViewSP:
|
||||
|
||||
def update_confidence_visual(self, _content_rect):
|
||||
mode = ui_state.confidence_visual
|
||||
if mode == 1:
|
||||
self._confidence_visual._visual = 1
|
||||
self._confidence_visual.render(_content_rect)
|
||||
elif mode == 2:
|
||||
self._confidence_visual._visual = 2
|
||||
self._confidence_visual.render(_content_rect)
|
||||
if mode in (1, 2):
|
||||
self._confidence_visual._visual = mode
|
||||
self._confidence_visual.render(_content_rect)
|
||||
|
||||
Reference in New Issue
Block a user