1

Is it possible to listen for plugin removal before the plugin is removed?

We save global settings as user interacts with the plugin, but want to reset plugin specific global settings when user uninstalls the plugin.

1 Answer 1

2

You can use the unload() method of your plugin, which is called also when your plugin is uninstalled.

So, the best place to do your cleaning is there, the unload().


See What is the purpose of some functions and files in QGIS Python plugins? for details.

3
  • This seems to invoke when I close QGIS client as well. I want a signal when plugin is uninstalled, not necessarily when plugin is unloaded.
    – James Park
    Commented Jul 22, 2020 at 5:04
  • 1
    Then, it doesn't exist. There will always be edge cases, like a user removing the plugin folder manually in the file explorer. You simply won't be able to react to such case. Anyways, I'd suggest you to think again about/adjust your implementation, or, to create a feature request for QGIS. Commented Jul 23, 2020 at 14:54
  • Thank you for clarification.
    – James Park
    Commented Jul 23, 2020 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.