Skip to content
Permalink
Browse files

Upgrade postgis widget wrappers to new API

  • Loading branch information
nyalldawson committed Jun 22, 2017
1 parent 8af308d commit 22246dc33252cf371598ab507426b41dfc051b7b
Showing with 16 additions and 17 deletions.
  1. +16 −17 python/plugins/processing/gui/wrappers_postgis.py
@@ -18,17 +18,16 @@
"""


from qgis.core import QgsSettings
from qgis.core import (QgsSettings,
QgsProcessingParameterNumber,
QgsProcessingParameterFile,
QgsProcessingParameterField,
QgsProcessingParameterExpression,
QgsProcessingOutputString,
QgsProcessingParameterString)

from qgis.PyQt.QtWidgets import QComboBox

from processing.core.parameters import (
ParameterString,
ParameterNumber,
ParameterFile,
ParameterTableField,
ParameterExpression
)
from processing.core.outputs import OutputString
from processing.gui.wrappers import (
WidgetWrapper,
ExpressionWidgetWrapperMixin,
@@ -57,8 +56,8 @@ def items(self):

if self.dialogType == DIALOG_MODELER:
strings = self.dialog.getAvailableValuesOfType(
[ParameterString, ParameterNumber, ParameterFile,
ParameterTableField, ParameterExpression], OutputString)
[QgsProcessingParameterString, QgsProcessingParameterNumber, QgsProcessingParameterFile,
QgsProcessingParameterField, QgsProcessingParameterExpression], QgsProcessingOutputString)
items = items + [(self.dialog.resolveValueDescription(s), s) for s in strings]

return items
@@ -91,7 +90,7 @@ def createWidget(self, connection_param=None):

def postInitialize(self, wrappers):
for wrapper in wrappers:
if wrapper.param.name == self._connection_param:
if wrapper.param.name() == self._connection_param:
self.connection_wrapper = wrapper
self.setConnection(wrapper.value())
wrapper.widgetValueHasChanged.connect(self.connectionChanged)
@@ -123,8 +122,8 @@ def refreshItems(self):

if self.dialogType == DIALOG_MODELER:
strings = self.dialog.getAvailableValuesOfType(
[ParameterString, ParameterNumber, ParameterFile,
ParameterTableField, ParameterExpression], OutputString)
[QgsProcessingParameterString, QgsProcessingParameterNumber, QgsProcessingParameterFile,
QgsProcessingParameterField, QgsProcessingParameterExpression], QgsProcessingOutputString)
for text, data in [(self.dialog.resolveValueDescription(s), s) for s in strings]:
self._combo.addItem(text, data)

@@ -162,7 +161,7 @@ def createWidget(self, schema_param=None):

def postInitialize(self, wrappers):
for wrapper in wrappers:
if wrapper.param.name == self._schema_param:
if wrapper.param.name() == self._schema_param:
self.schema_wrapper = wrapper
self.setSchema(wrapper.database(), wrapper.value())
wrapper.widgetValueHasChanged.connect(self.schemaChanged)
@@ -192,8 +191,8 @@ def refreshItems(self):

if self.dialogType == DIALOG_MODELER:
strings = self.dialog.getAvailableValuesOfType(
[ParameterString, ParameterNumber, ParameterFile,
ParameterTableField, ParameterExpression], OutputString)
[QgsProcessingParameterString, QgsProcessingParameterNumber, QgsProcessingParameterFile,
QgsProcessingParameterField, QgsProcessingParameterExpression], QgsProcessingOutputString)
for text, data in [(self.dialog.resolveValueDescription(s), s) for s in strings]:
self._combo.addItem(text, data)

0 comments on commit 22246dc

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