NavWidget: standardize back callback (#37479)

clean this up
This commit is contained in:
Shane Smiskol
2026-02-28 00:29:15 -08:00
committed by GitHub
parent 6266feeed2
commit b6f3692b56
11 changed files with 1 additions and 26 deletions
+1 -6
View File
@@ -55,7 +55,6 @@ class NavWidget(Widget, abc.ABC):
def __init__(self):
super().__init__()
self._back_callback: Callable[[], None] | None = None
self._back_button_start_pos: MousePos | None = None
self._swiping_away = False # currently swiping away
self._can_swipe_away = True # swipe away is blocked after certain horizontal movement
@@ -76,9 +75,6 @@ class NavWidget(Widget, abc.ABC):
def set_back_enabled(self, enabled: bool | Callable[[], bool]) -> None:
self._back_enabled = enabled
def set_back_callback(self, callback: Callable[[], None]) -> None:
self._back_callback = callback
def _handle_mouse_event(self, mouse_event: MouseEvent) -> None:
# FIXME: disabling this widget on new push_widget still causes this widget to track mouse events without mouse down
super()._handle_mouse_event(mouse_event)
@@ -167,8 +163,7 @@ class NavWidget(Widget, abc.ABC):
new_y = self._pos_filter.x = 0.0
if new_y > self._rect.height + DISMISS_PUSH_OFFSET - 10:
if self._back_callback is not None:
self._back_callback()
gui_app.pop_widget()
self._playing_dismiss_animation = False
self._back_button_start_pos = None