Skip to content
Permalink
Browse files

set droplists if parameter values are already set

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 af55e98a4505c27d5f75311638235ac13c66996c
Showing with 8 additions and 0 deletions.
  1. +8 −0 python/plugins/processing/gui/ParametersPanel.py
@@ -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):
@@ -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()

0 comments on commit af55e98

Please sign in to comment.
You can’t perform that action at this time.