6e2ccc8b15
version: sunnypilot v2026.002.000 (staging) date: 2026-05-27T04:05:25 master commit: dfc3c98b226da57a653daf57131a8a3d66166fcb
28 lines
918 B
Python
28 lines
918 B
Python
"""
|
|
Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors.
|
|
|
|
This file is part of sunnypilot and is licensed under the MIT License.
|
|
See the LICENSE.md file in the root directory for more details.
|
|
"""
|
|
from openpilot.system.ui.lib.application import gui_app
|
|
from openpilot.system.ui.widgets import DialogResult
|
|
from openpilot.system.ui.widgets.html_render import HtmlModal
|
|
|
|
|
|
class HtmlModalSP(HtmlModal):
|
|
def __init__(self, file_path=None, text=None, callback=None):
|
|
super().__init__(file_path=file_path, text=text)
|
|
self._callback = callback
|
|
self._dialog_result = DialogResult.NO_ACTION
|
|
self._ok_button._click_callback = self._on_ok_clicked
|
|
|
|
def _on_ok_clicked(self):
|
|
self._dialog_result = DialogResult.CONFIRM
|
|
gui_app.pop_widget()
|
|
|
|
if self._callback:
|
|
self._callback(self._dialog_result)
|
|
|
|
def reset(self):
|
|
self._dialog_result = DialogResult.NO_ACTION
|