diff --git a/python/plugins/processing/gui/AlgorithmDialog.py b/python/plugins/processing/gui/AlgorithmDialog.py index f093f0316429..2107b1f50af0 100644 --- a/python/plugins/processing/gui/AlgorithmDialog.py +++ b/python/plugins/processing/gui/AlgorithmDialog.py @@ -59,6 +59,7 @@ from processing.gui.AlgorithmDialogBase import AlgorithmDialogBase from processing.gui.AlgorithmExecutor import executeIterating, execute from processing.gui.Postprocessing import handleAlgorithmResults +from processing.gui.wrappers import WidgetWrapper from processing.tools import dataobjects @@ -103,10 +104,11 @@ def getParameterValues(self): except KeyError: continue - try: - widget = wrapper.wrappedWidget() - except AttributeError: + if issubclass(wrapper.__class__, WidgetWrapper): widget = wrapper.widget + else: + widget = wrapper.wrappedWidget() + if widget is None: continue diff --git a/python/plugins/processing/gui/BatchAlgorithmDialog.py b/python/plugins/processing/gui/BatchAlgorithmDialog.py index 49dcb74cdb41..2da27008156c 100644 --- a/python/plugins/processing/gui/BatchAlgorithmDialog.py +++ b/python/plugins/processing/gui/BatchAlgorithmDialog.py @@ -83,8 +83,8 @@ def accept(self): if param.flags() & QgsProcessingParameterDefinition.FlagHidden or param.isDestination(): continue wrapper = self.mainWidget().wrappers[row][col] - parameters[param.name()] = wrapper.value() - if not param.checkValueIsAcceptable(wrapper.value()): + parameters[param.name()] = wrapper.parameterValue() + if not param.checkValueIsAcceptable(wrapper.parameterValue()): self.messageBar().pushMessage("", self.tr('Wrong or missing parameter value: {0} (row {1})').format( param.description(), row + 1), level=Qgis.Warning, duration=5) diff --git a/python/plugins/processing/gui/BatchPanel.py b/python/plugins/processing/gui/BatchPanel.py index acba286cedf1..9431ec84ae7c 100644 --- a/python/plugins/processing/gui/BatchPanel.py +++ b/python/plugins/processing/gui/BatchPanel.py @@ -36,9 +36,8 @@ QgsApplication, QgsSettings, QgsProcessingParameterDefinition) -from qgis.gui import QgsAbstractProcessingParameterWidgetWrapper -from processing.gui.wrappers import WidgetWrapperFactory +from processing.gui.wrappers import WidgetWrapperFactory, WidgetWrapper from processing.gui.BatchOutputSelectionPanel import BatchOutputSelectionPanel from processing.tools import dataobjects @@ -235,7 +234,7 @@ def save(self): def setCellWrapper(self, row, column, wrapper, context): self.wrappers[row][column] = wrapper - is_cpp_wrapper = issubclass(wrapper.__class__, QgsAbstractProcessingParameterWidgetWrapper) + is_cpp_wrapper = not issubclass(wrapper.__class__, WidgetWrapper) if is_cpp_wrapper: widget = wrapper.createWrappedWidget(context) else: diff --git a/python/plugins/processing/gui/ParametersPanel.py b/python/plugins/processing/gui/ParametersPanel.py index af113c0c08e4..f284075b7637 100644 --- a/python/plugins/processing/gui/ParametersPanel.py +++ b/python/plugins/processing/gui/ParametersPanel.py @@ -38,14 +38,10 @@ QgsProcessingParameterExtent, QgsProcessingParameterPoint, QgsProcessingParameterFeatureSource, - QgsProcessingOutputVectorLayer, - QgsProcessingOutputRasterLayer, QgsProcessingParameterRasterDestination, QgsProcessingParameterFeatureSink, QgsProcessingParameterVectorDestination, QgsProject) -from qgis.gui import (QgsGui, - QgsAbstractProcessingParameterWidgetWrapper) from qgis.PyQt import uic from qgis.PyQt.QtCore import QCoreApplication, Qt @@ -54,7 +50,7 @@ from qgis.PyQt.QtGui import QIcon from processing.gui.DestinationSelectionPanel import DestinationSelectionPanel -from processing.gui.wrappers import WidgetWrapperFactory +from processing.gui.wrappers import WidgetWrapperFactory, WidgetWrapper from processing.tools.dataobjects import createContext pluginPath = os.path.split(os.path.dirname(__file__))[0]\ @@ -123,14 +119,14 @@ def initWidgets(self): else: wrapper = WidgetWrapperFactory.create_wrapper(param, self.parent) self.wrappers[param.name()] = wrapper - is_cpp_wrapper = issubclass(wrapper.__class__, QgsAbstractProcessingParameterWidgetWrapper) - if is_cpp_wrapper: + is_python_wrapper = issubclass(wrapper.__class__, WidgetWrapper) + if not is_python_wrapper: widget = wrapper.createWrappedWidget(context) else: widget = wrapper.widget if widget is not None: - if not is_cpp_wrapper: + if is_python_wrapper: widget.setToolTip(param.toolTip()) if isinstance(param, QgsProcessingParameterFeatureSource): @@ -152,7 +148,7 @@ def initWidgets(self): widget.setLayout(layout) label = None - if is_cpp_wrapper: + if not is_python_wrapper: label = wrapper.createWrappedLabel() else: label = wrapper.label @@ -163,7 +159,7 @@ def initWidgets(self): else: self.layoutMain.insertWidget( self.layoutMain.count() - 2, label) - elif not is_cpp_wrapper: + elif is_python_wrapper: desc = param.description() if isinstance(param, QgsProcessingParameterExtent): desc += self.tr(' (xmin, xmax, ymin, ymax)')