Skip to content

Commit

Permalink
[processing] changed how toolbox is updated after adding/removing pro…
Browse files Browse the repository at this point in the history
…vider
  • Loading branch information
volaya committed Jun 13, 2014
1 parent 9868334 commit a5e5a0e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
2 changes: 1 addition & 1 deletion python/plugins/processing/ProcessingPlugin.py
Expand Up @@ -56,7 +56,7 @@ def initGui(self):
self.toolbox = ProcessingToolbox()
self.iface.addDockWidget(Qt.RightDockWidgetArea, self.toolbox)
self.toolbox.hide()
#Processing.addAlgListListener(self.toolbox)
Processing.addAlgListListener(self.toolbox)

self.menu = QMenu(self.iface.mainWindow().menuBar())
self.menu.setObjectName( 'processing' )
Expand Down
13 changes: 3 additions & 10 deletions python/plugins/processing/core/Processing.py
Expand Up @@ -65,8 +65,6 @@ 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 = {}
Expand All @@ -79,10 +77,6 @@ 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.
Expand All @@ -95,8 +89,8 @@ def addProvider(provider, updateList=False):
provider.initializeSettings()
Processing.providers.append(provider)
ProcessingConfig.readSettings()
if updateList and Processing.toolbox:
Processing.toolbox.updateTree()
if updateList:
Processing.updateAlgsList()
except:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
'Could not load provider:'
Expand All @@ -115,8 +109,7 @@ def removeProvider(provider):
provider.unload()
Processing.providers.remove(provider)
ProcessingConfig.readSettings()
if Processing.toolbox:
Processing.toolbox.updateTree()
Processing.updateAlgsList()
except:
# This try catch block is here to avoid problems if the
# plugin with a provider is unloaded after the Processing
Expand Down
6 changes: 2 additions & 4 deletions python/plugins/processing/gui/ConfigDialog.py
Expand Up @@ -31,7 +31,7 @@
from PyQt4.QtGui import *

from processing.core.ProcessingConfig import ProcessingConfig

from processing.core.Processing import Processing
from processing.ui.ui_DlgConfig import Ui_DlgConfig

import processing.resources_rc
Expand Down Expand Up @@ -146,9 +146,7 @@ def accept(self):
else:
setting.value = unicode(self.items[setting].text())
setting.save()
#ProcessingConfig.addSetting(setting)
#ProcessingConfig.saveSettings()
self.toolbox.updateTree()
Processing.updateAlgsList()

QDialog.accept(self)

Expand Down
5 changes: 1 addition & 4 deletions python/plugins/processing/gui/ProcessingToolbox.py
Expand Up @@ -72,7 +72,6 @@ def __init__(self):
if hasattr(self.searchBox, 'setPlaceholderText'):
self.searchBox.setPlaceholderText(self.tr('Search...'))

Processing.setToolbox(self)
self.fillTree()

def textChanged(self):
Expand Down Expand Up @@ -113,9 +112,7 @@ def modeHasChanged(self):

self.fillTree()


def updateTree(self):
Processing.updateAlgsList()
def algsListHasChanged(self):
self.fillTree()

def updateProvider(self, providerName, updateAlgsList = True):
Expand Down

0 comments on commit a5e5a0e

Please sign in to comment.