diff --git a/selfdrive/ui/widgets/prime.py b/selfdrive/ui/widgets/prime.py index e98e4c1e1..ae8ba6595 100644 --- a/selfdrive/ui/widgets/prime.py +++ b/selfdrive/ui/widgets/prime.py @@ -1,27 +1,22 @@ import pyray as rl -from openpilot.selfdrive.ui.ui_state import ui_state from openpilot.system.ui.lib.application import gui_app, FontWeight from openpilot.system.ui.lib.multilang import tr -from openpilot.system.ui.lib.text_measure import measure_text_cached -from openpilot.system.ui.lib.wrap_text import wrap_text from openpilot.system.ui.widgets import Widget from openpilot.system.ui.widgets.label import gui_label class PrimeWidget(Widget): - """Widget for displaying comma prime subscription status""" + """Widget for displaying MR.ONE promotional content""" PRIME_BG_COLOR = rl.Color(51, 51, 51, 255) + BRAND_COLOR = rl.Color(70, 91, 234, 255) def _render(self, rect): - if ui_state.prime_state.is_prime(): - self._render_for_prime_user(rect) - else: - self._render_for_non_prime_users(rect) + self._render_promotion(rect) - def _render_for_non_prime_users(self, rect: rl.Rectangle): - """Renders the advertisement for non-Prime users.""" + def _render_promotion(self, rect: rl.Rectangle): + """Renders the MR.ONE brand promotion.""" rl.draw_rectangle_rounded(rect, 0.025, 10, self.PRIME_BG_COLOR) @@ -30,34 +25,24 @@ class PrimeWidget(Widget): w = rect.width - 160 # Title - gui_label(rl.Rectangle(x, y, w, 90), tr("Upgrade Now"), 75, font_weight=FontWeight.BOLD) + gui_label(rl.Rectangle(x, y, w, 90), tr("MR.ONE"), 85, font_weight=FontWeight.BOLD, color=self.BRAND_COLOR) - # Description with wrapping - desc_y = y + 140 + # Subtitle + sub_y = y + 110 font = gui_app.font(FontWeight.NORMAL) - wrapped_text = "\n".join(wrap_text(font, tr("Become a comma prime member at connect.comma.ai"), 56, int(w))) - text_size = measure_text_cached(font, wrapped_text, 56) - rl.draw_text_ex(font, wrapped_text, rl.Vector2(x, desc_y), 56, 0, rl.WHITE) + rl.draw_text_ex(font, tr("更智能的驾驶体验"), rl.Vector2(x, sub_y), 56, 0, rl.WHITE) # Features section - features_y = desc_y + text_size.y + 50 - gui_label(rl.Rectangle(x, features_y, w, 50), tr("PRIME FEATURES:"), 41, font_weight=FontWeight.BOLD) + features_y = sub_y + 80 + gui_label(rl.Rectangle(x, features_y, w, 50), tr("特色功能:"), 41, font_weight=FontWeight.BOLD) # Feature list - features = [tr("Remote access"), tr("24/7 LTE connectivity"), tr("1 year of drive storage"), tr("Remote snapshots")] + features = [tr("专属调校"), tr("持续OTA更新"), tr("实时远程监控"), tr("精湛本地化体验")] for i, feature in enumerate(features): item_y = features_y + 80 + i * 65 - gui_label(rl.Rectangle(x, item_y, 100, 60), "✓", 50, color=rl.Color(70, 91, 234, 255)) + gui_label(rl.Rectangle(x, item_y, 100, 60), "✦", 50, color=self.BRAND_COLOR) gui_label(rl.Rectangle(x + 60, item_y, w - 60, 60), feature, 50) - def _render_for_prime_user(self, rect: rl.Rectangle): - """Renders the prime user widget with subscription status.""" - - rl.draw_rectangle_rounded(rl.Rectangle(rect.x, rect.y, rect.width, 230), 0.1, 10, self.PRIME_BG_COLOR) - - x = rect.x + 56 - y = rect.y + 40 - - font = gui_app.font(FontWeight.BOLD) - rl.draw_text_ex(font, tr("✓ SUBSCRIBED"), rl.Vector2(x, y), 41, 0, rl.Color(134, 255, 78, 255)) - rl.draw_text_ex(font, tr("comma prime"), rl.Vector2(x, y + 61), 75, 0, rl.WHITE) + # Contact + contact_y = features_y + 80 + len(features) * 65 + 30 + rl.draw_text_ex(font, tr("联系我们获取更多信息"), rl.Vector2(x, contact_y), 41, 0, rl.Color(200, 200, 200, 200))