How to remove all selection from all registered layers using QGIS plugin?
There is probably a better way to do this, but you can iterate the layers in mapCanvas, and use removeSelection() method.
Something like this:
mc = self.iface.mapCanvas()
For layer in mc.layers():
if layer.type() == layer.VectorLayer:
layer.removeSelection()
mc.refresh()
This is a another method is given below:
for a in iface.attributesToolBar().actions():
if a.objectName() == 'mActionDeselectAll':
a.trigger()
break