MCPcopy
hub / github.com/beeware/toga / selection

Method selection

core/src/toga/widgets/table.py:295–311  ·  view source on GitHub ↗

The current selection of the table. If multiple selection is enabled, returns a list of Row objects from the data source matching the current selection. An empty list is returned if no rows are selected. If multiple selection is *not* enabled, returns the selected R

(self)

Source from the content-addressed store, hash-verified

293
294 @property
295 def selection(self) -> list[Row] | Row | None:
296 """The current selection of the table.
297
298 If multiple selection is enabled, returns a list of Row objects from the data
299 source matching the current selection. An empty list is returned if no rows are
300 selected.
301
302 If multiple selection is *not* enabled, returns the selected Row object, or
303 [`None`][] if no row is currently selected.
304 """
305 selection = self._impl.get_selection()
306 if isinstance(selection, list):
307 return [self.data[index] for index in selection]
308 elif selection is None:
309 return None
310 else:
311 return self.data[selection]
312
313 def scroll_to_top(self) -> None:
314 """Scroll the view so that the top of the list (first row) is visible."""

Callers

nothing calls this directly

Calls 1

get_selectionMethod · 0.45

Tested by

no test coverage detected