I am using QGIS3.4 (built-in Python 3) actions.addAction and trying to open a local photo, with the below code I am able to store the photo path in the feature attribute and created an action, I have also ticked the box "auto open form" in identify results tool
QgsProject.instance().addMapLayer(vectorLyr) iface.setActiveLayer(vectorLyr) activeLyr=iface.activeLayer() actions=activeLyr.actions() actions.addAction(QgsAction.OpenUrl,"Photos",'[% "photo" %]')
I verified the action has been created successfully:
The problem is when I click on the feature using identifier tool, the popped up window is not the photo, instead showing the photo below (I have also tried to add "file:///" in front of the path attribute, and still got same issue)
Then I also tested other type of actions (this is related to my second question below) such as GenericPython to see if it works using below line, again when I clicked the feature, nothing happened:
I am not sure what I missed here and didn't quite understand the usage of action scopes and my actual goal is to define the action to be able to call another python script (.py) how do I modify the code to make it work?