Skip to content

Commit

Permalink
fixed bug with unfound recent algs
Browse files Browse the repository at this point in the history
improved model algorithms edition

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@258 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf committed Jun 22, 2012
1 parent 1742c6e commit 180e692
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
41 changes: 22 additions & 19 deletions src/sextante/gui/SextanteToolbox.py
Expand Up @@ -3,7 +3,6 @@
from PyQt4 import QtCore, QtGui
from sextante.core.Sextante import Sextante
from sextante.gui.ParametersDialog import ParametersDialog
import copy
from sextante.gui.BatchProcessingDialog import BatchProcessingDialog
from sextante.gui.EditRenderingStylesDialog import EditRenderingStylesDialog
from sextante.core.SextanteLog import SextanteLog
Expand Down Expand Up @@ -143,6 +142,9 @@ def fillTree(self):
for providerName in Sextante.algs.keys():
groups = {}
provider = Sextante.algs[providerName]
name = "ACTIVATE_" + providerName.upper().replace(" ", "_")
if not SextanteConfig.getSetting(name):
continue
algs = provider.values()
#add algorithms
for alg in algs:
Expand All @@ -158,19 +160,17 @@ def fillTree(self):
algItem = TreeAlgorithmItem(alg)
groupItem.addChild(algItem)

#add actions only if there are algorithms in this provider
if len(groups)>0:
actions = Sextante.actions[providerName]
for action in actions:
if text =="" or text.lower() in action.name.lower():
if action.group in groups:
groupItem = groups[action.group]
else:
groupItem = QtGui.QTreeWidgetItem()
groupItem.setText(0,action.group)
groups[action.group] = groupItem
algItem = TreeActionItem(action)
groupItem.addChild(algItem)
actions = Sextante.actions[providerName]
for action in actions:
if text =="" or text.lower() in action.name.lower():
if action.group in groups:
groupItem = groups[action.group]
else:
groupItem = QtGui.QTreeWidgetItem()
groupItem.setText(0,action.group)
groups[action.group] = groupItem
algItem = TreeActionItem(action)
groupItem.addChild(algItem)

if len(groups)>0:
providerItem = QtGui.QTreeWidgetItem()
Expand All @@ -191,15 +191,18 @@ def fillTree(self):
if showRecent:
recent = SextanteLog.getRecentAlgorithms()
if len(recent) != 0:
found = False
recentItem = QtGui.QTreeWidgetItem()
recentItem.setText(0,"Recently used algorithms")
for algname in recent:
alg = Sextante.getAlgorithm(algname)
algItem = TreeAlgorithmItem(alg)
recentItem.addChild(algItem)
self.algorithmTree.insertTopLevelItem(0, recentItem)
recentItem.setExpanded(True)

if alg is not None:
algItem = TreeAlgorithmItem(alg)
recentItem.addChild(algItem)
found = True
if found:
self.algorithmTree.insertTopLevelItem(0, recentItem)
recentItem.setExpanded(True)



Expand Down
5 changes: 5 additions & 0 deletions src/sextante/gui/ToolboxAction.py
Expand Up @@ -2,6 +2,11 @@
import os
class ToolboxAction(object):

def __init__(self):
#this should be true if the action should be shown even if there are no algorithms
#in the provider (for instance, when it is deactivated
self.showAlways = False

def setData(self,toolbox):
self.toolbox = toolbox

Expand Down
6 changes: 6 additions & 0 deletions src/sextante/modeler/ModelerParametersDialog.py
Expand Up @@ -383,6 +383,12 @@ def setPreviousValues(self):
else:
pass

for out in self.alg.outputs:
if not out.hidden:
value = self.model.algOutputs[self.algIndex][out.name]
if value is not None:
widget = self.valueItems[out.name].setText(str(value))

#TODO


Expand Down

0 comments on commit 180e692

Please sign in to comment.