mici scroller: remove double pad args (#37315)

* remove double pad args

* fix
This commit is contained in:
Shane Smiskol
2026-02-21 22:31:05 -08:00
committed by GitHub
parent 1304f95978
commit cdcc2f6766
4 changed files with 7 additions and 9 deletions

View File

@@ -40,7 +40,7 @@ class MiciMainLayout(Widget):
self._alerts_layout,
self._home_layout,
self._onroad_layout,
], spacing=0, pad_start=0, pad_end=0, scroll_indicator=False, edge_shadows=False)
], spacing=0, pad=0, scroll_indicator=False, edge_shadows=False)
self._scroller.set_reset_scroll_at_show(False)
self._scroller.set_enabled(lambda: self.enabled) # for nav stack

View File

@@ -197,7 +197,7 @@ class MiciOffroadAlerts(Widget):
self._last_refresh = 0.0
# Create vertical scroller
self._scroller = Scroller([], horizontal=False, spacing=12, pad_start=0, pad_end=0, snap_items=False)
self._scroller = Scroller([], horizontal=False, spacing=12, pad=0, snap_items=False)
# Create empty state label
self._empty_label = UnifiedLabel(tr("no alerts"), 65, FontWeight.DISPLAY, rl.WHITE,

View File

@@ -297,7 +297,7 @@ class BigMultiOptionDialog(BigDialogBase):
# Widget doesn't differentiate between click and drag
self._can_click = True
self._scroller = Scroller([], horizontal=False, pad_start=100, pad_end=100, spacing=0, snap_items=True)
self._scroller = Scroller([], horizontal=False, pad=100, spacing=0, snap_items=True)
for option in options:
self._scroller.add_widget(BigDialogOptionButton(option))

View File

@@ -63,15 +63,13 @@ class ScrollIndicator(Widget):
class Scroller(Widget):
def __init__(self, items: list[Widget], horizontal: bool = True, snap_items: bool = True, spacing: int = ITEM_SPACING,
pad_start: int = ITEM_SPACING, pad_end: int = ITEM_SPACING,
scroll_indicator: bool = True, edge_shadows: bool = True):
pad: int = ITEM_SPACING, scroll_indicator: bool = True, edge_shadows: bool = True):
super().__init__()
self._items: list[Widget] = []
self._horizontal = horizontal
self._snap_items = snap_items
self._spacing = spacing
self._pad_start = pad_start
self._pad_end = pad_end
self._pad = pad
self._reset_scroll_at_show = True
@@ -200,7 +198,7 @@ class Scroller(Widget):
self._content_size = sum(item.rect.width if self._horizontal else item.rect.height for item in self._visible_items)
self._content_size += self._spacing * (len(self._visible_items) - 1)
self._content_size += self._pad_start + self._pad_end
self._content_size += self._pad * 2
self._scroll_offset = self._get_scroll(self._visible_items, self._content_size)
@@ -208,7 +206,7 @@ class Scroller(Widget):
cur_pos = 0
for idx, item in enumerate(self._visible_items):
spacing = self._spacing if (idx > 0) else self._pad_start
spacing = self._spacing if (idx > 0) else self._pad
# Nicely lay out items horizontally/vertically
if self._horizontal:
x = self._rect.x + cur_pos + spacing