def _refresh_layout(self):
        """ This queues and batches model changes so that the layout is only
        refreshed after the `_pending_timeout` expires. This prevents 
        the UI from refreshing when inserting or removing a large number of
        items until the operation is complete.
        
        """
        self._pending_view_refreshes -= 1
        if self._pending_view_refreshes == 0:
            try:
                self.model.layoutChanged.emit()
                self.on_layout_refreshed()
            except RuntimeError:
                # View can be destroyed before we get here
                return
            self._refresh_sizes()
def _refresh_layout ( self ) : self . _pending_view_refreshes -= 1 if self . _pending_view_refreshes == 0 : try : self . model . layoutChanged . emit ( ) self . on_layout_refreshed ( ) except RuntimeError : return self . _refresh_sizes ( )
This queues and batches model changes so that the layout is only
        refreshed after the `_pending_timeout` expires. This prevents 
        the UI from refreshing when inserting or removing a large number of
        items until the operation is complete.