Bug report #9523
openProject macro won't load when enable Macros setting set to Ask
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | - | ||
Category: | Python plugins | ||
Affected QGIS version: | 2.18.11 | Regression?: | Yes |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 18113 |
Description
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.
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
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.
Associated revisions
Fix 'enable macros' button does not run open macro (fix #9523)
History
#1 Updated by Salvatore Larosa almost 11 years ago
- Category set to Python plugins
- Target version set to Version 2.2
#2 Updated by Salvatore Larosa almost 11 years ago
- Pull Request or Patch supplied changed from No to Yes
#3 Updated by Heather Hillers over 10 years ago
Thanks.
#4 Updated by Jürgen Fischer over 10 years ago
- Target version changed from Version 2.2 to Future Release - Lower Priority
#5 Updated by Nyall Dawson about 8 years ago
- Status changed from Open to Closed
Fixed in changeset fa3663907a706971bbc418a1896b48a14f572327.
#6 Updated by Andreas Neumann over 7 years ago
- Affected QGIS version changed from master to 2.18.10
- Description updated (diff)
- Status changed from Closed to Open
Reopening this bug, because there is a regression in 2.18.10
Same behavior as stated. The macro does not run if enabled after asking the user.
Tested on Windows 7, 64bit.
#7 Updated by Andreas Neumann over 7 years ago
openProject macros run fine if set to "Always run", not after enabling with "Ask"
#8 Updated by Andreas Neumann over 7 years ago
- Pull Request or Patch supplied changed from Yes to No
- Regression? changed from No to Yes
#9 Updated by Giovanni Manghi over 7 years ago
- Priority changed from Normal to High
#10 Updated by Nyall Dawson over 7 years ago
- Status changed from Open to Feedback
Andreas - is this a new issue? Or are you reopening because you want a fix in 2.18?
#11 Updated by Andreas Neumann over 7 years ago
Hi Nyall,
I think a fix for 2.18 would be useful. 2.18 will be around for at least 2 years until people have all their favourite plugins ported to 3.x - so it makes sense to still provide 2.18 fixes for at least another year.
Apparently this issue (or a very similar issue) was fixed by you 8 months ago. I don't know what happened in between and why it doesn't work anymore). The workaround to always enable project macros is a bad security practice.
Thanks,
Andreas
#12 Updated by Nyall Dawson over 7 years ago
My fix was only for the 3.0 branch - it relies on a feature not available in the Qt4 builds. It'd need to be reworked to be backportable.
#13 Updated by Giovanni Manghi over 7 years ago
- Affected QGIS version changed from 2.18.10 to 2.18.11
#14 Updated by Giovanni Manghi about 7 years ago
- Status changed from Feedback to Open
#15 Updated by Alexander Bruy almost 6 years ago
- Status changed from Open to Feedback
Should we close this now, as QGIS 2.18 has reached its end of life?
#16 Updated by Nyall Dawson almost 6 years ago
- Status changed from Feedback to Closed
- Resolution set to fixed/implemented