Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Console Python - QGIS
- from PyQt4 import QtGui
- def printEnable():
- print "Enable"
- li = iface.legendInterface()
- layer = iface.activeLayer()
- if layer.type() == QgsMapLayer.VectorLayer:
- action = QtGui.QAction( u"My Action", iface.legendInterface() )
- action.triggered.connect( printEnable )
- arg = ( action, "My Plugin Menu", "id1", QgsMapLayer.VectorLayer, False )
- li.addLegendLayerAction( *arg )
- li.addLegendLayerActionForLayer( action, layer )
- # Try Disable
- #action.setEnabled(False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement