mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
[processing] improvements for new mechanism for adding algorithms
Correctly remove algorithms on plugin unload
This commit is contained in:
parent
bc75862e53
commit
3607e269c6
@ -32,7 +32,7 @@ from processing.core.Processing import Processing
|
|||||||
class ProcessingExampleScriptsPlugin:
|
class ProcessingExampleScriptsPlugin:
|
||||||
|
|
||||||
def initGui(self):
|
def initGui(self):
|
||||||
Processing.addScripts(self, os.path.dirname(__file__))
|
Processing.addScripts(os.path.join(os.path.dirname(__file__), "scripts"))
|
||||||
|
|
||||||
def unload(self):
|
def unload(self):
|
||||||
pass
|
Processing.removeScripts(os.path.join(os.path.dirname(__file__), "scripts"))
|
||||||
|
@ -150,9 +150,16 @@ class Processing:
|
|||||||
provider.externalAlgs.extend(scripts)
|
provider.externalAlgs.extend(scripts)
|
||||||
Processing.reloadProvider("qgis")
|
Processing.reloadProvider("qgis")
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
|
@staticmethod
|
||||||
def removeScripts(folder):
|
def removeScripts(folder):
|
||||||
pass
|
provider = Processing.getProviderFromName("qgis")
|
||||||
|
for alg in provider.externalAlgs[::-1]:
|
||||||
|
path = os.path.dirname(alg.descriptionFile)
|
||||||
|
if path == folder:
|
||||||
|
provider.externalAlgs.remove(alg)
|
||||||
|
Processing.reloadProvider("qgis")
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def updateAlgsList():
|
def updateAlgsList():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user