Bug report #9523
Updated by Andreas Neumann over 7 years ago
Hello,
If I have a Project with a Macro as shown below, and I set Settings->Options->Enable Macros to "Ask", the openProject macro will never load. If I set Enable Macros to Always, or only for this session, it will load.
In Ask mode:
I open the Project.
I get the security warning in the canvas view.
I click "Enable Macros"
The security warning disappears
The Project loads without the "Hello I am a Macro" Status bar.
In Always or Only this session:
I open the Project
I see the "Hello I am a Macro" Status bar.
If I run the code as a saveProject macro, then the saveProject macro will work for the Ask Setting. So, the Problem is just with openProject.
<pre>
def openProject():
from qgis.utils import iface
from qgis.gui import QgsMessageBar
iface.messageBar().pushMessage("Hello I am a Macro", "", level=QgsMessageBar.INFO)
def saveProject():
pass
def closeProject():
pass
</pre>
This is the case for QGIS 2.0.1 as well as today's dev Version Qgis 2.1.0 f06e72e, on Windows as well as on Ubuntu.
If I have a Project with a Macro as shown below, and I set Settings->Options->Enable Macros to "Ask", the openProject macro will never load. If I set Enable Macros to Always, or only for this session, it will load.
In Ask mode:
I open the Project.
I get the security warning in the canvas view.
I click "Enable Macros"
The security warning disappears
The Project loads without the "Hello I am a Macro" Status bar.
In Always or Only this session:
I open the Project
I see the "Hello I am a Macro" Status bar.
If I run the code as a saveProject macro, then the saveProject macro will work for the Ask Setting. So, the Problem is just with openProject.
<pre>
def openProject():
from qgis.utils import iface
from qgis.gui import QgsMessageBar
iface.messageBar().pushMessage("Hello I am a Macro", "", level=QgsMessageBar.INFO)
def saveProject():
pass
def closeProject():
pass
</pre>
This is the case for QGIS 2.0.1 as well as today's dev Version Qgis 2.1.0 f06e72e, on Windows as well as on Ubuntu.