mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
[processing] Update Processing toolbox when a provider is added or removed
This commit is contained in:
parent
aa43059d5a
commit
2ef7dcf6b9
@ -67,6 +67,8 @@ class Processing:
|
||||
listeners = []
|
||||
providers = []
|
||||
|
||||
toolbox = None
|
||||
|
||||
# A dictionary of algorithms. Keys are names of providers
|
||||
# and values are list with all algorithms from that provider
|
||||
algs = {}
|
||||
@ -79,6 +81,10 @@ class Processing:
|
||||
|
||||
modeler = ModelerAlgorithmProvider()
|
||||
|
||||
@staticmethod
|
||||
def setToolbox(toolbox):
|
||||
Processing.toolbox = toolbox
|
||||
|
||||
@staticmethod
|
||||
def addProvider(provider, updateList=False):
|
||||
"""Use this method to add algorithms from external providers.
|
||||
@ -91,8 +97,8 @@ class Processing:
|
||||
provider.initializeSettings()
|
||||
Processing.providers.append(provider)
|
||||
ProcessingConfig.readSettings()
|
||||
if updateList:
|
||||
Processing.updateAlgsList()
|
||||
if updateList and Processing.toolbox:
|
||||
Processing.toolbox.updateTree()
|
||||
except:
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
|
||||
'Could not load provider:'
|
||||
@ -111,7 +117,8 @@ class Processing:
|
||||
provider.unload()
|
||||
Processing.providers.remove(provider)
|
||||
ProcessingConfig.readSettings()
|
||||
Processing.updateAlgsList()
|
||||
if Processing.toolbox:
|
||||
Processing.toolbox.updateTree()
|
||||
except:
|
||||
# This try catch block is here to avoid problems if the
|
||||
# plugin with a provider is unloaded after the Processing
|
||||
|
||||
@ -72,6 +72,7 @@ class ProcessingToolbox(QDockWidget, Ui_ProcessingToolbox):
|
||||
if hasattr(self.searchBox, 'setPlaceholderText'):
|
||||
self.searchBox.setPlaceholderText(self.tr('Search...'))
|
||||
|
||||
Processing.setToolbox(self)
|
||||
self.fillTree()
|
||||
|
||||
def textChanged(self):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user