From d690edb3af9c0528fd7e3fa2d022ec0a9de7ab48 Mon Sep 17 00:00:00 2001 From: topic2k Date: Sun, 17 May 2020 14:49:04 +0200 Subject: [PATCH] add method GetCheckedItemCount Added a method to get the number of checked items. --- wx/lib/agw/ultimatelistctrl.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/wx/lib/agw/ultimatelistctrl.py b/wx/lib/agw/ultimatelistctrl.py index 6389fd26..f133ad4b 100644 --- a/wx/lib/agw/ultimatelistctrl.py +++ b/wx/lib/agw/ultimatelistctrl.py @@ -9412,6 +9412,19 @@ class UltimateListMainWindow(wx.ScrolledWindow): # item count # ---------------------------------------------------------------------------- + def GetCheckedItemCount(self, col=0): + """ + Returns the number of checked items in the given column. + + :param col: an integer specifying the column index. + :returns: the number of checked items. + :rtype: int + """ + + GetLine = self.GetLine # local optimization + return len([line for line in range(self.GetItemCount()) if GetLine(line).IsChecked(col)]) + + def GetItemCount(self): """ Returns the number of items in the :class:`UltimateListCtrl`. """ @@ -11164,6 +11177,18 @@ class UltimateListCtrl(wx.Control): return self._mainWin.GetUserLineHeight() + def GetCheckedItemCount(self, col=0): + """ + Returns the number of checked items in the given column. + + :param 'col': an integer specifying the column index. + :returns: the number of checked items. + :rtype: int + """ + + return self._mainWin.GetCheckedItemCount(col) + + def GetColumn(self, col): """ Returns information about this column.