Skip to content

Commit 2ef7dcf

Browse files
author
Rado Guzinski
committed
[processing] Update Processing toolbox when a provider is added or removed
1 parent aa43059 commit 2ef7dcf

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

python/plugins/processing/core/Processing.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ class Processing:
6767
listeners = []
6868
providers = []
6969

70+
toolbox = None
71+
7072
# A dictionary of algorithms. Keys are names of providers
7173
# and values are list with all algorithms from that provider
7274
algs = {}
@@ -79,6 +81,10 @@ class Processing:
7981

8082
modeler = ModelerAlgorithmProvider()
8183

84+
@staticmethod
85+
def setToolbox(toolbox):
86+
Processing.toolbox = toolbox
87+
8288
@staticmethod
8389
def addProvider(provider, updateList=False):
8490
"""Use this method to add algorithms from external providers.
@@ -91,8 +97,8 @@ def addProvider(provider, updateList=False):
9197
provider.initializeSettings()
9298
Processing.providers.append(provider)
9399
ProcessingConfig.readSettings()
94-
if updateList:
95-
Processing.updateAlgsList()
100+
if updateList and Processing.toolbox:
101+
Processing.toolbox.updateTree()
96102
except:
97103
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
98104
'Could not load provider:'
@@ -111,7 +117,8 @@ def removeProvider(provider):
111117
provider.unload()
112118
Processing.providers.remove(provider)
113119
ProcessingConfig.readSettings()
114-
Processing.updateAlgsList()
120+
if Processing.toolbox:
121+
Processing.toolbox.updateTree()
115122
except:
116123
# This try catch block is here to avoid problems if the
117124
# plugin with a provider is unloaded after the Processing

python/plugins/processing/gui/ProcessingToolbox.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def __init__(self):
7272
if hasattr(self.searchBox, 'setPlaceholderText'):
7373
self.searchBox.setPlaceholderText(self.tr('Search...'))
7474

75+
Processing.setToolbox(self)
7576
self.fillTree()
7677

7778
def textChanged(self):

0 commit comments

Comments
 (0)