|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
import pyray as rl |
|
|
|
|
from openpilot.common.params import Params |
|
|
|
|
from openpilot.system.ui.lib.application import gui_app, FontWeight |
|
|
|
|
from openpilot.system.ui.lib.application import gui_app, FontWeight, FONT_SCALE |
|
|
|
|
from openpilot.system.ui.widgets import Widget |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -9,7 +9,7 @@ class ExperimentalModeButton(Widget): |
|
|
|
|
super().__init__() |
|
|
|
|
|
|
|
|
|
self.img_width = 80 |
|
|
|
|
self.horizontal_padding = 50 |
|
|
|
|
self.horizontal_padding = 25 |
|
|
|
|
self.button_height = 125 |
|
|
|
|
|
|
|
|
|
self.params = Params() |
|
|
|
@ -31,11 +31,6 @@ class ExperimentalModeButton(Widget): |
|
|
|
|
rl.draw_rectangle_gradient_h(int(rect.x), int(rect.y), int(rect.width), int(rect.height), |
|
|
|
|
start_color, end_color) |
|
|
|
|
|
|
|
|
|
def _handle_mouse_release(self, mouse_pos): |
|
|
|
|
self.experimental_mode = not self.experimental_mode |
|
|
|
|
# TODO: Opening settings for ExperimentalMode |
|
|
|
|
self.params.put_bool("ExperimentalMode", self.experimental_mode) |
|
|
|
|
|
|
|
|
|
def _render(self, rect): |
|
|
|
|
rl.draw_rectangle_rounded(rect, 0.08, 20, rl.WHITE) |
|
|
|
|
|
|
|
|
@ -51,7 +46,7 @@ class ExperimentalModeButton(Widget): |
|
|
|
|
# Draw text label (left aligned) |
|
|
|
|
text = "EXPERIMENTAL MODE ON" if self.experimental_mode else "CHILL MODE ON" |
|
|
|
|
text_x = rect.x + self.horizontal_padding |
|
|
|
|
text_y = rect.y + rect.height / 2 - 45 // 2 # Center vertically |
|
|
|
|
text_y = rect.y + rect.height / 2 - 45 * FONT_SCALE // 2 # Center vertically |
|
|
|
|
|
|
|
|
|
rl.draw_text_ex(gui_app.font(FontWeight.NORMAL), text, rl.Vector2(int(text_x), int(text_y)), 45, 0, rl.BLACK) |
|
|
|
|
|
|
|
|
|