Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] Fix evaluation of linked parameters in batch mode
e.g. missing fields after selecting a layer parameter
  • Loading branch information
nyalldawson committed Feb 7, 2019
1 parent 2341fa8 commit 7f3640d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion python/plugins/processing/gui/BatchPanel.py
Expand Up @@ -36,13 +36,15 @@
QgsApplication,
QgsSettings,
QgsProcessingParameterDefinition)
from qgis.gui import QgsProcessingParameterWidgetContext
from qgis.gui import (QgsProcessingParameterWidgetContext,
QgsProcessingContextGenerator)
from qgis.utils import iface

from processing.gui.wrappers import WidgetWrapperFactory, WidgetWrapper
from processing.gui.BatchOutputSelectionPanel import BatchOutputSelectionPanel

from processing.tools import dataobjects
from processing.tools.dataobjects import createContext

pluginPath = os.path.split(os.path.dirname(__file__))[0]

Expand Down Expand Up @@ -87,6 +89,19 @@ def __init__(self, parent, alg):
self.tblParameters.horizontalHeader().setDefaultSectionSize(250)
self.tblParameters.horizontalHeader().setMinimumSectionSize(150)

self.processing_context = createContext()

class ContextGenerator(QgsProcessingContextGenerator):

def __init__(self, context):
super().__init__()
self.processing_context = context

def processingContext(self):
return self.processing_context

self.context_generator = ContextGenerator(self.processing_context)

self.initWidgets()

def layerRegistryChanged(self):
Expand Down Expand Up @@ -260,6 +275,7 @@ def setCellWrapper(self, row, column, wrapper, context):
widget_context.setMapCanvas(iface.mapCanvas())
wrapper.setWidgetContext(widget_context)
widget = wrapper.createWrappedWidget(context)
wrapper.registerProcessingContextGenerator(self.context_generator)
else:
widget = wrapper.widget

Expand Down

0 comments on commit 7f3640d

Please sign in to comment.