From bc3e32d542e931669d707b333668bdc11b04f1b5 Mon Sep 17 00:00:00 2001 From: Israel Dryer <42584742+israel-dryer@users.noreply.github.com> Date: Mon, 30 May 2022 23:15:37 -0400 Subject: [PATCH 1/2] Update tableview.py Add option to get_rows method to return only the rows currently selected. --- src/ttkbootstrap/tableview.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ttkbootstrap/tableview.py b/src/ttkbootstrap/tableview.py index 24af3699..e05f0925 100644 --- a/src/ttkbootstrap/tableview.py +++ b/src/ttkbootstrap/tableview.py @@ -1153,9 +1153,13 @@ def get_column( except ValueError: return None - def get_rows(self, visible=False, filtered=False) -> List[TableRow]: + def get_rows(self, visible=False, filtered=False, selected=False) -> List[TableRow]: """Return a list of TableRow objects. + Return a subset of rows based on optional flags. Only ONE flag can be used + at a time. If more than one flag is set to `True`, then the first flag will + be used to return the data. + Parameters: visible (bool): @@ -1164,6 +1168,9 @@ def get_rows(self, visible=False, filtered=False) -> List[TableRow]: filtered (bool): If True, only rows in the filtered dataset will be returned. + selected (bool): + If True, only rows that are currently selected will be returned. + Returns: List[TableRow]: @@ -1173,6 +1180,8 @@ def get_rows(self, visible=False, filtered=False) -> List[TableRow]: return self._viewdata elif filtered: return self._tablerows_filtered + elif selected: + return [row for row in self._viewdata if row.iid in self.view.selection()] else: return self._tablerows From 1bb36fd18a76e0134cd4aeabbd0c3b16bb12e579 Mon Sep 17 00:00:00 2001 From: Israel Dryer <42584742+israel-dryer@users.noreply.github.com> Date: Mon, 30 May 2022 23:16:55 -0400 Subject: [PATCH 2/2] Update setup.py Bump version number to 1.7.7.2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 91bf2325..3a554690 100644 --- a/setup.py +++ b/setup.py @@ -70,7 +70,7 @@ setuptools.setup( name="ttkbootstrap", - version="1.7.7.1", + version="1.7.7.2", author="Israel Dryer", author_email="israel.dryer@gmail.com", description="A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.",