Skip to content
Permalink
Browse files
[processing] Update Processing toolbox when a provider is added or re…
…moved
  • Loading branch information
Rado Guzinski committed May 26, 2014
1 parent aa43059 commit 2ef7dcf6b9bba0bcd1c1010f8d5ed8828811f907
Showing with 11 additions and 3 deletions.
  1. +10 −3 python/plugins/processing/core/Processing.py
  2. +1 −0 python/plugins/processing/gui/ProcessingToolbox.py
@@ -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 @@ def addProvider(provider, updateList=False):
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 @@ def removeProvider(provider):
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 @@ def __init__(self):
if hasattr(self.searchBox, 'setPlaceholderText'):
self.searchBox.setPlaceholderText(self.tr('Search...'))

Processing.setToolbox(self)
self.fillTree()

def textChanged(self):

0 comments on commit 2ef7dcf

Please sign in to comment.