Skip to content
Permalink
Browse files

[processing][gdal] Fix gdal command does not automatically update

when destination value is changed
  • Loading branch information
nyalldawson committed May 29, 2018
1 parent ad1fef9 commit ff7c70fc87cb14b1398e1352da8d012e3c2f8380
@@ -48,6 +48,7 @@
from processing.gui.ParametersPanel import ParametersPanel
from processing.gui.MultipleInputPanel import MultipleInputPanel
from processing.gui.NumberInputPanel import NumberInputPanel
from processing.gui.DestinationSelectionPanel import DestinationSelectionPanel
from processing.tools.dataobjects import createContext


@@ -88,6 +89,8 @@ def connectParameterSignals(self):
self.connectWidgetChangedSignals(w)
for c in w.findChildren(QWidget):
self.connectWidgetChangedSignals(c)
for output_widget in self.outputWidgets.values():
self.connectWidgetChangedSignals(output_widget)

def connectWidgetChangedSignals(self, w):
if isinstance(w, QLineEdit):
@@ -102,6 +105,8 @@ def connectWidgetChangedSignals(self, w):
w.selectionChanged.connect(self.parametersHaveChanged)
elif isinstance(w, NumberInputPanel):
w.hasChanged.connect(self.parametersHaveChanged)
elif isinstance(w, DestinationSelectionPanel):
w.destinationChanged.connect(self.parametersHaveChanged)

def parametersHaveChanged(self):
context = createContext()
@@ -67,6 +67,7 @@ class DestinationSelectionPanel(BASE, WIDGET):
'DestinationSelectionPanel', '[Skip output]')

skipOutputChanged = pyqtSignal(bool)
destinationChanged = pyqtSignal()

def __init__(self, parameter, alg, default_selection=False):
super(DestinationSelectionPanel, self).__init__(None)
@@ -86,6 +87,7 @@ def __init__(self, parameter, alg, default_selection=False):

def textChanged(self):
self.use_temporary = False
self.destinationChanged.emit()

def outputIsSkipped(self):
"""
@@ -98,6 +100,7 @@ def skipOutput(self):
self.leText.setText('')
self.use_temporary = False
self.skipOutputChanged.emit(True)
self.destinationChanged.emit()

def selectOutput(self):
if isinstance(self.parameter, QgsProcessingParameterFolderDestination):
@@ -159,6 +162,7 @@ def saveToTemporary(self):
self.leText.setText('')
self.use_temporary = True
self.skipOutputChanged.emit(False)
self.destinationChanged.emit()

def saveToPostGIS(self):
dlg = PostgisTableSelector(self, self.parameter.name().lower())
@@ -184,6 +188,7 @@ def saveToPostGIS(self):
self.leText.setText("postgis:" + uri.uri())

self.skipOutputChanged.emit(False)
self.destinationChanged.emit()

def saveToGeopackage(self):
file_filter = self.tr('GeoPackage files (*.gpkg);;All files (*.*)', 'OutputFile')
@@ -215,6 +220,7 @@ def saveToGeopackage(self):
self.leText.setText("ogr:" + uri.uri())

self.skipOutputChanged.emit(False)
self.destinationChanged.emit()

def selectFile(self):
file_filter = getFileFilter(self.parameter)
@@ -257,6 +263,7 @@ def selectFile(self):
settings.setValue(last_ext_path, os.path.splitext(filename)[1].lower())

self.skipOutputChanged.emit(False)
self.destinationChanged.emit()

def selectEncoding(self):
dialog = QgsEncodingSelectionDialog(
@@ -265,6 +272,7 @@ def selectEncoding(self):
self.encoding = dialog.encoding()
settings = QgsSettings()
settings.setValue('/Processing/encoding', self.encoding)
self.destinationChanged.emit()
dialog.deleteLater()

def selectDirectory(self):
@@ -280,6 +288,7 @@ def selectDirectory(self):
settings.setValue('/Processing/LastOutputPath', dirName)

self.skipOutputChanged.emit(False)
self.destinationChanged.emit()

def setValue(self, value):
if not value:
@@ -298,11 +307,13 @@ def setValue(self, value):
self.leText.setText(value.sink.staticValue())
self.use_temporary = False
self.skipOutputChanged.emit(False)
self.destinationChanged.emit()
self.encoding = value.createOptions['fileEncoding']
else:
self.leText.setText(value)
self.use_temporary = False
self.skipOutputChanged.emit(False)
self.destinationChanged.emit()

def getValue(self):
key = None

0 comments on commit ff7c70f

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