Skip to content
Permalink
Browse files

Minor cleanup ParametersPanel

  • Loading branch information
nyalldawson committed Mar 24, 2020
1 parent 6e2c21e commit 91d51914a085cd4eda8e9e41fd4fd271e7c73020
Showing with 8 additions and 17 deletions.
  1. +8 −17 python/plugins/processing/gui/ParametersPanel.py
@@ -32,8 +32,6 @@

from qgis.core import (QgsProcessingParameterDefinition,
QgsProcessingParameterExtent,
QgsProcessingParameterPoint,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterRasterDestination,
QgsProcessingParameterFeatureSink,
QgsProcessingParameterVectorDestination,
@@ -47,10 +45,11 @@
from qgis.utils import iface

from qgis.PyQt import uic
from qgis.PyQt.QtCore import QCoreApplication, Qt
from qgis.PyQt.QtWidgets import (QWidget, QHBoxLayout, QToolButton,
QLabel, QCheckBox, QSizePolicy)
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtCore import QCoreApplication
from qgis.PyQt.QtWidgets import (
QLabel,
QCheckBox
)
from osgeo import gdal

from processing.gui.wrappers import WidgetWrapperFactory, WidgetWrapper
@@ -65,7 +64,6 @@


class ParametersPanel(BASE, WIDGET):

NOT_SELECTED = QCoreApplication.translate('ParametersPanel', '[Not selected]')

def __init__(self, parent, alg, in_place=False):
@@ -111,12 +109,6 @@ def layerRegistryChanged(self, layers):
except AttributeError:
pass

def formatParameterTooltip(self, parameter):
return '<p><b>{}</b></p><p>{}</p>'.format(
parameter.description(),
QCoreApplication.translate('ParametersPanel', 'Python identifier: ‘{}’').format('<i>{}</i>'.format(parameter.name()))
)

def initWidgets(self):
# If there are advanced parameters — show corresponding groupbox
for param in self.alg.parameterDefinitions():
@@ -183,8 +175,6 @@ def initWidgets(self):
desc = param.description()
if isinstance(param, QgsProcessingParameterExtent):
desc += self.tr(' (xmin, xmax, ymin, ymax)')
if isinstance(param, QgsProcessingParameterPoint):
desc += self.tr(' (x, y)')
if param.flags() & QgsProcessingParameterDefinition.FlagOptional:
desc += self.tr(' [optional]')
widget.setText(desc)
@@ -207,7 +197,8 @@ def initWidgets(self):

self.layoutMain.insertWidget(self.layoutMain.count() - 1, label)
self.layoutMain.insertWidget(self.layoutMain.count() - 1, widget)
if isinstance(output, (QgsProcessingParameterRasterDestination, QgsProcessingParameterFeatureSink, QgsProcessingParameterVectorDestination)):
if isinstance(output, (QgsProcessingParameterRasterDestination, QgsProcessingParameterFeatureSink,
QgsProcessingParameterVectorDestination)):
check = QCheckBox()
check.setText(QCoreApplication.translate('ParametersPanel', 'Open output file after running algorithm'))

@@ -218,7 +209,7 @@ def skipOutputChanged(widget, checkbox, skipped):
# Do not try to open formats that are write-only.
value = widget.value()
if value and isinstance(value, QgsProcessingOutputLayerDefinition) and isinstance(output, (
QgsProcessingParameterFeatureSink, QgsProcessingParameterVectorDestination)):
QgsProcessingParameterFeatureSink, QgsProcessingParameterVectorDestination)):
filename = value.sink.staticValue()
if filename not in ('memory:', ''):
path, ext = os.path.splitext(filename)

0 comments on commit 91d5191

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