Skip to content

Commit

Permalink
set droplists if parameter values are already set
Browse files Browse the repository at this point in the history
as a result you can set some parameters in
checkBeforeOpeningParametersDialog and they will be the default in the
interface. This is especially usefull when your algo as a lot of
parameters that you can gues (eg from layer names)
  • Loading branch information
vmora committed Jan 3, 2014
1 parent 327f561 commit af55e98
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/plugins/processing/gui/ParametersPanel.py
Expand Up @@ -213,6 +213,10 @@ def getWidgetFromParameter(self, param):
items.append((self.NOT_SELECTED, None))
for layer in layers:
items.append((self.getExtendedLayerName(layer), layer))
# if already set, put first in list
for i,(name,layer) in enumerate(items):
if layer and layer.source() == param.value:
items.insert(0, items.pop(i))
item = InputLayerSelectorPanel(items)
elif isinstance(param, ParameterTable):
if self.somethingDependsOnThisParameter(param):
Expand All @@ -231,6 +235,10 @@ def getWidgetFromParameter(self, param):
items.append((self.NOT_SELECTED, None))
for layer in layers:
items.append((layer.name(), layer))
# if already set, put first in list
for i,(name,layer) in enumerate(items):
if layer and layer.source() == param.value:
items.insert(0, items.pop(i))
item = InputLayerSelectorPanel(items)
elif isinstance(param, ParameterBoolean):
item = QtGui.QComboBox()
Expand Down

0 comments on commit af55e98

Please sign in to comment.