(self)
A context manager that calls `emit_selection_rows_changed after
        changing a selection.
A context manager that calls `emit_selection_rows_changed after
        changing a selection.
A context manager that calls emit_selection_rows_changed after changing a selection .
def _emit_changed(self):
        """
        A context manager that calls `emit_selection_rows_changed after
        changing a selection.
        """
        def map_from_source(rows):
            return self.model.mapFromSourceRows(list(rows))

        old_rows = self._rows.copy()
        try:
            yield
        finally:
            if self.model.rowCount() != 0:
                deselected = map_from_source(old_rows - self._rows)
                selected = map_from_source(self._rows - old_rows)
                if len(selected) != 0 or len(deselected) != 0:
                    for model in self._selection_models:
                        model.emit_selection_rows_changed(selected, deselected)
def _emit_changed ( self ) : def map_from_source ( rows ) : return self . model . mapFromSourceRows ( list ( rows ) ) old_rows = self . _rows . copy ( ) try : yield finally : if self . model . rowCount ( ) != 0 : deselected = map_from_source ( old_rows - self . _rows ) selected = map_from_source ( self . _rows - old_rows ) if len ( selected ) != 0 or len ( deselected ) != 0 : for model in self . _selection_models : model . emit_selection_rows_changed ( selected , deselected )