Skip to content
Permalink
Browse files

[processing] Fix evaluation of linked parameters in batch mode

e.g. missing fields after selecting a layer parameter

(cherry picked from commit 7f3640d)
  • Loading branch information
nyalldawson committed Feb 7, 2019
1 parent 8834ec7 commit 2979a8f7b9e84c466f2f8f31bdc285c07d8e2208
Showing with 17 additions and 1 deletion.
  1. +17 −1 python/plugins/processing/gui/BatchPanel.py
@@ -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]

@@ -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):
@@ -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

0 comments on commit 2979a8f

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