|
5 | 5 | from openpilot.common.params import Params
|
6 | 6 | from openpilot.system.ui.lib.application import gui_app, FontWeight
|
7 | 7 | from openpilot.system.ui.lib.label import gui_text_box
|
| 8 | +from openpilot.selfdrive.ui.layouts.network import NetworkLayout |
8 | 9 |
|
9 | 10 | # Import individual panels
|
10 | 11 |
|
@@ -56,7 +57,7 @@ def __init__(self):
|
56 | 57 | PanelType.TOGGLES: PanelInfo("Toggles", None, rl.Rectangle(0, 0, 0, 0)),
|
57 | 58 | PanelType.SOFTWARE: PanelInfo("Software", None, rl.Rectangle(0, 0, 0, 0)),
|
58 | 59 | PanelType.FIREHOSE: PanelInfo("Firehose", None, rl.Rectangle(0, 0, 0, 0)),
|
59 |
| - PanelType.NETWORK: PanelInfo("Network", None, rl.Rectangle(0, 0, 0, 0)), |
| 60 | + PanelType.NETWORK: PanelInfo("Network", NetworkLayout(), rl.Rectangle(0, 0, 0, 0)), |
60 | 61 | PanelType.DEVELOPER: PanelInfo("Developer", None, rl.Rectangle(0, 0, 0, 0)),
|
61 | 62 | }
|
62 | 63 |
|
@@ -132,14 +133,18 @@ def _draw_sidebar(self, rect: rl.Rectangle):
|
132 | 133 | def _draw_current_panel(self, rect: rl.Rectangle):
|
133 | 134 | content_rect = rl.Rectangle(rect.x + PANEL_MARGIN, rect.y + 25, rect.width - (PANEL_MARGIN * 2), rect.height - 50)
|
134 | 135 | rl.draw_rectangle_rounded(content_rect, 0.03, 30, PANEL_COLOR)
|
135 |
| - gui_text_box( |
136 |
| - content_rect, |
137 |
| - f"Demo {self._panels[self._current_panel].name} Panel", |
138 |
| - font_size=170, |
139 |
| - color=rl.WHITE, |
140 |
| - alignment=rl.GuiTextAlignment.TEXT_ALIGN_CENTER, |
141 |
| - alignment_vertical=rl.GuiTextAlignmentVertical.TEXT_ALIGN_MIDDLE, |
142 |
| - ) |
| 136 | + if self._panels[self._current_panel].instance: |
| 137 | + # Render the current panel instance |
| 138 | + self._panels[self._current_panel].instance.render(content_rect) |
| 139 | + else: |
| 140 | + gui_text_box( |
| 141 | + content_rect, |
| 142 | + f"Demo {self._panels[self._current_panel].name} Panel", |
| 143 | + font_size=170, |
| 144 | + color=rl.WHITE, |
| 145 | + alignment=rl.GuiTextAlignment.TEXT_ALIGN_CENTER, |
| 146 | + alignment_vertical=rl.GuiTextAlignmentVertical.TEXT_ALIGN_MIDDLE, |
| 147 | + ) |
143 | 148 |
|
144 | 149 | def handle_mouse_release(self, mouse_pos: rl.Vector2) -> bool:
|
145 | 150 | # Check close button
|
|
0 commit comments